[cmake-developers] Apple tests for target_link_libraries failing

Rolf Eike Beer eike at sf-mail.de
Thu Oct 13 10:13:03 EDT 2011


> Stephen Kelly wrote:
>
>> The tests can be enabled on APPLE again later, I've flipped the if
>> condition so we can see why it fails on some non-APPLE platforms too.
>>
>
> This is even more interesting now.
>
> http://www.cdash.org/CDash/testDetails.php?test=118872016&build=1620094
>
> On gentoo, the build of the exec executable succeeds, even though it only
> links to libC, and that only links to libA, even though it uses classB
> from
> libB (which is not linked to).

libB is in the needed section (see below). The only special thing that I
can think of is the -Wl,--unique=.text.* flag I put into C_FLAGS, as CMake
itself would otherwise not link because of a binutils breakage. No idea if
that is related.

buildbot at voyager
~/repos/build/cmake/Tests/CMakeCommands/target_link_libraries/fail19 $  ll
total 36
-rw-r--r-- 1 buildbot buildbot 9772 Oct 13 15:51 CMakeCache.txt
drwxr-xr-x 3 buildbot buildbot 4096 Oct 13 16:04 CMakeFiles
-rw-r--r-- 1 buildbot buildbot 1753 Oct 13 15:51 cmake_install.cmake
-rwxr-xr-x 1 buildbot buildbot 7768 Oct 13 16:04 exec
-rw-r--r-- 1 buildbot buildbot 4956 Oct 13 16:04 Makefile
buildbot at voyager
~/repos/build/cmake/Tests/CMakeCommands/target_link_libraries/fail19 $ 
./exec
buildbot at voyager
~/repos/build/cmake/Tests/CMakeCommands/target_link_libraries/fail19 $ 
echo $?
0
buildbot at voyager
~/repos/build/cmake/Tests/CMakeCommands/target_link_libraries/fail19 $ 
ldd exec
        liblibC.so =>
/home/buildbot/repos/build/cmake/Tests/CMakeCommands/target_link_libraries/libs_build_True_False/liblibC.so
(0x401ca000)
        libstdc++.so.6 =>
/usr/lib/gcc/hppa2.0-unknown-linux-gnu/4.5.3/libstdc++.so.6
(0x403a5000)
        libm.so.6 => /lib/libm.so.6 (0x405b3000)
        libgcc_s.so.4 =>
/usr/lib/gcc/hppa2.0-unknown-linux-gnu/4.5.3/libgcc_s.so.4
(0x407d3000)
        libc.so.6 => /lib/libc.so.6 (0x4096b000)
        liblibB.so =>
/home/buildbot/repos/build/cmake/Tests/CMakeCommands/target_link_libraries/libs_build_True_False/liblibB.so
(0x401c5000)
        liblibA.so =>
/home/buildbot/repos/build/cmake/Tests/CMakeCommands/target_link_libraries/libs_build_True_False/liblibA.so
(0x40241000)
        /lib/ld.so.1 (0x40063000)
buildbot at voyager
~/repos/build/cmake/Tests/CMakeCommands/target_link_libraries/fail19 $ 
objdump -x exec

exec:     file format elf32-hppa-linux
exec
architecture: hppa1.1, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x00010650

Program Header:
    PHDR off    0x00000034 vaddr 0x00010034 paddr 0x00010034 align 2**2
         filesz 0x00000100 memsz 0x00000100 flags r-x
  INTERP off    0x00000134 vaddr 0x00010134 paddr 0x00010134 align 2**0
         filesz 0x0000000d memsz 0x0000000d flags r--
    LOAD off    0x00000000 vaddr 0x00010000 paddr 0x00010000 align 2**12
         filesz 0x00000be4 memsz 0x00000be4 flags r-x
    LOAD off    0x00001000 vaddr 0x00011000 paddr 0x00011000 align 2**12
         filesz 0x0000019c memsz 0x000001b0 flags rwx
 DYNAMIC off    0x00001014 vaddr 0x00011014 paddr 0x00011014 align 2**2
         filesz 0x00000108 memsz 0x00000108 flags rw-
    NOTE off    0x00000144 vaddr 0x00010144 paddr 0x00010144 align 2**2
         filesz 0x00000020 memsz 0x00000020 flags r--
