Using clang compiler trough cygwin64 results in error "cannot find -liconv"
I'm trying to use clang as my C and C++ compiler in CLion. I installed cygwin64, installed the packages listed here https://www.jetbrains.com/help/clion/quick-tutorial-on-configuring-clion-on-windows.html#Cygwin and the clang package too of course. Then I set up my toolchain like this:

Trying to refresh the cmake project results in the following error:
C:\Users\Karel\.CLion2019.1\system\cygwin_cmake\bin\cmake.exe -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=C:/Install/cygwin64/bin/clang -DCMAKE_CXX_COMPILER=C:/Install/cygwin64/bin/clang++ -G "CodeBlocks - Unix Makefiles" /cygdrive/c/Documents/Programming/STTT/csttt
-- The C compiler identification is Clang 5.0.1
-- The CXX compiler identification is Clang 5.0.1
-- Check for working C compiler: C:/Install/cygwin64/bin/clang
-- Check for working C compiler: C:/Install/cygwin64/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Install/cygwin64/bin/clang++
-- Check for working CXX compiler: C:/Install/cygwin64/bin/clang++ -- broken
CMake Error at /cygdrive/c/Users/Karel/.CLion2019.1/system/cygwin_cmake/share/cmake-3.14.2/Modules/CMakeTestCXXCompiler.cmake:53 (message):
The C++ compiler
"C:/Install/cygwin64/bin/clang++"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /cygdrive/c/Documents/Programming/STTT/csttt/cmake-build-debug/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make.exe cmTC_dc8c9/fast
/usr/bin/make -f CMakeFiles/cmTC_dc8c9.dir/build.make CMakeFiles/cmTC_dc8c9.dir/build
make[1]: Entering directory '/cygdrive/c/Documents/Programming/STTT/csttt/cmake-build-debug/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_dc8c9.dir/testCXXCompiler.cxx.o
C:/Install/cygwin64/bin/clang++ -o CMakeFiles/cmTC_dc8c9.dir/testCXXCompiler.cxx.o -c /cygdrive/c/Documents/Programming/STTT/csttt/cmake-build-debug/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
Linking CXX executable cmTC_dc8c9.exe
/cygdrive/c/Users/Karel/.CLion2019.1/system/cygwin_cmake/bin/cmake.exe -E cmake_link_script CMakeFiles/cmTC_dc8c9.dir/link.txt --verbose=1
C:/Install/cygwin64/bin/clang++ -Wl,--enable-auto-import CMakeFiles/cmTC_dc8c9.dir/testCXXCompiler.cxx.o -o cmTC_dc8c9.exe -Wl,--out-implib,libcmTC_dc8c9.dll.a -Wl,--major-image-version,0,--minor-image-version,0
/usr/bin/ld: cannot find -liconv
clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [CMakeFiles/cmTC_dc8c9.dir/build.make:87: cmTC_dc8c9.exe] Error 1
make[1]: Leaving directory '/cygdrive/c/Documents/Programming/STTT/csttt/cmake-build-debug/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_dc8c9/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)
-- Configuring incomplete, errors occurred!
See also "/cygdrive/c/Documents/Programming/STTT/csttt/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "/cygdrive/c/Documents/Programming/STTT/csttt/cmake-build-debug/CMakeFiles/CMakeError.log".
[Finished]
Is there anything I did wrong? Did I forget to do something?
Please sign in to leave a comment.
Hello!
Does adding -DCMAKE_TOOLCHAIN_PREFIX=llvm to File | Settings | Build, Execution, Deployment | CMake > CMake options (as it's suggested here) help?