non-system gcc + libtool + -L/usr/lib complex problem

Dmitry Marakasov amdmi3 at
Fri Jul 4 21:13:03 UTC 2008


I'm investigating complex build problem of my graphics/gnash port.
The problem is that graphics/gnash doesn't build on FreeBSD 6.3 if 
ftp/curl (which it depends on) is built with LIBSSH2 support :)

The cause is as follows:

# cat /usr/local/lib/ | grep depende
dependency_libs=' -L/usr/lib -lcrypto -lz'

as you can see, there's -L/usr/lib in there. 

2) This causes -L/usr/lib to be added to as well

3) graphics/gnash has USE_GCC=4.2+. That's why gcc42 is used on 6.3
instead of default 3.4.

But! libtool adds -L/usr/lib from to linkflags, so gcc42
tries to use from /usr/lib instead of

This leads to many libstdc++ - related linkage errors:

/bin/sh ../libtool --tag=CXX   --mode=link g++42  -O2 -fno-strict-aliasing -pipe -march=nocona -pthread -D_THREAD_SAFE -pthread     -W     -Wall     -Wcast-align     -Wcast-qual     -Wpointer-arith     -Wreturn-type      -fvisibility-inlines-hidden -export-dynamic  -lltdl  -L/usr/local/lib -lxml2 -lz -L/usr/local/lib -liconv -lm -L/usr/local/lib -lcurl -L/usr/local/lib -lboost_thread -lboost_date_time -lpthread /usr/local/lib/ /usr/local/lib/ -Wl,-rpath -Wl,/usr/local/lib  -L/usr/local/lib -Wl,--as-needed -o gprocessor gprocessor-processor.o ../server/ ../libamf/ ../libnet/ ../libbase/ ../libmedia/  -lavcodec -lz -la52 -lfaad -lx264 -ltheora -lvorbisenc -lavutil -lvorbis -lm -logg   -lvorbisenc -lvorbis -lm -logg   -lavformat -lavcodec -lz -la52 -lfaad -lx264 -ltheora -lvorbisenc -lavutil -lvorbis -lm -logg   -lavutil   -ltheora -logg   -lavcodec -lz -la52 -lfaad -lx264 -ltheora -lvorbisenc -lavutil -lvorbis -lm -logg    -L/usr/local/lib -lglib-2.0 -liconv     -lX11 -lXi -lm 
g++42 -O2 -fno-strict-aliasing -pipe -march=nocona -pthread -D_THREAD_SAFE -pthread -W -Wall -Wcast-align -Wcast-qual -Wpointer-arith -Wreturn-type -fvisibility-inlines-hidden /usr/local/lib/ /usr/local/lib/ -Wl,-rpath -Wl,/usr/local/lib -Wl,--as-needed -o .libs/gprocessor gprocessor-processor.o -Wl,--export-dynamic  -L/usr/local/lib -L/usr/lib ../server/.libs/ /usr/work/usr/ports/graphics/gnash/work/gnash-0.8.3/libnet/.libs/ /usr/work/usr/ports/graphics/gnash/work/gnash-0.8.3/libmedia/.libs/ /usr/local/lib/ /usr/local/lib/ /usr/local/lib/ ../libamf/.libs/ ../libnet/.libs/ /usr/work/usr/ports/graphics/gnash/work/gnash-0.8.3/libamf/.libs/ /usr/work/usr/ports/graphics/gnash/work/gnash-0.8.3/libbase/.libs/ /usr/local/lib/ ../libbase/.libs/ ../libmedia/.libs/ /usr/local/lib/ /usr/local/lib/ /usr/local/lib/ -lssl -lcrypto /usr/local/lib/ -lboost_thread -lboost_date_time -lpthread /usr/local/lib/ /usr/local/lib/ /usr/local/lib/ /usr/local/lib/ -lncurses -lusbhid -lavformat -lavcodec -lz /usr/local/lib/ -ldjbfft /usr/local/lib/ -pthread -lx264 /usr/local/lib/ /usr/local/lib/ -lavutil /usr/local/lib/ /usr/local/lib/ /usr/local/lib/ /usr/local/lib/ /usr/local/lib/ /usr/local/lib/ /usr/local/lib/ /usr/local/lib/ /usr/local/lib/ /usr/local/lib/ -lrpcsvc /usr/local/lib/ -lm  -Wl,--rpath -Wl,/usr/local/lib/gnash -Wl,--rpath -Wl,/usr/local/lib
gprocessor-processor.o(.gnu.linkonce.t._ZN5boost2io6detail3putIcSt11char_traitsIcESaIcERKSsEEvT2_RKNS1_11format_itemIT_T0_T1_EERNS_12basic_formatISA_SB_SC_E11string_typeERNSH_20internal_streambuf_tEPSt6locale+0x1d8): In function `void boost::io::detail::put<char, std::char_traits<char>, std::allocator<char>, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, boost::io::detail::format_item<char, std::char_traits<char>, std::allocator<char> > const&, boost::basic_format<char, std::char_traits<char>, std::allocator<char> >::string_type&, boost::basic_format<char, std::char_traits<char>, std::allocator<char> >::internal_streambuf_t&, std::locale*)':
* more similar errors *

I'm not even sure which is the culprit:

- libssh2 (for using -L/usr/lib in .la)
First of all, does it actually need it (for example, to explicitly
not link to libcrypto from ports' openssl)? If it does, it's most
likely gcc42 problem. If it does not, it should be fixed as well
as other ports with the same problem (here I see /usr/lib used at
least in neon and wireshark)

- libtool (for adding -L/usr/lib for libssh2)

- gcc42 for not searching libs in /usr/local/lib/gcc-4.2.4 before
  all other libdirs.

Any ideas?

PS. Many thanks to Andriy Gapon <avg at> for nailing it.

Dmitry Marakasov   .   55B5 0596 FF1E 8D84 5F56  9510 D35A 80DD F9D2 F77D
amdmi3 at  ..:  jabber: amdmi3 at

More information about the freebsd-ports mailing list