On 08/03/2010 05:43 PM, Charlie Zender wrote: > I am having trouble producing a statically linked version of an executable. > Adding the '-static' switch to the linker command produces thousands of > unresolved symbols. > They are all traceable to libcurl.a. This is a Ubuntu 10.4 system. > Example commands/output are below. > > When I create the dynamically linked executable, I manually specify > about 10 libraries. > Yet ldd tells me that the dynamically linked executable links to 32 > libraries (!). > Presumably the dynamical linker finds the symbols in the dynamically > linked executable. > The system only complains about unresolved symbols when I try static > linking. > > How do I figure out how to modify the dynamic link command (in addition > to adding '-static') > to create a statically linked executable? happy:gcc $ locate libcurl.so /usr/lib64/libcurl.so /usr/lib64/libcurl.so.4 /usr/lib64/libcurl.so.4.1.1 happy:gcc $ ldd /usr/lib64/libcurl.so linux-vdso.so.1 => (0x00007fffe89ff000) libidn.so.11 => /lib64/libidn.so.11 (0x0000003560200000) libldap-2.4.so.2 => /usr/lib64/libldap-2.4.so.2 (0x0000003565e00000) librt.so.1 => /lib64/librt.so.1 (0x000000354e000000) libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x0000003556000000) libkrb5.so.3 => /lib64/libkrb5.so.3 (0x0000003556c00000) libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x0000003556400000) libcom_err.so.2 => /lib64/libcom_err.so.2 (0x0000003555c00000) libz.so.1 => /lib64/libz.so.1 (0x000000354dc00000) libssl3.so => /usr/lib64/libssl3.so (0x0000003565a00000) libsmime3.so => /usr/lib64/libsmime3.so (0x0000003564e00000) libnss3.so => /usr/lib64/libnss3.so (0x0000003563a00000) libnssutil3.so => /usr/lib64/libnssutil3.so (0x0000003564200000) libplds4.so => /lib64/libplds4.so (0x0000003563600000) libplc4.so => /lib64/libplc4.so (0x0000003562e00000) libnspr4.so => /lib64/libnspr4.so (0x0000003560600000) libpthread.so.0 => /lib64/libpthread.so.0 (0x000000354d800000) libdl.so.2 => /lib64/libdl.so.2 (0x000000354d400000) libssh2.so.1 => /usr/lib64/libssh2.so.1 (0x0000003567400000) libc.so.6 => /lib64/libc.so.6 (0x000000354d000000) liblber-2.4.so.2 => /usr/lib64/liblber-2.4.so.2 (0x0000003564a00000) libresolv.so.2 => /lib64/libresolv.so.2 (0x000000354fc00000) libsasl2.so.2 => /usr/lib64/libsasl2.so.2 (0x000000355fe00000) libssl.so.10 => /usr/lib64/libssl.so.10 (0x0000003557400000) libcrypto.so.10 => /usr/lib64/libcrypto.so.10 (0x0000003555800000) /lib64/ld-linux-x86-64.so.2 (0x000000354c800000) libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x0000003557000000) libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x0000003556800000) libcrypt.so.1 => /lib64/libcrypt.so.1 (0x000000355e600000) libselinux.so.1 => /lib64/libselinux.so.1 (0x000000354f400000) libfreebl3.so => /lib64/libfreebl3.so (0x000000355ea00000) These are the static libraries you'll need. Andrew.