EH_FRAME off    0x00000b74 vaddr 0x00010b74 paddr 0x00010b74 align 2**2
         filesz 0x0000001c memsz 0x0000001c flags r--
PAX_FLAGS off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**2
         filesz 0x00000000 memsz 0x00000000 flags --- 2800

Dynamic Section:
  NEEDED               liblibC.so
  NEEDED               libstdc++.so.6
  NEEDED               libm.so.6
  NEEDED               libgcc_s.so.4
  NEEDED               libc.so.6
  NEEDED               liblibB.so
  RPATH               
/home/buildbot/repos/build/cmake/Tests/CMakeCommands/target_link_libraries/libs_build_True_False
  RUNPATH             
/home/buildbot/repos/build/cmake/Tests/CMakeCommands/target_link_libraries/libs_build_True_False
  INIT                 0x000105e8
  FINI                 0x00010a54
  HASH                 0x00010164
  GNU_HASH             0x00010200
  STRTAB               0x000103a8
  SYMTAB               0x00010268
  STRSZ                0x00000179
  SYMENT               0x00000010
  PLTGOT               0x0001111c
  DEBUG                0x00000000
  PLTRELSZ             0x00000060
  PLTREL               0x00000007
  JMPREL               0x00010578
  RELA                 0x0001056c
  RELASZ               0x0000000c
  RELAENT              0x0000000c
  VERNEED              0x0001054c
  VERNEEDNUM           0x00000001
  VERSYM               0x00010522

Version References:
  required from libc.so.6:
    0x0d696912 0x00 02 GLIBC_2.2

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .interp       0000000d  00010134  00010134  00000134  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .note.ABI-tag 00000020  00010144  00010144  00000144  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .hash         0000009c  00010164  00010164  00000164  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .gnu.hash     00000068  00010200  00010200  00000200  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .dynsym       00000140  00010268  00010268  00000268  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  5 .dynstr       00000179  000103a8  000103a8  000003a8  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  6 .gnu.version  00000028  00010522  00010522  00000522  2**1
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  7 .gnu.version_r 00000020  0001054c  0001054c  0000054c  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  8 .rela.dyn     0000000c  0001056c  0001056c  0000056c  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  9 .rela.plt     00000060  00010578  00010578  00000578  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 10 .init         00000048  000105d8  000105d8  000005d8  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 11 .text         00000434  00010620  00010620  00000620  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 12 .fini         00000028  00010a54  00010a54  00000a54  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 13 .rodata       00000018  00010a7c  00010a7c  00000a7c  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 14 .PARISC.unwind 000000e0  00010a94  00010a94  00000a94  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 15 .eh_frame_hdr 0000001c  00010b74  00010b74  00000b74  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 16 .eh_frame     00000054  00010b90  00010b90  00000b90  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 17 .ctors        00000008  00011000  00011000  00001000  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 18 .dtors        00000008  00011008  00011008  00001008  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 19 .jcr          00000004  00011010  00011010  00001010  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 20 .dynamic      00000108  00011014  00011014  00001014  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 21 .data         00000008  0001111c  0001111c  0000111c  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 22 .plt          0000005c  00011124  00011124  00001124  2**2
                  CONTENTS, ALLOC, LOAD, CODE
 23 .got          0000001c  00011180  00011180  00001180  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 24 .bss          00000014  0001119c  0001119c  0000119c  2**2
                  ALLOC
 25 .comment      0000002d  00000000  00000000  0000119c  2**0
                  CONTENTS, READONLY
 26 .note         00000014  00000000  00000000  000011c9  2**0
                  CONTENTS, READONLY
