MantisBT - CMake | |||||
| View Issue Details | |||||
| ID | Project | Category | View Status | Date Submitted | Last Update |
| 0016059 | CMake | CMake | public | 2016-04-12 12:00 | 2016-06-10 14:31 |
| Reporter | Antonio | ||||
| Assigned To | Kitware Robot | ||||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | moved | ||
| Platform | X86 | OS | Windows | OS Version | 7 |
| Product Version | CMake 3.4.1 | ||||
| Target Version | Fixed in Version | ||||
| Summary | 0016059: It is not possible to specify a linker different from the compiler to link a shared library | ||||
| Description | In some situations, it might be convenient to specify a different linker than the compiler. For example, for llvm combined with mingw, compiling with clang and linking with gcc would work. The workaround proposed here https://cmake.org/pipermail/cmake/2014-August/058268.html [^] does not seem to work. | ||||
| Steps To Reproduce | Requires 2 compilers to be there. In the attached project, Configuring with D:\dummyProj\build> cmake ..\src -G "Eclipse CDT4 - Ninja" -DCMAKE_TOOLCHAIN_FILE=..\src\Toolchain-LLVM.cmake -DCMAKE_LINKER=C:/Programs/mingw32_493_posix_dwarf/bin/g++.exe -DCMAKE_CXX_LINK_EXECUTABLE="<CMAKE_LINKER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>" -DCMAKE_CXX_CREATE_SHARED_LIBRARY="<CMAKE_LINKER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" Building will anyway lead to the following commands to be generated: [1/2] C:\Programs\LLVM\bin\clang++.exe -Ddummy_EXPORTS -MMD -MT CMakeFiles/dummy.dir/dummy.cpp.obj -MF CMakeFiles/dummy.dir/dummy.cpp.obj.d -o CMakeFiles/dummy.dir/dummy.cpp.obj -c D:/dummyProj/src/dummy.cpp [2/2] cmd.exe /C "cd . && C:\Programs\LLVM\bin\clang++.exe -shared -o libdummy.dll -Wl,--out-implib,libdummy.dll.a -Wl,--major-image-version,0,--minor-image-version,0 CMakeFiles/dummy.dir/dummy.cpp.obj -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ." FAILED: cmd.exe /C "cd . && C:\Programs\LLVM\bin\clang++.exe -shared -o libdummy.dll -Wl,--out-implib,libdummy.dll.a -Wl,--major-image-version,0,--minor-image-version,0 CMakeFiles/dummy.dir/dummy.cpp.obj -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ." C:\Programs\mingw32_493_posix_dwarf\i686-w64-mingw32\lib/libmingw32.a(lib32_libmingw32_a-pseudo-reloc.o):pseudo-reloc.c:(.text+0x1d6): undefined reference to `__chkstk_ms' clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation) ninja: build stopped: subcommand failed. The first command is correct, the second doesn't use g++ to link as desired. Linking succeeds if g++ is replaced in the command line. | ||||
| Additional Information | |||||
| Tags | Clang, CMake, linker, LLVM | ||||
| Relationships | |||||
| Attached Files | https://public.kitware.com/Bug/file/5673/* | ||||
| Issue History | |||||
| Date Modified | Username | Field | Change | ||
| 2016-04-12 12:00 | Antonio | New Issue | |||
| 2016-04-12 12:00 | Antonio | File Added: dummyProj.zip | |||
| 2016-04-20 09:28 | Antonio | Tag Attached: Clang | |||
| 2016-04-20 09:28 | Antonio | Tag Attached: linker | |||
| 2016-04-20 09:28 | Antonio | Tag Attached: locale | |||
| 2016-04-20 09:28 | Antonio | Tag Detached: locale | |||
| 2016-04-20 09:29 | Antonio | Tag Attached: CMake | |||
| 2016-04-20 09:29 | Antonio | Tag Attached: LLVM | |||
| 2016-06-10 14:29 | Kitware Robot | Note Added: 0042980 | |||
| 2016-06-10 14:29 | Kitware Robot | Status | new => resolved | ||
| 2016-06-10 14:29 | Kitware Robot | Resolution | open => moved | ||
| 2016-06-10 14:29 | Kitware Robot | Assigned To | => Kitware Robot | ||
| 2016-06-10 14:31 | Kitware Robot | Status | resolved => closed | ||
| Notes | |||||
|
|
|||||
|
|
||||