On Tue, May 08, 2007 at 10:59:49AM +0200, Eric Faurot wrote:
> Hi,
>
> I am trying to build Ogre3D, but I'm stuck on a linking problem:
> libc symbols are not resolved. Apparently libtool is stripping the
> "-lc" when linking the shared library. Running the libtool-generated
> command line "by hand" with -lc works ok.
>
> Here is the relevant excerpt:
>
> ...
> Making all in src
> gmake[3]: Entering directory
> `/usr/ports/mystuff/graphics/ogre3d/w-ogre3d-1.4.1/ogrenew/PlugIns/BSPSceneManager/src'
> /usr/local/bin/libtool --tag=CXX --mode=link c++ -O2 -pipe -fPIC
> -L/usr/local/lib -o Plugin_BSPSceneManager.la -rpath
> /usr/local/lib/OGRE -module -shared -avoid-version
> -L../../../OgreMain/src -Wl,-z,defs OgreBspLevel.lo OgreBspNode.lo
> OgreBspResourceManager.lo OgreBspSceneManager.lo
> OgreBspSceneManagerDll.lo OgreBspSceneManagerPlugin.lo
> OgreBspSceneNode.lo OgreQuake3ShaderManager.lo OgreQuake3Shader.lo
> OgreQuake3Level.lo -lOgreMain -lc -lfreeimage -lpthread -lz -lm
> -lstdc++
> rm -fr .libs/Plugin_BSPSceneManager.so
> c++ -shared -fPIC -DPIC .libs/OgreBspLevel.o .libs/OgreBspNode.o
> .libs/OgreBspResourceManager.o .libs/OgreBspSceneManager.o
> .libs/OgreBspSceneManagerDll.o .libs/OgreBspSceneManagerPlugin.o
> .libs/OgreBspSceneNode.o .libs/OgreQuake3ShaderManager.o
> .libs/OgreQuake3Shader.o .libs/OgreQuake3Level.o
> -L/usr/ports/mystuff/graphics/ogre3d/w-ogre3d-1.4.1/ogrenew/OgreMain/src/.libs
> -lstdc++ -lm -lz -lpthread -lfreeimage -L/usr/local/lib -lzzip -lintl
> -liconv -lglib-2.0 -lgmodule-2.0 -lgobject-2.0 -lgdk_pixbuf-2.0
> -lpango-1.0 -lfreetype -lexpat -L/usr/X11R6/lib -lfontconfig -lglitz
> -lpng -lXau -lXdmcp -lX11 -lXrender -lcairo -lpangoft2-1.0
> -lpangocairo-1.0 -lXext -lXinerama -lXi -lXrandr -lXfixes -lXcursor
> -lgdk-x11-2.0 -latk-1.0 -lgtk-x11-2.0 -lXaw -lOgreMain -Wl,-z
> -Wl,defs -o .libs/Plugin_BSPSceneManager.so
> .libs/OgreBspLevel.o(.text+0x1c7a): In function
> `Ogre::BspLevel::loadQuake3Level(Ogre::Quake3Level const&)':
> : undefined reference to `__guard'
> .libs/OgreBspLevel.o(.text+0x20aa): In function
> `Ogre::BspLevel::loadQuake3Level(Ogre::Quake3Level const&)':
> : undefined reference to `memcpy'
> ...
>
> I have tried to change build_libtool_need_lc=yes in the CXX part of
> /usr/local/bin/libtool without success. I probably miss something
> very obvious. I'd appreciate if somebody more knowledgeable about C++
> and libtool could give me a hint.
easy answer: just remove -Wl,-z,defs from the link command. surely
whatever is using this module is linked against libc, right?
long asnwer: libtool does indeed remove -lc. from /usr/local/bin/libtool:
-l*)
if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
case $host in
...
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
# Do not include libc due to us having libc/libc_r.
test "X$arg" = "X-lc" && continue
;;
but maybe this is no longer necessary?
--
[EMAIL PROTECTED]
SDF Public Access UNIX System - http://sdf.lonestar.org