0

I'm trying to build a smbclient binary from the latest source using static linking so it can be portable. I'm doing this on a RHEL 7 machine with all the configure dependencies installed already.

I tried the following but ldd still says the binary has dynamic dependencies.

# wget https://www.samba.org/samba/ftp/samba-latest.tar.gz
# tar -zxvf samba-latest.tar.gz
# cd samba-4.5.1/
# ./configure
# make SHARED=0 CC='gcc -static'
# ldd /root/samba-4.5.1/bin/default/source4/client/smbclient4
    linux-vdso.so.1 =>  (0x00007fff3ebb1000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fb7bf35d000)
    libcmdline-credentials-samba4.so => /root/samba-4.5.1/bin/shared/private/libcmdline-credentials-samba4.so (0x00007fb7bf159000)
    libsmbclient-raw-samba4.so => /root/samba-4.5.1/bin/shared/private/libsmbclient-raw-samba4.so (0x00007fb7bef0e000)
    libtalloc.so.2 => /root/samba-4.5.1/bin/shared/private/libtalloc.so.2 (0x00007fb7bed04000)
    libsamba-credentials.so.0 => /root/samba-4.5.1/bin/shared/libsamba-credentials.so.0 (0x00007fb7beaef000)
    libsamba-errors.so.1 => /root/samba-4.5.1/bin/shared/libsamba-errors.so.1 (0x00007fb7be7a0000)
    libsamba-hostconfig.so.0 => /root/samba-4.5.1/bin/shared/libsamba-hostconfig.so.0 (0x00007fb7be56f000)
    libsamba-security-samba4.so => /root/samba-4.5.1/bin/shared/private/libsamba-security-samba4.so (0x00007fb7be34b000)
    ...

I'm not sure if this is because Samba now uses WAF for builds or not. So I'm looking for help on this.

A_B
  • 1,009
  • 3
  • 15
  • 37
  • It isn't `make` exactly, and `CC` isn't really required to be handled. Waf sets compiler on configure phase, try `make distclean && CC='gcc -static' ./configure` (not sure it will pass configure phase though, as some tests may fail due to that flag). – keltar Nov 23 '16 at 05:15
  • You will need to change the wscript - there will be a section describing the linking and that needs to be changed to use static linking – mmmmmm Apr 02 '17 at 21:19

0 Answers0