Notes |
|
(0032398)
|
Lebedev Roman
|
2013-02-27 14:48
|
|
The problem lies in empty CMAKE_CXX_IMPLICIT_LINK_LIBRARIES |
|
|
(0032399)
|
Bill Hoffman
|
2013-02-27 14:58
|
|
In the one that works this library links to c++ and m:
Linking C shared library libdarktable.so
-lstdc++ -lm
The other is missing that.
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "stdc++;m;c")
set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2;/usr/lib64;/lib64;/usr/x86_64-pc-linux-gnu/lib;/lib;/usr/lib")
vs
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "")
set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "")
The trouble seems to be in the CMakeOutput-bad.log file here:
ignore line: [ "/usr/bin/x86_64-pc-linux-gnu-ld" -export-dynamic --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTryCompileExec1866823997 /usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../lib64/crt1.o /usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/crtbegin.o -L/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2 -L/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../x86_64-pc-linux-gnu/lib -L/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../.. -L/lib -L/usr/lib -plugin /usr/bin/../lib64/llvm/LLVMgold.so -plugin-opt=mcpu=x86-64 CMakeFiles/cmTryCompileExec1866823997.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/crtend.o /usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../lib64/crtn.o]
ignore line: [gmake[1]: Leaving directory `/home/pinipini/darktable/build/CMakeFiles/CMakeTmp']
ignore line: []
Working one does this:
link line: [ "/usr/bin/x86_64-pc-linux-gnu-ld" -export-dynamic --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTryCompileExec3835301014 /usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../lib64/crt1.o /usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/crtbegin.o -L/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2 -L/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../x86_64-pc-linux-gnu/lib -L/usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../.. -L/lib -L/usr/lib -plugin /usr/bin/../lib64/llvm/LLVMgold.so -plugin-opt=mcpu=x86-64 CMakeFiles/cmTryCompileExec3835301014.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/crtend.o /usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../lib64/crtn.o] |
|
|
(0032400)
|
Brad King
|
2013-02-27 15:24
|
|
Please attach CMakeFiles/CMakeOutput.log and CMakeFiles/CMakeError.log from the failing and working trees. |
|
|
(0032401)
|
Brad King
|
2013-02-27 15:28
|
|
Oops, I see CMakeOutput.log is already there.
From CMakeOutput-bad.log:
Parsed CXX implicit link information from above output:
link line regex: [^( *|.*[/\])(ld|ld|collect2)[^/\]*( |$)]
From CMakeOutput-good.log:
Parsed CXX implicit link information from above output:
link line regex: [^( *|.*[/\])(x86_64-pc-linux-gnu-ld|ld|collect2)[^/\]*( |$)]
The bad one has CMAKE_LINKER set to "ld" and the good one has it set to x86_64-pc-linux-gnu-ld. |
|
|
(0032402)
|
Brad King
|
2013-02-27 15:30
|
|
Re 0013960:0032401: The good one found the "right" linker because of your -D_CMAKE_TOOLCHAIN_PREFIX=x86_64-pc-linux-gnu- workaround.
Any idea how we can find the right linker for this toolchain automatically? |
|
|
(0032403)
|
Brad King
|
2013-02-27 15:36
|
|
Re 0013960:0032402: While we still need an approach to set CMAKE_LINKER correctly, here is a patch that may help find the implicit link information even without the proper CMAKE_LINKER in this case.
diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake
index 80e0218..fa03630 100644
--- a/Modules/CMakeParseImplicitLinkInfo.cmake
+++ b/Modules/CMakeParseImplicitLinkInfo.cmake
@@ -29,7 +29,7 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
endif()
# Construct a regex to match linker lines. It must match both the
# whole line and just the command (argv[0]).
- set(linker_regex "^( *|.*[/\\])(${linker}|ld|collect2)[^/\\]*( |$)")
+ set(linker_regex "^( *|.*[/\\])(${linker}|([^/\\]+-)?ld|collect2)[^/\\]*( |$)")
set(linker_exclude_regex "collect2 version ")
set(log "${log} link line regex: [${linker_regex}]\n")
string(REGEX REPLACE "\r?\n" ";" output_lines "${text}")
|
|
|
(0032973)
|
Matthias Maier
|
2013-05-04 19:17
|
|
I can confirm this issue.
The workaround by Brad King in the last comment - relaxing the linker_regex in CMakeParseImplicitLinkInfo.cmake does mitigate the problem. |
|
|
(0032977)
|
Brad King
|
2013-05-06 09:00
|
|
|
|
(0042240)
|
Kitware Robot
|
2016-06-10 14:28
|
|
Resolving issue as `moved`.
This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page. |
|