SYMBOL TABLE:
00010134 l    d  .interp        00000000              .interp
00010144 l    d  .note.ABI-tag  00000000              .note.ABI-tag
00010164 l    d  .hash  00000000              .hash
00010200 l    d  .gnu.hash      00000000              .gnu.hash
00010268 l    d  .dynsym        00000000              .dynsym
000103a8 l    d  .dynstr        00000000              .dynstr
00010522 l    d  .gnu.version   00000000              .gnu.version
0001054c l    d  .gnu.version_r 00000000              .gnu.version_r
0001056c l    d  .rela.dyn      00000000              .rela.dyn
00010578 l    d  .rela.plt      00000000              .rela.plt
000105d8 l    d  .init  00000000              .init
00010620 l    d  .text  00000000              .text
00010a54 l    d  .fini  00000000              .fini
00010a7c l    d  .rodata        00000000              .rodata
00010a94 l    d  .PARISC.unwind 00000000              .PARISC.unwind
00010b74 l    d  .eh_frame_hdr  00000000              .eh_frame_hdr
00010b90 l    d  .eh_frame      00000000              .eh_frame
00011000 l    d  .ctors 00000000              .ctors
00011008 l    d  .dtors 00000000              .dtors
00011010 l    d  .jcr   00000000              .jcr
00011014 l    d  .dynamic       00000000              .dynamic
0001111c l    d  .data  00000000              .data
00011124 l    d  .plt   00000000              .plt
00011180 l    d  .got   00000000              .got
0001119c l    d  .bss   00000000              .bss
00000000 l    d  .comment       00000000              .comment
00000000 l    d  .note  00000000              .note
00010a7c l       .rodata        00000000              .Lpmain
00010a88 l       .rodata        00000000              .Lp__libc_csu_init
00010a84 l       .rodata        00000000              .Lp__libc_csu_fini
00011008 l     O .dtors 00000000              __DTOR_LIST__
00011010 l     O .jcr   00000000              __JCR_LIST__
000106a4 l     F .text  00000094              __do_global_dtors_aux
0001119c l     O .bss   00000001              completed.5781
000111a0 l     O .bss   00000004              dtor_idx.5783
0001074c l     F .text  0000003c              frame_dummy
00011004 l     O .ctors 00000000              __CTOR_END__
000109c4 l     F .text  00000078              __do_global_ctors_aux
ffffffec l       *ABS*  00000000              r31_slot
fffffff0 l       *ABS*  00000000              sr0_slot
ffffffec l       *ABS*  00000000              mrp_slot
000111a4 l     O .bss   00000004              fixup.1205
000111a8 l     O .bss   00000008              fixup_plabel.1204
00011120 l     O .data  00000000              __dso_handle
0001100c l     O .dtors 00000000              __DTOR_END__
00010800 l     F .text  00000114             
__canonicalize_funcptr_for_compare
00011000 l       .ctors 00000000              __init_array_end
000107e8 l       .text  00000018              $$dyncall
00011000 l       .ctors 00000000              __init_array_start
00011014 l     O .dynamic       00000000              _DYNAMIC
0001111c  w      .data  00000000              data_start
000109c0 g     F .text  00000004              __libc_csu_fini
00010650 g     F .text  00000050              _start
00000000       F *UND*  00000000              _ZN6classCC1Ev
00010a50  w    F .text  00000004              __gmon_start__
00000000  w      *UND*  00000000              _Jv_RegisterClasses
00010a54 g     F .fini  00000000              _fini
00011180 g     O *ABS*  00000000              _GLOBAL_OFFSET_TABLE_
00010a8c g     O .rodata        00000004              _IO_stdin_used
0001111c g       .data  00000000              __data_start
0001111c g     O .data  00000000              $global$
00010914 g     F .text  000000ac              __libc_csu_init
0001119c g       *ABS*  00000000              __bss_start
00000000       F *UND*  00000000              __libc_start_main@@GLIBC_2.2
00000000       F *UND*  00000000              _ZN6classBC1Ev
000111b0 g       *ABS*  00000000              _end
0001119c g       *ABS*  00000000              _edata
0001079c g     F .text  0000004c              main
000105e8 g     F .init  00000000              _init
buildbot at voyager
~/repos/build/cmake/Tests/CMakeCommands/target_link_libraries/fail19 $ 
cat CMakeFiles/exec.dir/link.txt
/usr/bin/g++-4.5.3      -Wl,--unique=.text.*
CMakeFiles/exec.dir/main.cpp.o  -o exec -rdynamic
/home/buildbot/repos/build/cmake/Tests/CMakeCommands/target_link_libraries/libs_build_True_False/liblibC.so
-Wl,-rpath,/home/buildbot/repos/build/cmake/Tests/CMakeCommands/target_link_libraries/libs_build_True_False
-Wl,-rpath-link,/home/buildbot/repos/build/cmake/Tests/CMakeCommands/target_link_libraries/libs_build_True_False

What else do you need?

Eike



More information about the cmake-developers mailing list