Compiling Panda3D with CUDA Development Drivers and Ubuntu

Hi,
I’m running 64-bit Ubuntu 10.04 LTS with the NVIDIA development drivers installed. I want to use a multithreaded version of Panda3D, so I’m compiling from source using the makepanda.py script. My compile command is:

./makepanda/makepanda.py --verbose --override "SIMPLE_THREADS=UNDEF" --installer --everything

The compilation fails while building mesadisplay_composite:

[ 46%] Building C++ object built/tmp/mesadisplay_composite.o
g++ -ftemplate-depth-30 -fPIC -c -o built/tmp/mesadisplay_composite.o -I/usr/include/python2.6 -Ibuilt/tmp -Ibuilt/include -DMAKEPANDA= -Ipanda/src/mesadisplay -Ipanda/src/glstuff -pthread -O2 -DBUILDING_PANDAMESA panda/src/mesadisplay/mesadisplay_composite.cxx
In file included from panda/src/mesadisplay/mesagsg.h:75,
                 from panda/src/mesadisplay/osMesaGraphicsPipe.h:21,
                 from panda/src/mesadisplay/osMesaGraphicsBuffer.h:20,
                 from panda/src/mesadisplay/config_mesadisplay.cxx:16,
                 from panda/src/mesadisplay/mesadisplay_composite1.cxx:1,
                 from panda/src/mesadisplay/mesadisplay_composite.cxx:1:
/usr/include/GL/osmesa.h:119: error: ‘GLAPI’ does not name a type
/usr/include/GL/osmesa.h:132: error: ‘GLAPI’ does not name a type
/usr/include/GL/osmesa.h:142: error: expected constructor, destructor, or type conversion before ‘void’
/usr/include/GL/osmesa.h:174: error: ‘GLAPI’ does not name a type
/usr/include/GL/osmesa.h:184: error: ‘GLAPI’ does not name a type
/usr/include/GL/osmesa.h:202: error: expected constructor, destructor, or type conversion before ‘void’
/usr/include/GL/osmesa.h:218: error: expected constructor, destructor, or type conversion before ‘void’
/usr/include/GL/osmesa.h:233: error: ‘GLAPI’ does not name a type
/usr/include/GL/osmesa.h:249: error: ‘GLAPI’ does not name a type
/usr/include/GL/osmesa.h:266: error: ‘GLAPI’ does not name a type
/usr/include/GL/osmesa.h:275: error: expected constructor, destructor, or type conversion before ‘void’
In file included from panda/src/mesadisplay/mesadisplay_composite1.cxx:2,
                 from panda/src/mesadisplay/mesadisplay_composite.cxx:1:
panda/src/mesadisplay/osMesaGraphicsBuffer.cxx: In member function ‘virtual bool OsMesaGraphicsBuffer::begin_frame(GraphicsOutput::FrameMode, Thread*)’:
panda/src/mesadisplay/osMesaGraphicsBuffer.cxx:69: error: ‘OSMesaMakeCurrent’ was not declared in this scope
In file included from panda/src/mesadisplay/mesadisplay_composite1.cxx:4,
                 from panda/src/mesadisplay/mesadisplay_composite.cxx:1:
panda/src/mesadisplay/osMesaGraphicsStateGuardian.cxx: In constructor ‘OSMesaGraphicsStateGuardian::OSMesaGraphicsStateGuardian(GraphicsEngine*, GraphicsPipe*, OSMesaGraphicsStateGuardian*)’:
panda/src/mesadisplay/osMesaGraphicsStateGuardian.cxx:35: error: ‘OSMesaCreateContext’ was not declared in this scope
panda/src/mesadisplay/osMesaGraphicsStateGuardian.cxx: In destructor ‘virtual OSMesaGraphicsStateGuardian::~OSMesaGraphicsStateGuardian()’:
panda/src/mesadisplay/osMesaGraphicsStateGuardian.cxx:49: error: ‘OSMesaDestroyContext’ was not declared in this scope
panda/src/mesadisplay/osMesaGraphicsStateGuardian.cxx: In member function ‘virtual void* OSMesaGraphicsStateGuardian::do_get_extension_func(const char*, const char*)’:
panda/src/mesadisplay/osMesaGraphicsStateGuardian.cxx:75: error: ‘OSMesaGetProcAddress’ was not declared in this scope
Process exited with exit status 1 and signal code 0

I have tried the compilation with the regular NVIDIA drivers installed, and it worked fine. I have also tried the .deb with the development drivers, it did not work.

Doing some investigating; GLAPI is normally defined in /usr/include/GL/gl.h which is included by /usr/include/GL/osmesa.h. The problem seems to relate to the fact that installing the CUDA drivers provides a new gl.h which undefines GLAPI at the end of the file. I have tried adding the “–no-osmesa” flag to the make command, but it made no difference.

Does anyone have any recommendations on where to go next? Has anyone successfully compiled Panda3D with CUDA drivers?

Thanks,
Jon

Sorry for the late reply, I forgot about this thread.

You should probably just compile without mesa support. You don’t need it, it’s a software renderer that nobody uses anymore (now that we have a tinydisplay renderer).

rdb,
No worries, better late than never.

I’ve tried compiling it without os-mesa

./makepanda/makepanda.py --verbose --override "SIMPLE_THREADS=UNDEF" --no-osmesa --installer --everything

but it still tries to compile mesadisplay_composite. That was the only directly mesa flag I can see for the installation script, but I also tried it with all the flags that seemed GL-related to my untrained eye.

./makepanda/makepanda.py --verbose --override "SIMPLE_THREADS=UNDEF" --no-osmesa --no-gl --no-gles --no-gles2 --no-egl --installer --everything

and it still didn’t work.

Would anyone know where I could find documentation on the various build flags? Or maybe recommend some other ones I should try using?

Thanks again,
Jon

You’re having --everything as last option, which overrides all of the --no options before that.

Having --everything --no-osmesa should make it compile.

Thanks rdb, that did the trick.

Actually it worked for a while, but when I tried it again to verify that I no longer needed some of the mesa-dev packages, it broke. I’ve put all the packages I took out back in and I still get:

ld: cannot find -lGL

[size=150]Edit[/size]:
I was able to fix this by manually relinking libGL.so. I guess removing the Mesa packages broke them. For anyone else who has this problem, make sure that:

ls -lah /usr/lib/libGL.so
ls -lah /usr/lib32/libGL.so
ls -lah /usr/lib64/libGL.so

all point to a valid library. On my machine, 2/3 pointed to ./libGL.so.1 and the 3rd pointed to mesa/libGL.so (which was no longer valid). I just replaced the broken link with a link to ./libGL.so.1 and it worked.