0

I have been trying to compile a code base (CloudyDay) on my Linux machine. After jumping through so many hoops to get it going, I am stuck at this error.

Error - undefined reference to `osg::GLBufferObject::Extensions::__glewBindBuffer(unsigned int, unsigned int) const'

As far as I know, I have included the headers and libraries as required and mentioned in the user guide.

Compiling against -

OSG 3.0.0, carve 2.0.0, osgHimmel, openGL - Linux Debian distro, GLEW - Linux Debian distro

CloudyDay's source code + user guide available at - https://www.cg.tuwien.ac.at/research/publications/2014/BEHAM-2014-RCR/

Makefile extract

LIBS =  -L'/home/local/install_dir/OSG/3.0.0/lib64' -lOpenThreads -losg -losgViewer -losgGA -losgDB -losgUtil -losgText -L'/home/local/install_dir/carve/2.0.0/lib' -lintersect -L'/usr/lib/x86_64-linux-gnu' -ltinyxml2 -L'/home/local/install_dir/osghimmel/osgHimmel/lib' -losgHimmel `pkg-config --libs glew` 

CXXFLAGS = -I'/home/local/CloudyDay/include/CloudyDay' -I'/home/local/CloudyDay' -I'/home/local/install_dir/OSG/3.0.0/include' -I'/usr/include' -I'/home/local/install_dir/carve/carve-2.0.0/include' -I'/home/local/install_dir/osghimmel/osgHimmel/include' `pkg-config --cflags glew`

pkg-config result for glew

$ pkg-config --cflags --libs glew

-I/usr/include/GL -I/usr/include/libdrm -lGLEW -lGLU -lGL 

Any pointers to resolve this would be appreciated.

PaperMoon
  • 105
  • 8

1 Answers1

0

Typical ordering of libraries problem. Put the pkg-config ... after the -losg... libraries (it's probably fine to put it as the "last" on that line).

In gnu (and other typical "Unix/Linux") tool chains, libraries are "used" in the order they appear, so will only satisfy unresolved symbols that have been discovered BEFORE the library that you are linking to at a given point. Since (from what I can tell) the OSG libraries use GLEW, the GLEW libraries have to come after OSG.

Mats Petersson
  • 126,704
  • 14
  • 140
  • 227
  • Thanks @MatsPetersson. That was my first go-to solution. But somehow that didn't solve the issue. – PaperMoon Jun 21 '17 at 06:33
  • Then update your question with what you are doing NOW, and explain what the problem is with that - because what your post contains looks like it is that problem - I can only go by what I see in the question itself. – Mats Petersson Jun 21 '17 at 06:38
  • Done, updated the Makefile entries in the post. It reflects the latest setup that I have at this stage. – PaperMoon Jun 21 '17 at 06:42
  • At this point, I'd use `nm lib | c++filt` to find which one of the libraries have the relevant `osg::...` symbol, and see if you can figure out the correct order from that. You MAY need to add the same library more than once in some cases. – Mats Petersson Jun 21 '17 at 06:56
  • Thanks for `nm` tip @MatsPetersson. I went on a digging spree through OSG and the CloudyDay. Will update once I resolve the issue. – PaperMoon Jun 23 '17 at 06:52