views:

671

answers:

1

On my system, expat is located at

/usr/include/expat.h
/usr/include/expat_external.h
/usr/lib/libexpat.1.5.0.dylib
/usr/lib/libexpat.1.dylib
/usr/lib/libexpat.dylib
/usr/lib/libexpat.la

So I export the required variables for boost to build graphml

export EXPAT_INCLUDE=/usr/include
export EXPAT_LIBPATH=/usr/lib

then I run (where $DIR and $BOOST generate the paths I want the includes and libs to go)

./configure --includedir=$DIR/$BOOST --libdir=$DIR/$BOOST/lib \ 
            --with-libraries=test,graph

I get this error:

ld: library not found for -lexpat collect2: ld returned 1 exit status

which boost says is caused by the line:

g++ -dynamiclib -install_name "libboost_graph-mt-1_35.dylib" -L"/usr/lib" 
    -o "bin.v2/libs/graph/build/darwin/release/macosx-version-10.4/threading-multi/libboost_graph-mt-1_35.dylib" 
    "bin.v2/libs/graph/build/darwin/release/macosx-version-10.4/threading-multi/read_graphviz_spirit.o" 
    "bin.v2/libs/graph/build/darwin/release/macosx-version-10.4/threading-multi/graphml.o"   
    -lexpat   -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -Wl,-dead_strip -no_dead_strip_inits_and_terms

I don't get how it's not finding the expat library with -L"/usr/lib" and -lexpat as arguments? My understanding is that /usr/lib/libexpat.dylib is exactly referenced as -L"/usr/lib" and -lexpat.

The Jamfile for building graphml is here. If EXPAT_INCLUDE and EXPAT_LIBPATH aren't set then it warns you (lines 39-41 of jamfile)

warning: Graph library does not contain optional GraphML reader.
note: to enable GraphML support, set EXPAT_INCLUDE and
note: directories containing the Expat headers and libraries, respectively.

+1  A: 

Another update: I don't see an .so or a .a file in your list of where EXPAT is... doesn't that seem a bit strange? Normally it will create an alias for the library name

for example /usr/lib/libblah.so -> /usr/lib/libblaah.so.1.2

Is dynalib some Macintoshism (I don't use Macs much)

is .la the static version extension on this platform?

Update:

The quotes around the path seem troublesome... -L"/usr/lib"

Try changing this to -L/usr/lib and -L /usr/lib

Older stuff:

The directive for the linker to include paths during the link step is -L. You need to look for some linker flags to update to include -L path_to_expat. I don't think the linker pays any attention to LD_LIBRARY_PATH. I am not sure what documentation you have read to set EXPAT_INCLUDE or EXPAT_LIBPATH.

ojblass
Here is the Jamfile (the build file) that tells me to set EXPAT_INCLUDE and EXPAT_LIBPATH https://svn.boost.org/trac/boost/browser/trunk/libs/graph/build/Jamfile.v2?rev=49008
bias
The site has an expired ssl certificate :(. I am not allowed to read it with the draconian settings on the computer I am on. I think that if you cut and paste the final line and play with the -Wl (which I think are the linker options you may be able to get it to compile by hand.
ojblass
Why would they have me set shell variables rather than pass the paths in as arguments like you do for --libdir?
bias
There are some strange traditions in the open source community between projects that depend on each other. When building Perl modules that depended on libraries I spent days upon days figuring out how modules emitted, detected, and configured their library paths and linker options.
ojblass
Yeah, dylib is the mac dynamic library suffix. And, the jamfile is putting the -L path in quotes, so I don't know how to work around that besides running that gcc command by hand - like you mentioned,
bias
Can you verify that the sym links in usr lib are correct and that eventually the /usr/lib actually points to something? How about naming it .a and see maybe if has to be told to look for dynalib... I feel your pain. It makes me a bit angry that someone decided to start using dynalib as an ext...
ojblass
I installed expat separately (i.e. in /opt/local/lib) from the system installation (i.e. /usr/lib) and linked to it which resolved the problem.
bias