See revision 1.11 of inkscape/inkscape/configure.ac: "When adding -lgc to LIBS, also add its dependencies -lpthread -ldl."
Replaces LIBS="$LIBS -lgc" with LIBS="$LIBS -lgc -lpthread -ldl"
This appears to be wrong. Some systems do not have -lpthread (such as gc built with --disable-threads) and -ldl (such as NetBSD).
For example (when building using pkgsrc under NetBSD):
configure:21460: checking for GC_malloc in -lgc configure:21490: c++ -o conftest -O2 -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/freetype2 -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/freetyp e2 -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib -L/usr/X11R6/lib -Wl,-R/usr/X11R6/lib conftest.cc -lgc -lpthread -ldl -lintl >&5 ld: cannot find -ldl configure:21496: $? = 1
Anyways, -ldl is added to LIBS if needed in the configure script. Maybe re-order as necessary.
I am not sure about checking for -lpthread though.
Jeremy C. Reed
open source, Unix, *BSD, Linux training http://www.pugetsoundtechnology.com/
On Wed, 19 Jan 2005 11:36:54 -0800, Jeremy C. Reed wrote:
See revision 1.11 of inkscape/inkscape/configure.ac: "When adding -lgc to LIBS, also add its dependencies -lpthread -ldl."
It sounds like libgc is built in a broken way, or this was for compatibility with ancient toolchains. Does anybody know why this change was made?
I'm interested because this kind of dependency tree fudging causes problems later (like this one).
I don't think that a change was made to specifically add libdl. Some machines require including that item on the link line, others don't. I think that autoconf decides whether to do it or not.
Bob
Mike Hearn wrote:
On Wed, 19 Jan 2005 11:36:54 -0800, Jeremy C. Reed wrote:
See revision 1.11 of inkscape/inkscape/configure.ac: "When adding -lgc to LIBS, also add its dependencies -lpthread -ldl."
It sounds like libgc is built in a broken way, or this was for compatibility with ancient toolchains. Does anybody know why this change was made?
I'm interested because this kind of dependency tree fudging causes problems later (like this one).
On Wed, Jan 19, 2005 at 03:07:33PM -0600, Bob Jamison wrote:
I don't think that a change was made to specifically add libdl. Some machines require including that item on the link line, others don't. I think that autoconf decides whether to do it or not.
Seems like it was explicitly added. I've removed it and changed it around a little. It doesn't break for me, so I guess I'll keep my ears open and see if this blows anyone up.
On Wed, 19 Jan 2005, Kees Cook wrote:
Seems like it was explicitly added. I've removed it and changed it around a little. It doesn't break for me, so I guess I'll keep my ears open and see if this blows anyone up.
Did you remove the -lpthread also?
I don't see in the sourceforge cvs web yet at http://cvs.sourceforge.net/viewcvs.py/inkscape/inkscape/configure.ac
I maintain the Pkgsrc (NetBSD) package for inkscape.
--- configure.orig 2004-11-28 23:21:53.000000000 -0800 +++ configure @@ -21463,7 +21463,7 @@ if test "${ac_cv_lib_gc_GC_malloc+set}" echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lgc -lpthread -ldl $LIBS" +LIBS="-lgc $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF
(I only provide patch for configure instead of configure.ac because we don't want to rebuild configure in pkgsrc for this small issue.)
Jeremy C. Reed open source, Unix, *BSD, Linux training http://www.pugetsoundtechnology.com/
p.s. pkgsrc is a portable package building system for Linux, NetBSD, Darwin, Mac OS X, Irix, SunOS/Solaris, AIX, HPUX, BSD/OS, FreeBSD, Interix, and other operating systems for managing over 5000 software suites. It provides: 1) a categorized collection of specifications that help automate fetching, checking checksums, patching, configuring, building, installing and packaging software suites; 2) package installation and maintenance tools (like pkg_add, pkg_info, pkg_delete and others). Visit http://www.pkgsrc.org/ for information.
On Wed, Jan 19, 2005 at 01:34:53PM -0800, Jeremy C. Reed wrote:
Did you remove the -lpthread also?
Yup, it looks like this now:
gc_lib="" # used to have -lpthread and -ldl in it... doesn't need it now? AC_CHECK_LIB(gc, GC_malloc, [AC_CHECK_HEADERS([gc.h gc/gc.h], [gc_ok=yes; break], [gc_ok=no])], [gc_ok=no], [$gc_lib]) if test "x$gc_ok" != "xyes"; then AC_MSG_ERROR([libgc (the Boehm Conservative Collector), is needed to compile inkscape]) fi LIBS="-lgc $gc_libs $LIBS"
I don't see in the sourceforge cvs web yet at http://cvs.sourceforge.net/viewcvs.py/inkscape/inkscape/configure.ac
That (depending on sourceforge) can be up to 24 hours behind. :(
However, this updates every 20 min, if anything changes:
Kees Cook wrote:
On Wed, Jan 19, 2005 at 01:34:53PM -0800, Jeremy C. Reed wrote:
Did you remove the -lpthread also?
Yup, it looks like this now:
gc_lib="" # used to have -lpthread and -ldl in it... doesn't need it now? AC_CHECK_LIB(gc, GC_malloc, [AC_CHECK_HEADERS([gc.h gc/gc.h], [gc_ok=yes; break], [gc_ok=no])], [gc_ok=no], [$gc_lib]) if test "x$gc_ok" != "xyes"; then AC_MSG_ERROR([libgc (the Boehm Conservative Collector), is needed to compile inkscape]) fi LIBS="-lgc $gc_libs $LIBS"
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' /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../libgc.a(malloc.o)(.text+0x356):/home/rjamison/xmingw/gc6.3/malloc.c:203: undefined reference to `pthread_mutex_trylock' /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../libgc.a(malloc.o)(.text+0x4a1): In function `GC_malloc_atomic': /home/rjamison/xmingw/gc6.3/malloc.c:259: undefined reference to `pthread_mutex_trylock' /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../libgc.a(malloc.o)(.text+0x565): In function `GC_malloc':
....about two more pages of this fascinating stuff...
I rebuilt my gc6.4 source with:
./configure --enable-static --disable-shared --disable-threads
...and now everything is happy again! ./configure now says this:
checking for GC_malloc in -lgc... yes checking gc.h usability... yes checking gc.h presence... yes checking for gc.h... yes
Bob
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
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
Bob Jamison wrote:
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.
Yes, I do the same thing for the same reasons :/ I think I will try and write a patch that adds --as-needed on systems that support that. This way it should work right for both dynamic and static libs.
thanks -mike
On Thu, Jan 20, 2005 at 04:34:13PM +0000, Mike Hearn wrote:
Yes, I do the same thing for the same reasons :/ I think I will try and write a patch that adds --as-needed on systems that support that. This way it should work right for both dynamic and static libs.
For inkscape, I'd like to solve it by correctly detecting the libs. I need to figure out how to defeat autoconf's caching, though.
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:
There's another issue here too, somehow the GC build system isn't putting a DT_NEEDED entry for libdl in the generated library:
mike@...646... lib $ cat a.c extern void *GC_malloc();
int main() { void *p = GC_malloc(); }
mike@...646... lib $ gcc -o a -L. -lgc a.c ./libgc.so: undefined reference to `dlopen' collect2: ld returned 1 exit status
mike@...646... lib $ objdump -x libgc.so|grep NEEDED NEEDED libpthread.so.0 NEEDED libgcc_s.so.1 NEEDED libc.so.6
I guess this is a GC bug, though quite how they managed to get this situation is beyond me ... libpng has the same problem :(
thanks -mike
On Thu, Jan 20, 2005 at 08:27:36AM -0600, Bob Jamison wrote:
Apparently it did need -lpthread on my FC3 box. I got a link error like
Can you try with the newest (just now) configure.ac changes (with a non-static libgc)? It's a massive hack, but I don't know the "right" way to deal with it.
On Wed, 2005-01-19 at 15:07 -0600, Bob Jamison wrote:
I don't think that a change was made to specifically add libdl. Some machines require including that item on the link line, others don't. I think that autoconf decides whether to do it or not.
So it should be an autoconf substituted variable? What about -lpthread?
Why is pthread needed? Inkscape is not threaded, so this seems strange. Does one of the plugins need it?
Bryce
On Wed, 19 Jan 2005, Jeremy C. Reed wrote:
See revision 1.11 of inkscape/inkscape/configure.ac: "When adding -lgc to LIBS, also add its dependencies -lpthread -ldl."
Replaces LIBS="$LIBS -lgc" with LIBS="$LIBS -lgc -lpthread -ldl"
This appears to be wrong. Some systems do not have -lpthread (such as gc built with --disable-threads) and -ldl (such as NetBSD).
For example (when building using pkgsrc under NetBSD):
configure:21460: checking for GC_malloc in -lgc configure:21490: c++ -o conftest -O2 -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/freetype2 -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/freetyp e2 -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib -L/usr/X11R6/lib -Wl,-R/usr/X11R6/lib conftest.cc -lgc -lpthread -ldl -lintl >&5 ld: cannot find -ldl configure:21496: $? = 1
Anyways, -ldl is added to LIBS if needed in the configure script. Maybe re-order as necessary.
I am not sure about checking for -lpthread though.
Jeremy C. Reed
open source, Unix, *BSD, Linux training http://www.pugetsoundtechnology.com/
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
participants (5)
-
Bob Jamison
-
Bryce Harrington
-
Jeremy C. Reed
-
Kees Cook
-
Mike Hearn