Menu

static executable still requires dynamic libs

Help
H.Puhr
2011-11-24
2013-05-13
  • H.Puhr

    H.Puhr - 2011-11-24

    hi,
      first i want to thank you for sharing this software. i really appreciated it.

    i have several  quite complex programs that depend on various libraries (e.g. boost, qt) that i want to ship to a potential customer without giving away information about the used libraries (yes i know this is stupid, but at the moment there are good reasons).

    i found your software, but i am having problems.  for one application (a), statifier works quite well, the "statified" executable has no dynamic section and runs like a charm. "readelf -dynamic (a)" reports no dynamic section. so far so good.

    another application (b) that uses graphics card acceleration, the "statified" executable still has dependencies of dynamic libraries. "ldd (b)" reports no dynamic section, but "readelf -dynamic (b)" still reports 34 entries. as expected, when i run this application on another linux workstation the libraries are missing (verfied with gdb). it tried running it with some of the documented arguments (-set=LD_BIND_NOW=yes, -set=LD_PRELOAD=…) but i still get the same binary with the same problems.

    my platform:
    ubuntu 11.04 x86_64
    memory randomization disabled
    statifier-1.7.1

    do you have any suggestions what the problem might be? if you could point me in the right direction i would you could point me in the right direction. if you require additional information please let me know.

     
  • Valery Reznic

    Valery Reznic - 2011-11-24

    Hi. What your describe is sounds very strange. Granted, statifier unable to pack automatically any shared library loaded via dlopen (that's what LD_PRELOAD is for) so I can understand that if you miss some dlopene'd libraries the will be missing on the target machine. But readelf -d that you describe is very strange.

    Could you please post output of following:
    1. ldd your_original_program
    2. readelf -d your_original_program
    3. readelf -d statified_program
    4. Command you used to statify your executable.

    Hmmm.Posting it here will to some degree defeat your goal of hiding libraries.
    If you don't want it you can email me directly

    Valery.

     
  • H.Puhr

    H.Puhr - 2011-12-06

    Hi,
      thank you for your quick reply, and sorry it took me so long for noticing it. Somehow the monitor-this-thread-function forgot about me. Since i do not think our potential customers will be that inquisitive, i will simply post the information here and hope for the best :-)

    1. ldd your_original_program

    linux-vdso.so.1 =>  (0x00007fffda5ff000)
    libOgreMain-1.6.4.so => /usr/lib/libOgreMain-1.6.4.so (0x00007feb19de9000)
    libshp.so.1 => /usr/lib/libshp.so.1 (0x00007feb19bdf000)
    libboost_system.so.1.42.0 => /usr/lib/libboost_system.so.1.42.0 (0x00007feb199da000)
    libboost_date_time.so.1.42.0 => /usr/lib/libboost_date_time.so.1.42.0 (0x00007feb197c6000)
    libboost_regex.so.1.42.0 => /usr/lib/libboost_regex.so.1.42.0 (0x00007feb194b7000)
    libboost_thread.so.1.42.0 => /usr/lib/libboost_thread.so.1.42.0 (0x00007feb192a0000)
    libtinyxml.so.2.5.3 => /usr/lib/libtinyxml.so.2.5.3 (0x00007feb19089000)
    libdbstorage.so.1 => not found
    libQtGui.so.4 => /usr/lib/libQtGui.so.4 (0x00007feb183e7000)
    libQtCore.so.4 => /usr/lib/libQtCore.so.4 (0x00007feb17f57000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007feb17d39000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007feb17a32000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007feb177ad000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007feb17597000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007feb17202000)
    libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007feb16f69000)
    libzzip-0.so.13 => /usr/lib/libzzip-0.so.13 (0x00007feb16d62000)
    libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007feb16a27000)
    libXaw.so.7 => /usr/lib/libXaw.so.7 (0x00007feb167b7000)
    libXt.so.6 => /usr/lib/x86_64-linux-gnu/libXt.so.6 (0x00007feb16551000)
    libSM.so.6 => /usr/lib/x86_64-linux-gnu/libSM.so.6 (0x00007feb16348000)
    libICE.so.6 => /usr/lib/x86_64-linux-gnu/libICE.so.6 (0x00007feb1612d000)
    libfreeimage.so.3 => /usr/lib/libfreeimage.so.3 (0x00007feb15c5f000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007feb15a46000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007feb15842000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007feb1563a000)
    libicudata.so.44 => /usr/lib/libicudata.so.44 (0x00007feb145f9000)
    libicui18n.so.44 => /usr/lib/libicui18n.so.44 (0x00007feb1423b000)
    libicuuc.so.44 => /usr/lib/libicuuc.so.44 (0x00007feb13ef3000)
    libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007feb13cbc000)
    libaudio.so.2 => /usr/lib/libaudio.so.2 (0x00007feb13aa3000)
    libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007feb137b3000)
    libpng12.so.0 => /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007feb1358c000)
    libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007feb1333b000)
    libXi.so.6 => /usr/lib/x86_64-linux-gnu/libXi.so.6 (0x00007feb1312a000)
    libXrender.so.1 => /usr/lib/x86_64-linux-gnu/libXrender.so.1 (0x00007feb12f1f000)
    libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007feb12d0d000)
    libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007feb12b07000)
    /lib64/ld-linux-x86-64.so.2 (0x00007feb1a463000)
    libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007feb128eb000)
    libXmu.so.6 => /usr/lib/libXmu.so.6 (0x00007feb126d1000)
    libXpm.so.4 => /usr/lib/libXpm.so.4 (0x00007feb124c0000)
    libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007feb122bb000)
    libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007feb12090000)
    libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007feb11e8d000)
    libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007feb11c50000)
    libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007feb11a4a000)

    2. readelf -d your_original_program

        Dynamic section at offset 0xa7d70 contains 34 entries:
          Tag        Type                         Name/Value
         0x0000000000000001 (NEEDED)             Shared library:
         0x0000000000000001 (NEEDED)             Shared library:
         0x0000000000000001 (NEEDED)             Shared library:
         0x0000000000000001 (NEEDED)             Shared library:
         0x0000000000000001 (NEEDED)             Shared library:
         0x0000000000000001 (NEEDED)             Shared library:
         0x0000000000000001 (NEEDED)             Shared library:
         0x0000000000000001 (NEEDED)             Shared library:
         0x0000000000000001 (NEEDED)             Shared library:
         0x0000000000000001 (NEEDED)             Shared library:
         0x0000000000000001 (NEEDED)             Shared library:
         0x0000000000000001 (NEEDED)             Shared library:
         0x0000000000000001 (NEEDED)             Shared library:
         0x0000000000000001 (NEEDED)             Shared library:
         0x0000000000000001 (NEEDED)             Shared library:
         0x000000000000000c (INIT)               0x41b420
         0x000000000000000d (FINI)               0x4840f8
         0x000000006ffffef5 (GNU_HASH)           0x400298
         0x0000000000000005 (STRTAB)             0x408600
         0x0000000000000006 (SYMTAB)             0x401f70
         0x000000000000000a (STRSZ)              61240 (bytes)
         0x000000000000000b (SYMENT)             24 (bytes)
         0x0000000000000015 (DEBUG)              0x0
         0x0000000000000003 (PLTGOT)             0x6a7fe8
         0x0000000000000002 (PLTRELSZ)           12072 (bytes)
         0x0000000000000014 (PLTREL)             RELA
         0x0000000000000017 (JMPREL)             0x4184f8
         0x0000000000000007 (RELA)               0x417ec8
         0x0000000000000008 (RELASZ)             1584 (bytes)
         0x0000000000000009 (RELAENT)            24 (bytes)
         0x000000006ffffffe (VERNEED)            0x417dc8
         0x000000006fffffff (VERNEEDNUM)         5
         0x000000006ffffff0 (VERSYM)             0x417538
         0x0000000000000000 (NULL)               0x0

    3. readelf -d statified_program

        Dynamic section at offset 0xdad70 contains 34 entries:
          Tag        Type                         Name/Value
         0x0000000000000001 (NEEDED)             Shared library:
         0x0000000000000001 (NEEDED)             Shared library:
         0x0000000000000001 (NEEDED)             Shared library:
         0x0000000000000001 (NEEDED)             Shared library:
         0x0000000000000001 (NEEDED)             Shared library:
         0x0000000000000001 (NEEDED)             Shared library:
         0x0000000000000001 (NEEDED)             Shared library:
         0x0000000000000001 (NEEDED)             Shared library:
         0x0000000000000001 (NEEDED)             Shared library:
         0x0000000000000001 (NEEDED)             Shared library:
         0x0000000000000001 (NEEDED)             Shared library:
         0x0000000000000001 (NEEDED)             Shared library:
         0x0000000000000001 (NEEDED)             Shared library:
         0x0000000000000001 (NEEDED)             Shared library:
         0x0000000000000001 (NEEDED)             Shared library:
         0x000000000000000c (INIT)               0x41b420
         0x000000000000000d (FINI)               0x4840f8
         0x000000006ffffef5 (GNU_HASH)           0x400298
         0x0000000000000005 (STRTAB)             0x408600
         0x0000000000000006 (SYMTAB)             0x401f70
         0x000000000000000a (STRSZ)              61240 (bytes)
         0x000000000000000b (SYMENT)             24 (bytes)
         0x0000000000000015 (DEBUG)              0x7fbaeb9812c0
         0x0000000000000003 (PLTGOT)             0x6a7fe8
         0x0000000000000002 (PLTRELSZ)           12072 (bytes)
         0x0000000000000014 (PLTREL)             RELA
         0x0000000000000017 (JMPREL)             0x4184f8
         0x0000000000000007 (RELA)               0x417ec8
         0x0000000000000008 (RELASZ)             1584 (bytes)
         0x0000000000000009 (RELAENT)            24 (bytes)
         0x000000006ffffffe (VERNEED)            0x417dc8
         0x000000006fffffff (VERNEEDNUM)         5
         0x000000006ffffff0 (VERSYM)             0x417538
         0x0000000000000000 (NULL)               0x0

    4. Command you used to statify your executable.

        statifier ./appname ./appname-stat

    5. lld of stat_executable

        not a dynamic executable

    As i said, i disabled the memory randomization function using 'sudo bash -c "echo 0 > /proc/sys/kernel/randomize_va_space"', and used different combinations of '-set=LD_PRELOAD=/usr/lib/somelib.so', but the resulting statified program always seems to have the same dependencies.

    Thank you for your time and effort!

     
  • Valery Reznic

    Valery Reznic - 2011-12-07

    readelf -d looks quite usual.

    Could you please post EXACT command you use to statify your executable (including what you specify in LD_PRELOAD)
    and output of 'strace -f your_application.statified'

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.