Problems linking against OSG on OS X Tiger (on a Power PC)

Severin Kacianka severin.lists at kacianka.at
Sun Dec 7 07:57:14 PST 2008


Hello,

I posted this question also on the osg-users mailing list, but it just 
occoured to me, that it may be more appropriate to post it here. Sorry 
for the cross posting :(

Message:

I hope I do not ask a too obvious question, but I am just trying to get 
familiar with OSG and in the process want to be able to compile it on 
Linux and OS X. On Linux I have no problems compiling a sample program 
like this:
g++ -I /usr/local/include/osg/ -losg -losgViewer -o foo test.cpp

On OS X I installed OS X via macports. First I tried to compile it 
directly form the sources, but ran into the bug described here:
http://trac.macports.org/ticket/17294

Compiling and installing via macports worked fine.
However if I try to compile a sample program I get the following error:

g++  -L/opt/local/lib/ -I/opt/local/include/  -losg -losgViewer -o foo 
test.cpp
/usr/bin/ld: warning can't open dynamic library: libOpenThreads.11.dylib 
referenced from: /opt/local/lib//libosg.dylib (checking for undefined 
symbols may be affected) (No such file or directory, errno = 2)
/usr/bin/ld: warning can't open dynamic library: libosgGA.48.dylib 
referenced from: /opt/local/lib//libosgViewer.dylib (checking for 
undefined symbols may be affected) (No such file or directory, errno = 2)
/usr/bin/ld: warning can't open dynamic library: libosgText.48.dylib 
referenced from: /opt/local/lib//libosgViewer.dylib (checking for 
undefined symbols may be affected) (No such file or directory, errno = 2)
/usr/bin/ld: warning can't open dynamic library: libosgDB.48.dylib 
referenced from: /opt/local/lib//libosgViewer.dylib (checking for 
undefined symbols may be affected) (No such file or directory, errno = 2)
/usr/bin/ld: warning can't open dynamic library: libosgUtil.48.dylib 
referenced from: /opt/local/lib//libosgViewer.dylib (checking for 
undefined symbols may be affected) (No such file or directory, errno = 2)
/usr/bin/ld: Undefined symbols:
*snip long list of symbols*
collect2: ld returned 1 exit status

So for some reason ld cannot find the references from the libraries 
among each other. The directory looks like this:

libOpenThreads.11.dylib -> libOpenThreads.2.3.0.dylib
libOpenThreads.2.3.0.dylib
libOpenThreads.dylib -> libOpenThreads.11.dylib


(other libs are linked in the same manner)

So the libs are there, but somehow not referenced correctly. Does anyone 
know what the problem may be, or any other way to use OSG on OS X?

Thank you for your time,
Severin Kacianka


More information about the macports-users mailing list