← Back to team overview

pyexiv2-developers team mailing list archive

Re: Trouble building under macos/fink

 

Hi Dan,


Dan Christian a écrit :
I'm trying to get pyexiv2-0.3.2 to build on MacOS-10.6 under fink.
Boost is 1.46.  gcc is 4.4.

The attached file shows the changes that I made:
   Put /sw/include in the include path (to find boost)
   Link against boost_python-mt

To link against a different version of boost (such as boost_python-mt), no need to modify the build script, all you need to do is invoke it like this:

    scons BOOSTLIB=boost_python-mt

I then build like this:
CXX=g++-4 LDFLAGS="-L/sw/lib" python2.7 /sw/bin/scons -k
   Use the fink compiler (which is 32bit mode, same as the boost libraries)
   Put /sw/lib in the link path (to link against boost)
   Use the fink python

Here are the key bits of output:

scons: Building targets ...
g++-4 -o build/exiv2wrapper.o -c -I/sw/include -I/sw/include/python2.7
src/exiv2wrapper.cpp
g++-4 -o build/exiv2wrapper -L/sw/lib build/exiv2wrapper.o
-lboost_python-mt -lexiv2
Undefined symbols:
   "_PyExc_RuntimeError", referenced from:
       _PyExc_RuntimeError$non_lazy_ptr in exiv2wrapper.o
      (maybe you meant: _PyExc_RuntimeError$non_lazy_ptr)
Many more symbols like that...
   "_PyEval_SaveThread", referenced from:
       exiv2wrapper::Image::_instantiate_image()      in exiv2wrapper.o
       exiv2wrapper::Image::readMetadata()      in exiv2wrapper.o
       exiv2wrapper::Image::writeMetadata()      in exiv2wrapper.o
       exiv2wrapper::Image::getDataBuffer() const in exiv2wrapper.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
scons: *** [build/exiv2wrapper] Error 1

g++-4 -o build/exiv2wrapper.os -c -fPIC -I/sw/include
-I/sw/include/python2.7 src/exiv2wrapper.cpp
g++-4 -o build/exiv2wrapper_python.os -c -fPIC -I/sw/include
-I/sw/include/python2.7 src/exiv2wrapper_python.cpp
g++-4 -o build/libexiv2python.dylib -L/sw/lib -dynamiclib
build/exiv2wrapper.os build/exiv2wrapper_python.os -lboost_python-mt
-lexiv2
Undefined symbols:
   "_PyList_Type", referenced from:
       _PyList_Type$non_lazy_ptr in exiv2wrapper_python.os
      (maybe you meant: _PyList_Type$non_lazy_ptr)
Many more symbols like that...
   "_PyObject_Size", referenced from:
       boost::python::len(boost::python::api::object const&) in exiv2wrapper.os
ld: symbol(s) not found
collect2: ld returned 1 exit status
scons: *** [build/libexiv2python.dylib] Error 1

I new to building on Mac, so I don't know what to expect (especially
with loadable modules and C++).

I never actually built on Mac, so unfortunately I don’t think I can be of any real help. However I can see two different outputs above, apparently corresponding to two different build configurations. What were the commands invoked in both cases?

A couple things are different than the Linux build example on the web site:
   It's trying to build build/exiv2wrapper as an application (really?),

This is most likely because you added the following line to the SConscript file:

    +env.Program('exiv2wrapper.cpp')

but it isn't linking against python.
   The dynamic library isn't built with -shared (or is -dynamiclib the
same thing?).

According to `man g++`:

    -dynamiclib
           When passed this option, GCC will produce a dynamic library
           instead of an executable when linking, using the Darwin
           libtool command.

I hope this somehow helps.
Cheers,

 Olivier


Follow ups

References