Ld64.so present in ldd, missing at runtime

I am compiling some code, and for various reasons I am doing it statically. On my Ubuntu 12.04 / gcc 4.6.3 computer, compilation is excellent and completely static:

> ldd mycode
    not a dynamic executable

So far so good. But I also need to run it on another machine - Scientific Linux 5, running gcc 4.5.3. For some reason, ldd here has several dynamic libraries:

> ldd mycode
    linux-vdso.so.1 =>  (0x00007fffd75fd000)
    libstdc++.so.6 => /usr/local/swift/gcc-4.5.3/lib64/libstdc++.so.6 (0x00002b4bafab2000)
    libm.so.6 => /lib64/libm.so.6 (0x000000398ca00000)
    libc.so.6 => /lib64/libc.so.6 (0x000000398c600000)
    /lib/ld64.so.1 => /lib64/ld-linux-x86-64.so.2 (0x000000398c200000)
    libgcc_s.so.1 => /usr/local/swift/gcc-4.5.3/lib64/libgcc_s.so.1 (0x00002b4bafdb8000)

Which in itself is wonderful. The code compiles and links OK, and, as you can see from ldd, all dependencies are allowed. However, when I try to execute it on an SL machine, it fails:

> ./mycode
  /lib/ld64.so.1: bad ELF interpreter: No such file or directory

, - /lib/ld64.so.1 => /lib64/ld-linux-x86-64.so.2 , ldd . , , root-, , ld-linux-x84..blah /lib/ld 64.so.1, , . , , , , , . , , , , cmake, , ldd /lib 64/ld-linux...blah direct, /lib/ld 64.so.

, ? , ldd , ? !

+4
1

, , . , cmake, . , CMakeLists.txt, :

    SET_TARGET_PROPERTIES (mytarget PROPERTIES LINK_SEARCH_START_STATIC 1)
    SET_TARGET_PROPERTIES (mytarget PROPERTIES LINK_SEARCH_END_STATIC 1)
+3

Source: https://habr.com/ru/post/1540198/


All Articles