Hello, I'm having troubles with making a static build of smbclient. I've searched the archives, and it seems like I'm getting close, but I'm not quite there yet. I've tried: ./configure --nonshared-binary=smbclient make bin/smbclient But then when I run `ldd bin/smbclient`, I see a lot of linked libraries still. And if I copy it to a fresh docker container (to try it in a completely different environment), it gives an error saying that it can't find a library. Some other flags I've tried: --builtin-libraries=ALL --bundled-libraries=ALL --nonshared-binary=client/smbclient Some more background if it helps: Samba version: 4.12.6 Python version: 3.8.5 OS: Arch Linux Thank you very much for your time! - David
On Thu, 2020-08-20 at 18:05 -0400, David Birks via samba wrote:> Hello, I'm having troubles with making a static build of smbclient. > I've > searched the archives, and it seems like I'm getting close, but I'm > not > quite there yet. I've tried: > > ./configure --nonshared-binary=smbclient > make bin/smbclient > > But then when I run `ldd bin/smbclient`, I see a lot of linked > libraries > still. And if I copy it to a fresh docker container (to try it in a > completely different environment), it gives an error saying that it > can't find a library.Yeah, we don't really do static builds. We just do 'less dyanmic' builds. I dug into this for our oss-fuzz build (Google's cloud fuzzer) and ended up with this to copy and use rpath to locate the system libraries we still link to. See: https://gitlab.com/samba-team/samba/-/blob/master/lib/fuzzing/oss-fuzz/build_samba.sh#L76 Andrew Bartlett -- Andrew Bartlett https://samba.org/~abartlet/ Authentication Developer, Samba Team https://samba.org Samba Developer, Catalyst IT https://catalyst.net.nz/services/samba
On 8/20/20 6:31 PM, Andrew Bartlett via samba wrote:> On Thu, 2020-08-20 at 18:05 -0400, David Birks via samba wrote: >> Hello, I'm having troubles with making a static build of smbclient. >> I've >> searched the archives, and it seems like I'm getting close, but I'm >> not >> quite there yet. I've tried: >> >> ./configure --nonshared-binary=smbclient >> make bin/smbclient >> >> But then when I run `ldd bin/smbclient`, I see a lot of linked >> libraries >> still. And if I copy it to a fresh docker container (to try it in a >> completely different environment), it gives an error saying that it >> can't find a library. > > Yeah, we don't really do static builds. We just do 'less dyanmic' > builds.Ah thank you, that makes more sense.> I dug into this for our oss-fuzz build (Google's cloud fuzzer) and > ended up with this to copy and use rpath to locate the system libraries > we still link to. > > See: > https://gitlab.com/samba-team/samba/-/blob/master/lib/fuzzing/oss-fuzz/build_samba.sh#L76Oh nice, that is very helpful, and makes gathering the rest of the libraries needed quite easy. Thank you! - David