View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0014792 | CMake | (No Category) | public | 2014-03-07 03:28 | 2016-06-10 14:31 | ||||
Reporter | Mathieu Malaterre | ||||||||
Assigned To | Kitware Robot | ||||||||
Priority | normal | Severity | feature | Reproducibility | have not tried | ||||
Status | closed | Resolution | moved | ||||||
Platform | OS | OS Version | |||||||
Product Version | CMake 2.8.11.1 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0014792: Teach CMakeDetermineCompilerABI to handle TinyCC | ||||||||
Description | Steps: $ cat ../CMakeLists.txt cmake_minimum_required(VERSION 2.8) project(tcc C) find_package(ZLIB REQUIRED) $ export CC=/usr/bin/tcc $ cmake .. -- The C compiler identification is TinyCC -- Check for working C compiler: /usr/bin/tcc -- Check for working C compiler: /usr/bin/tcc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message): Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found version "1.2.7") Call Stack (most recent call first): /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE) /usr/share/cmake-2.8/Modules/FindZLIB.cmake:85 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:3 (find_package) -- Configuring incomplete, errors occurred! However: $ rm -rf * $ unset CC $ cmake .. -- The C compiler identification is GNU 4.7.2 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.7") -- Configuring done -- Generating done -- Build files have been written to: /tmp/dd/bin | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0035334) Mathieu Malaterre (developer) 2014-03-07 03:37 |
Reduced test case: $ cat CMakeLists.txt project(foobar C) find_library(ZLIB_LIBRARY z) So my guess is that: - project(... C) with TinyCC set, never loads the GNU*.cmake stuff - if GNU stuff is not loaded, multi-arch paths are not appended to the search paths Comments ? |
(0035335) Rolf Eike Beer (developer) 2014-03-07 05:54 |
Wild guess: tcc is a 32 bit compiler, gcc picks up the 64 bit lib, so you maybe don't have a 32 bit zlib around. |
(0035336) Mathieu Malaterre (developer) 2014-03-07 06:01 |
$ cat a.c int main() { return 0; } $ tcc -o a a.c $ file a a: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), not stripped |
(0035354) Brad King (manager) 2014-03-10 10:26 |
CMake learns the library architecture triplet from the compiler. If tcc does not know it then CMake will not learn it from that compiler. |
(0035355) Mathieu Malaterre (developer) 2014-03-10 10:29 |
Could you please give a little more details on what you mean by "If tcc does not know it". Steps: $ tcc -o a a.c -lz $ ldd a linux-vdso.so.1 => (0x00007fff1cf2e000) libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f7a42a71000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7a426e7000) /lib64/ld-linux-x86-64.so.2 (0x00007f7a42cb0000) $ cat a.c int main() { return 0; } thanks |
(0035359) Brad King (manager) 2014-03-10 10:58 |
CMake detects the list of directories implicitly passed by the compiler front-end to the linker. From that it looks for one that matches the library architecture triplet: http://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/CMakeDetermineCompilerABI.cmake;hb=v3.0.0-rc1#l118 [^] Look at CMakeFiles/CMakeOutput.log to see information about how CMake extracts this information from the compiler output. Compare behavior with gcc and tcc. |
(0035362) Mathieu Malaterre (developer) 2014-03-10 11:06 |
For some reason cmake knows how to use '-v' for gcc to find those. For tcc, one need to use '-vv': $ tcc -o a -vv a.c tcc version 0.9.26 (x86-64 Linux) -> /usr/lib/x86_64-linux-gnu/crt1.o -> /usr/lib/x86_64-linux-gnu/crti.o -> a.c -> /usr/lib/x86_64-linux-gnu/libc.so -> /lib/x86_64-linux-gnu/libc.so.6 -> /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 -> /usr/lib/x86_64-linux-gnu/libc_nonshared.a -> /lib/x86_64-linux-gnu/libc.so.6 -> /usr/lib/x86_64-linux-gnu/libc_nonshared.a -> /usr/lib/x86_64-linux-gnu/../tcc/libtcc1.a -> /usr/lib/x86_64-linux-gnu/crtn.o <- a $ cat a.c int main() { return 0; } |
(0035363) Brad King (manager) 2014-03-10 11:16 |
Cool. Try this patch: diff --git a/Modules/Compiler/TinyCC-C.cmake b/Modules/Compiler/TinyCC-C.cmake index f7937ac..b79268a 100644 --- a/Modules/Compiler/TinyCC-C.cmake +++ b/Modules/Compiler/TinyCC-C.cmake @@ -1,3 +1,4 @@ +set(CMAKE_C_VERBOSE_FLAG "-vv") set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # no optimization in tcc: |
(0035364) Mathieu Malaterre (developer) 2014-03-10 11:20 |
The way it is written, cmake expect to find in the output either ld or collect2 (and or the explicit linker name). In the case of tcc, the so-called verbose output is rather crude: $ tcc -vv tcc version 0.9.26 (x86-64 Linux) install: /usr/lib/x86_64-linux-gnu/../tcc/ crt: /usr/lib/x86_64-linux-gnu libraries: /usr/lib/x86_64-linux-gnu /lib/x86_64-linux-gnu /usr/local/lib/x86_64-linux-gnu include: /usr/local/include /usr/local/include/x86_64-linux-gnu /usr/include /usr/include/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/../tcc/include elfinterp: /lib64/ld-linux-x86-64.so.2 |
(0035366) Brad King (manager) 2014-03-10 11:26 |
In that case the implicit library search path detection logic will need to be taught to handle TinyCC output. |
(0035367) Brad King (manager) 2014-03-10 11:27 |
So TinyCC has no option to print out the command-lines it invokes internally? |
(0035373) Mathieu Malaterre (developer) 2014-03-10 12:08 |
Well, I could not find any. I'll update the bug tracker once upstream confirms: http://lists.nongnu.org/archive/html/tinycc-devel/2014-03/msg00024.html [^] |
(0035383) Mathieu Malaterre (developer) 2014-03-11 09:17 |
As explained here: http://lists.nongnu.org/archive/html/tinycc-devel/2014-03/msg00025.html [^] tcc is a compiler *and* a linker. |
(0042502) Kitware Robot (administrator) 2016-06-10 14:29 |
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. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2014-03-07 03:28 | Mathieu Malaterre | New Issue | |
2014-03-07 03:37 | Mathieu Malaterre | Note Added: 0035334 | |
2014-03-07 05:54 | Rolf Eike Beer | Note Added: 0035335 | |
2014-03-07 06:01 | Mathieu Malaterre | Note Added: 0035336 | |
2014-03-07 07:09 | Philipp Möller | Note Added: 0035337 | |
2014-03-07 07:35 | Philipp Möller | Note Deleted: 0035337 | |
2014-03-10 05:39 | Mathieu Malaterre | Summary | find_package behavior affected by tcc => find_package + tcc is not multi-arch capable (cannot search in usr/lib/*/*.so) |
2014-03-10 10:26 | Brad King | Note Added: 0035354 | |
2014-03-10 10:29 | Mathieu Malaterre | Note Added: 0035355 | |
2014-03-10 10:58 | Brad King | Note Added: 0035359 | |
2014-03-10 11:06 | Mathieu Malaterre | Note Added: 0035362 | |
2014-03-10 11:16 | Brad King | Note Added: 0035363 | |
2014-03-10 11:20 | Mathieu Malaterre | Note Added: 0035364 | |
2014-03-10 11:26 | Brad King | Note Added: 0035366 | |
2014-03-10 11:26 | Brad King | Severity | minor => feature |
2014-03-10 11:26 | Brad King | Status | new => backlog |
2014-03-10 11:26 | Brad King | Summary | find_package + tcc is not multi-arch capable (cannot search in usr/lib/*/*.so) => Teach CMakeDetermineCompilerABI to handle TinyCC |
2014-03-10 11:27 | Brad King | Note Added: 0035367 | |
2014-03-10 12:08 | Mathieu Malaterre | Note Added: 0035373 | |
2014-03-11 09:17 | Mathieu Malaterre | Note Added: 0035383 | |
2016-06-10 14:29 | Kitware Robot | Note Added: 0042502 | |
2016-06-10 14:29 | Kitware Robot | Status | backlog => 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 |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |