Subject: pkg/32753: [patch] graphics/graphviz-2.6nb2: Unresolved symbols on OS X
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <idart@performancedesign.no>
List: pkgsrc-bugs
Date: 02/05/2006 23:25:01
>Number: 32753
>Category: pkg
>Synopsis: [patch] graphics/graphviz-2.6nb2: Unresolved symbols on OS X
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Feb 05 23:25:00 +0000 2006
>Originator: Idar Tollefsen
>Release: N/A
>Organization:
Performance Design
>Environment:
Darwin fulcrum.performancedesign.no 8.4.0 Darwin Kernel Version 8.4.0: Tue Jan 3 18:22:10 PST 2006; root:xnu-792.6.56.obj~1/RELEASE_PPC Power Macintosh powerpc
>Description:
Building Graphviz 2.6nb2 on OS X ends in:
gcc -pipe -dynamiclib -o .libs/libexpr.1.0.0.dylib .libs/excc.o .libs/excontext.o .libs/exdata.o .libs/exerror.o .libs/exeval.o .libs/exexpr.o .libs/exlexname.o .libs/exopen.o .libs/exrewind.o .libs/extoken.o .libs/extype.o .libs/exzero.o .libs/exparse.o .libs/libexpr.lax/libast.a/chresc.o .libs/libexpr.lax/libast.a/chrtoi.o .libs/libexpr.lax/libast.a/error.o .libs/libexpr.lax/libast.a/fmtbuf.o .libs/libexpr.lax/libast.a/fmtesc.o .libs/libexpr.lax/libast.a/pathaccess.o .libs/libexpr.lax/libast.a/pathbin.o .libs/libexpr.lax/libast.a/pathcanon.o .libs/libexpr.lax/libast.a/pathcat.o .libs/libexpr.lax/libast.a/pathexists.o .libs/libexpr.lax/libast.a/pathfind.o .libs/libexpr.lax/libast.a/pathgetlink.o .libs/libexpr.lax/libast.a/pathpath.o .libs/libexpr.lax/libast.a/strcopy.o .libs/libexpr.lax/libast.a/strerror.o .libs/libexpr.lax/libast.a/stresc.o .libs/libexpr.lax/libast.a/strmatch.o .libs/libexpr.lax/libast.a/strton.o .libs/libexpr.lax/libsfio.a/sfclose.o .libs/libexpr.lax/l
ibsfio.a/sfclrlock.o .libs/libexpr.lax/libsfio.a/sfcvt.o .libs/libexpr.lax/libsfio.a/sfdisc.o .libs/libexpr.lax/libsfio.a/sfdlen.o .libs/libexpr.lax/libsfio.a/sfexcept.o .libs/libexpr.lax/libsfio.a/sfexit.o .libs/libexpr.lax/libsfio.a/sfextern.o .libs/libexpr.lax/libsfio.a/sffcvt.o .libs/libexpr.lax/libsfio.a/sffilbuf.o .libs/libexpr.lax/libsfio.a/sfflsbuf.o .libs/libexpr.lax/libsfio.a/sfgetd.o .libs/libexpr.lax/libsfio.a/sfgetl.o .libs/libexpr.lax/libsfio.a/sfgetm.o .libs/libexpr.lax/libsfio.a/sfgetr.o .libs/libexpr.lax/libsfio.a/sfgetu.o .libs/libexpr.lax/libsfio.a/sfllen.o .libs/libexpr.lax/libsfio.a/sfmode.o .libs/libexpr.lax/libsfio.a/sfmove.o .libs/libexpr.lax/libsfio.a/sfmutex.o .libs/libexpr.lax/libsfio.a/sfnew.o .libs/libexpr.lax/libsfio.a/sfnotify.o .libs/libexpr.lax/libsfio.a/sfnputc.o .libs/libexpr.lax/libsfio.a/sfopen.o .libs/libexpr.lax/libsfio.a/sfpkrd.o .libs/libexpr.lax/libsfio.a/sfpoll.o .libs/libexpr.lax/libsfio.a/sfpool.o .libs/libexpr.lax/libsfio.a/sfpop
en.o .libs/libexpr.lax/libsfio.a/sfprintf.o .libs/libexpr.lax/libsfio.a/sfprints.o .libs/libexpr.lax/libsfio.a/sfpurge.o .libs/libexpr.lax/libsfio.a/sfputd.o .libs/libexpr.lax/libsfio.a/sfputl.o .libs/libexpr.lax/libsfio.a/sfputm.o .libs/libexpr.lax/libsfio.a/sfputr.o .libs/libexpr.lax/libsfio.a/sfputu.o .libs/libexpr.lax/libsfio.a/sfraise.o .libs/libexpr.lax/libsfio.a/sfrd.o .libs/libexpr.lax/libsfio.a/sfread.o .libs/libexpr.lax/libsfio.a/sfreserve.o .libs/libexpr.lax/libsfio.a/sfresize.o .libs/libexpr.lax/libsfio.a/sfscanf.o .libs/libexpr.lax/libsfio.a/sfseek.o .libs/libexpr.lax/libsfio.a/sfset.o .libs/libexpr.lax/libsfio.a/sfsetbuf.o .libs/libexpr.lax/libsfio.a/sfsetfd.o .libs/libexpr.lax/libsfio.a/sfsize.o .libs/libexpr.lax/libsfio.a/sfsk.o .libs/libexpr.lax/libsfio.a/sfstack.o .libs/libexpr.lax/libsfio.a/sfstrtod.o .libs/libexpr.lax/libsfio.a/sfswap.o .libs/libexpr.lax/libsfio.a/sfsync.o .libs/libexpr.lax/libsfio.a/sftable.o .libs/libexpr.lax/libsfio.a/sftell.o .libs/li
bexpr.lax/libsfio.a/sftmp.o .libs/libexpr.lax/libsfio.a/sfungetc.o .libs/libexpr.lax/libsfio.a/sfvprintf.o .libs/libexpr.lax/libsfio.a/sfvscanf.o .libs/libexpr.lax/libsfio.a/sfwr.o .libs/libexpr.lax/libsfio.a/sfwrite.o .libs/libexpr.lax/libvmalloc.a/malloc.o .libs/libexpr.lax/libvmalloc.a/vmbest.o .libs/libexpr.lax/libvmalloc.a/vmclear.o .libs/libexpr.lax/libvmalloc.a/vmclose.o .libs/libexpr.lax/libvmalloc.a/vmdcheap.o .libs/libexpr.lax/libvmalloc.a/vmdebug.o .libs/libexpr.lax/libvmalloc.a/vmdisc.o .libs/libexpr.lax/libvmalloc.a/vmexit.o .libs/libexpr.lax/libvmalloc.a/vmlast.o .libs/libexpr.lax/libvmalloc.a/vmopen.o .libs/libexpr.lax/libvmalloc.a/vmpool.o .libs/libexpr.lax/libvmalloc.a/vmprivate.o .libs/libexpr.lax/libvmalloc.a/vmprofile.o .libs/libexpr.lax/libvmalloc.a/vmregion.o .libs/libexpr.lax/libvmalloc.a/vmsegment.o .libs/libexpr.lax/libvmalloc.a/vmset.o .libs/libexpr.lax/libvmalloc.a/vmstat.o .libs/libexpr.lax/libvmalloc.a/vmstrdup.o .libs/libexpr.lax/libvmalloc.a/v
mtrace.o .libs/libexpr.lax/libvmalloc.a/vmwalk.o -L/usr/pkg/pkgsrc/graphics/graphviz/work/.buildlink/lib -L/usr/pkg/pkgsrc/graphics/graphviz/work/.x11-buildlink/lib ../../lib/cdt/.libs/libcdt.dylib /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../..//libiconv.dylib -lc /usr/pkg/pkgsrc/graphics/graphviz/work/.buildlink/lib/libintl.dylib /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../..//libc.dylib /usr/lib/libiconv.dylib -mabi=altivec -maltivec -mtune=G4 -mcpu=7450 -Wl,-x -Wl,-dead_strip -install_name /usr/pkg/lib/graphviz/libexpr.1.dylib -Wl,-compatibility_version -Wl,2 -Wl,-current_version -Wl,2.0
ld: Undefined symbols:
_environ
/usr/bin/libtool: internal link edit command failed
>How-To-Repeat:
On OS X (at least on 10.3 or 10.4), go to graphics/graphviz and try
to build it.
>Fix:
It's possible to fix the _environ problem by using _NSGetEnvrion(), but
there are more undefined symbols later in the process, such as gmalloc.
The solution is to use -undefined dynamic_lookup. For an explanation of
what that does, take a look at these URL's and search for
dynamic_lookup:
http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/ld.1.html
http://developer.apple.com/documentation/DeveloperTools/Conceptual/MachOTopics/Articles/executing_files.html
The tip came from here:
http://developers.gramps-project.org/tiki-index.php?page=Mac+OS+X#id194233
Simply adding -undefined dyanmic_lookup to LDFLAGS won't work since it
invokes gcc as the linker. The -Xlinker approach has to be used. Please
note that -undefined dynamic_lookup only works on 10.3, 10.4 or later,
meaning that the following patch won't work for 10.2 or earlier.
Here's the patch against graphics/graphviz/Makefile:
--- Makefile.orig 2006-01-24 08:32:15.000000000 +0100
+++ Makefile 2006-02-05 22:13:54.000000000 +0100
@@ -30,6 +30,13 @@
BUILDLINK_TRANSFORM+= rm:-Wno-unused-parameter
.endif
+.if ${OPSYS} == "Darwin"
+# This is here to fix undefined symbol _environ in
+# lib/expr. This tip came from:
+# http://developers.gramps-project.org/tiki-index.php?page=Mac+OS+X#id194233
+LDFLAGS+= -Xlinker -undefined -Xlinker dynamic_lookup
+.endif
+
CONFIGURE_ENV+= TCLCONFIG=${TCLCONFIG_SH:Q}
CONFIGURE_ENV+= TKCONFIG=${TKCONFIG_SH:Q}
CONFIGURE_ENV+= X11PREFIX=${X11PREFIX:Q} X11BASE=${X11BASE:Q}