Open GoogleCodeExporter opened 9 years ago
I've done some more investigating, and if I force bjam to use my own 'custom'
g++ that looks like this:
#!/bin/sh
/usr/bin/g++ -fPIE -pie -static -static-libgcc -m32 "$@"
(notice I am compiling a 32-bit executable now, same 64-bit host though)
Then it will actually spit out a client_test executable, unfortunately it is
still not static. This is the tail end of the building log that possibly
explains why and then a run of 'file' which shows it is dynamically linked:
gcc.archive
/home2/workspace/boost_1_40_0/bin.v2/libs/system/build/gcc-4.4.3/debug/boost-sou
rce/link-static/runtime-link-static/threading-multi/libboost_system.a
gcc.link
bin/gcc-4.4.3/debug/boost-source/link-static/runtime-link-static/threading-multi
/client_test
../bin/gcc-4.4.3/debug/boost-source/link-static/runtime-link-static/threading-mu
lti/libtorrent.a(session_impl.o): In function
`boost::asio::detail::socket_ops::getaddrinfo(char const*, char const*,
addrinfo const*, addrinfo**, boost::system::error_code&)':
session_impl.cpp:(.text._ZN5boost4asio6detail10socket_ops11getaddrinfoEPKcS4_PK8
addrinfoPPS5_RNS_6system10error_codeE[boost::asio::detail::socket_ops::getaddrin
fo(char const*, char const*, addrinfo const*, addrinfo**,
boost::system::error_code&)]+0x3e): warning: Using 'getaddrinfo' in statically
linked applications requires at runtime the shared libraries from the glibc
version used for linking
...updated 111 targets...
$ file
bin/gcc-4.4.3/debug/boost-source/link-static/runtime-link-static/threading-multi
/client_test
bin/gcc-4.4.3/debug/boost-source/link-static/runtime-link-static/threading-multi
/client_test: ELF 32-bit LSB shared object, Intel 80386, version 1 (GNU/Linux),
dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped
So is there a way to get a statically compiled binary of libtorrent and/or
client_test?
Original comment by moparist...@gmail.com
on 24 Dec 2010 at 5:51
when you say "statically linked", you're not talking about linking statically
against boost or libtorrent, you're talking about the runtime library, right?
I would expect this to work: (in libtorrent/examples):
bjam boost=source link=static runtime-link=static boost-link=static encryption=openssl
to work. However, testing this it turns out that it will try to link statically
against libdl.so, which doesn't have a corresponding static library. libdl is
required by libcrypto. One simple work-around would be to use libtomcrypt or
libgcrypt instead of openssl. The drawback is that you wouldn't get ssl
support. But this should work:
bjam boost=source link=static runtime-link=static boost-link=static encryption=tommath
I'm not sure how to force boost-build to link dynamically against libdl,
regardless of the <link> property.
Original comment by arvid.no...@gmail.com
on 25 Dec 2010 at 7:24
Original issue reported on code.google.com by
moparist...@gmail.com
on 24 Dec 2010 at 5:16