Yes, on those packages that use pkg-config, I wish that they would support static libs a bit better. I also with that libtool did the same a bit better for static, and not just assume dynamic libs. It could be easily specified in the .la files they make.
Gc is one of the libs that I try to statically link, along with the c++ libs, because of the tribulations we have had with it in the past.
Bob
Mike Hearn wrote:
On Thu, 20 Jan 2005 08:27:36 -0600, Bob Jamison wrote:
Apparently it did need -lpthread on my FC3 box. I got a link error like this:
configure:21620: checking for GC_malloc in -lgc configure:21650: g++ -o conftest -g -O2 conftest.cc -lgc >&5 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../libgc.a(malloc.o)(.text+0x2ef): In function `GC_generic_malloc': /home/rjamison/xmingw/gc6.3/malloc.c:191: undefined reference to `pthread_mutex_trylock'
Ah, you're static linking libgc. Unfortunately GNU static libraries don't include any information about what libraries they depend upon so you have to fill that out for them which is why "-ldl -lpthread" is needed. That's a very regrettable oversight as it means mixing implementation details of libgc into Inkscape.
It also causes problems later on ... eg the case of GTK+ 2 programs getting "accidental" dependencies on pangoft which disappeared at some point, breaking all these binaries.
I guess the right solution here is to use the --as-needed option available in modern GNU ld versions. I'm not sure how you'd integrate this into the build system but basically you can do this:
..... -Wl,--as-needed -lfoo -lbar -Wl,--no-as-needed
and then if you don't actually use libfoo or libbar anywhere they'll be silently dropped. I guess there'd need to be a configure check for this.
thanks -mike