View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012605CMakeCMakepublic2011-12-02 09:272012-05-09 15:26
ReporterMathieu Malaterre 
Assigned ToBrad King 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake 2.8.7 
Target VersionCMake 2.8.7Fixed in VersionCMake 2.8.7 
Summary0012605: Please add support for tcc/shared libs
Descriptiontcc and cmake do not work together. It currently fails with:

$ /usr/bin/tcc -shared -Wl,-soname,libopenjpeg.so.1 -o ../bin/libopenjpeg.so.1.99.0 ...

tcc: unsupported linker option '-soname,libopenjpeg.so.1'
make[2]: *** [bin/libopenjpeg.so.1.99.0] Error 1
Additional Information$ tcc
[...]
Linker options:
  -Ldir add library path 'dir'
  -llib link with dynamic or static library 'lib'
  -shared generate a shared library
  -soname set name for shared library to be used at runtime
  -static static linking
  -rdynamic export all global symbols to dynamic linker
  -r generate (relocatable) object file
TagsNo tags attached.
Attached Filespatch file icon 1f49d725+0001-TinyCC-Add-compiler-info-for-shared-libs-on-Linux-12.patch [^] (1,399 bytes) 2011-12-02 10:29 [Show Content]
patch file icon 0251-Add-default-compilation-flags-for-TinyCC.patch [^] (1,004 bytes) 2011-12-02 11:40 [Show Content]
patch file icon 0001-Add-default-compilation-flags-for-TinyCC.patch [^] (822 bytes) 2011-12-03 06:24 [Show Content]

 Relationships

  Notes
(0027887)
Brad King (manager)
2011-12-02 10:02

Are you referring to the "Tiny C Compiler":

 http://bellard.org/tcc/ [^]

?
(0027888)
Mathieu Malaterre (developer)
2011-12-02 10:03

Yes, sorry if this was not clear. On debian, simply do:

$ sudo apt-get install tcc
(0027889)
Brad King (manager)
2011-12-02 10:15

Minimal initial change to recognize the compiler id:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1f49d725 [^]
(0027890)
Brad King (manager)
2011-12-02 10:31

Try the patch 1f49d725+0001-TinyCC-Add-compiler-info-for-shared-libs-on-Linux-12.patch on top of commit 1f49d725. It seems sufficient for the CMake COnly test to build (static lib, shared lib, and exec). However the resulting executable does not run:

COnly$ export LD_LIBRARY_PATH=.
COnly$ ldd ./COnly 
        linux-vdso.so.1 =>  (0x00007ffff9562000)
        libtestc2.so => ./libtestc2.so (0x00007f09f9023000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f09f8c79000)
        /lib/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 (0x00007f09f9027000)
COnly$ ./COnly 
bash: ./COnly: No such file or directory
(0027893)
Mathieu Malaterre (developer)
2011-12-02 11:08

Works for me (debian/squeeze),

$ tcc -version
tcc version 0.9.25

$ LD_LIBRARY_PATH=. ./COnly
Foo: Foo 0


$ ldd ./COnly
linux-vdso.so.1 => (0x00007fff60efe000)
    libtestc2.so => not found
    libc.so.6 => /lib/libc.so.6 (0x00007fc04f426000)
    /lib/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 (0x00007fc04f7b0000)

$ readelf -d libtestc2.so

Dynamic section at offset 0x464 contains 12 entries:
  Tag Type Name/Value
 0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
 0x000000000000000e (SONAME) Library soname: [libtestc2.so]
 0x0000000000000016 (TEXTREL) 0x0
 0x0000000000000004 (HASH) 0x350
 0x0000000000000005 (STRTAB) 0x268
 0x0000000000000006 (SYMTAB) 0xe8
 0x000000000000000a (STRSZ) 231 (bytes)
 0x000000000000000b (SYMENT) 24 (bytes)
 0x0000000000000007 (RELA) 0x3b8
 0x0000000000000008 (RELASZ) 48 (bytes)
 0x0000000000000009 (RELAENT) 24 (bytes)
 0x0000000000000000 (NULL) 0x0

Marking as closed ?
(0027894)
Mathieu Malaterre (developer)
2011-12-02 11:13

I can build openjpeg fine (in absolutely no time). Thanks !
(0027895)
Mathieu Malaterre (developer)
2011-12-02 11:17

tcc does support debug info with -g switch:


Debugger options:
  -g generate runtime debug info
  -bt N show N callers in stack traces
(0027896)
Brad King (manager)
2011-12-02 11:28

Okay, second patch applied:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ec636e29 [^]

Please take it from there to add all the other platform information as you need and send a patch with the results.
(0027897)
Mathieu Malaterre (developer)
2011-12-02 11:40

Uploaded as 0251-Add-default-compilation-flags-for-TinyCC.patch

Thanks
(0027898)
Brad King (manager)
2011-12-02 13:07

I think this hunk:

+# no optimisation in tcc:
+SET (CMAKE_C_FLAGS_INIT "")
+SET (CMAKE_C_FLAGS_DEBUG_INIT "-g")
+SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "-DNDEBUG")
+SET (CMAKE_C_FLAGS_RELEASE_INIT "-DNDEBUG")
+SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-g")

can go in Modules/Compiler/TinyCC-C.cmake instead because they are not platform-specific flags for the compiler. Please test that and update the patch.
(0027902)
Mathieu Malaterre (developer)
2011-12-03 06:24

Uploaded as 0001-Add-default-compilation-flags-for-TinyCC.patch
I can still build openjpeg fine.

Thanks
(0027910)
Brad King (manager)
2011-12-05 09:02

Thanks. I've applied the latest patch from 0012605:0027902:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0efe602c [^]

I'm marking this issue as fixed because basic support has been added. Please post further patches to the developer's list.
(0029450)
David Cole (manager)
2012-05-09 15:26

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2011-12-02 09:27 Mathieu Malaterre New Issue
2011-12-02 10:02 Brad King Note Added: 0027887
2011-12-02 10:03 Mathieu Malaterre Note Added: 0027888
2011-12-02 10:15 Brad King Note Added: 0027889
2011-12-02 10:29 Brad King File Added: 1f49d725+0001-TinyCC-Add-compiler-info-for-shared-libs-on-Linux-12.patch
2011-12-02 10:31 Brad King Note Added: 0027890
2011-12-02 10:31 Brad King Assigned To => Brad King
2011-12-02 10:31 Brad King Status new => assigned
2011-12-02 11:08 Mathieu Malaterre Note Added: 0027893
2011-12-02 11:13 Mathieu Malaterre Note Added: 0027894
2011-12-02 11:17 Mathieu Malaterre Note Added: 0027895
2011-12-02 11:28 Brad King Note Added: 0027896
2011-12-02 11:40 Mathieu Malaterre File Added: 0251-Add-default-compilation-flags-for-TinyCC.patch
2011-12-02 11:40 Mathieu Malaterre Note Added: 0027897
2011-12-02 13:07 Brad King Note Added: 0027898
2011-12-03 06:24 Mathieu Malaterre Note Added: 0027902
2011-12-03 06:24 Mathieu Malaterre File Added: 0001-Add-default-compilation-flags-for-TinyCC.patch
2011-12-05 09:02 Brad King Note Added: 0027910
2011-12-05 09:02 Brad King Status assigned => resolved
2011-12-05 09:02 Brad King Resolution open => fixed
2011-12-16 17:26 David Cole Fixed in Version => CMake 2.8.7
2011-12-16 17:26 David Cole Target Version => CMake 2.8.7
2012-05-09 15:26 David Cole Note Added: 0029450
2012-05-09 15:26 David Cole Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team