monero-project / monero

Monero: the secure, private, untraceable cryptocurrency
https://getmonero.org
Other
9.03k stars 3.12k forks source link

static build produces dynamic-linked file(monero-wallet-cli) #9563

Open dtcomp opened 2 weeks ago

dtcomp commented 2 weeks ago

I wanted to build a static monero-wallet-cli. The compile finished, but apparently products are not static:

make -j6 release-static-linux-x86_64
cd build/Linux/_HEAD_detached_at_v0.18.3.4_/release/bin/
file monero-wallet-cli 
monero-wallet-cli: ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=0c9d04df7b181472cef6d098b03b97d745192356, for GNU/Linux 3.2.0, with debug_info, not stripped

Linux bookworm 6.1.0-27-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.115-1 (2024-11-01) x86_64 GNU/Linux

0xFFFC0000 commented 2 weeks ago

Can you run ldd on your binary and put the results here.

E.g.

image

dtcomp commented 2 weeks ago

ldd monero-wallet-cli linux-vdso.so.1 (0x00007ffc1435a000) libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007f9e6624f000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9e64b21000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9e64940000) /lib64/ld-linux-x86-64.so.2 (0x00007f9e66289000) Debian Bookworm

dtcomp commented 1 week ago

It looks like 2 libs prevent static link - libudev and libgssapi_krb5. It was simple to get a static libudev, but still working on libgssapi_krb5. update: mebbe not worth the bother: the above-mentioned libs define the same function (memdup) - so link-time errors...