Friday, December 15, 2006

vxl vgui compilation workaround (and others)

In this post and the comments section below are various issues encountered while compiling VXL under Linux, and how I solved them.

To solve the following errors, put a blank "opengl_xmesa_include" in cmake. I have NVIDIA drivers and everything works fine after this.

make[1]: *** [core/vgui/tests/CMakeFiles/vgui_test_events.dir/all] Error 2 Linking CXX executable vgui_test_front_back /home/rfabbri/cprg/vxlprg/vxl-bin/lib/libvgui.a(vgui_accelerate_x11.o): In function `vgui_accelerate_x11::vgui_copy_back_to_aux()': /home/rfabbri/cprg/vxlprg/vxl/core/vgui/internals/vgui_accelerate_x11.cxx:426: undefined reference to `XMesaGetCurrentBuffer' /home/rfabbri/cprg/vxlprg/vxl/core/vgui/internals/vgui_accelerate_x11.cxx:435: undefined reference to `XMesaGetBackBuffer' /home/rfabbri/cprg/vxlprg/vxl-bin/lib/libvgui.a(vgui_accelerate_x11.o): In function `vgui_accelerate_x11::vgui_copy_aux_to_back()': /home/rfabbri/cprg/vxlprg/vxl/core/vgui/internals/vgui_accelerate_x11.cxx:458: undefined reference to `XMesaGetCurrentBuffer' /home/rfabbri/cprg/vxlprg/vxl/core/vgui/internals/vgui_accelerate_x11.cxx:467: undefined reference to `XMesaGetBackBuffer'

11 comments:

Anonymous said...

Could you be more specific?

Exactly which file am I supposed to modify, and how?

And when do I do this ... before I generate the Makefile in ccmake, or between Makefile generation and vgui compile?

Ricardo Fabbri said...

Do it inside the CMake interface (ccmake). There is no need to manually edit any file. You might have to toggle advanced mode 't'.

Anonymous said...

Thanks, dude ... the compilation works now, at least.

I'll try running some of the VGUI examples (the VRML viewer, maybe?) and let you know if that works.

Ricardo Fabbri said...

Hi, so I think I solved your other Linux problems for compiling the LEMS vxl internal repository.

First, the trick with the opengl_xmesa_include is also necessary with lemsvxl - just leave it blank.

Second, about the expat issue: download and install expat from the web. I downloaded and installed 1.95.8 that comes with my distro.
Then you have to tell lemsvxl to use that copy instead of the internal "db3p" one. So, first you edit the file db3p/CMakeLists.txt and comment-out the line "SUBDIRS( expatpp )". Then run cmake again as usual and try to compile. Your system expat will now be used and you probably will have no problems.

These are bugs in the build process. Lemsvxl's CMAKE configuration should automatically detect a system-wide expat if available, but this is not currently being done. It should also not include mesa if opengl libraries were already found.

Let me know if it works.

Ricardo Fabbri said...

Expat in VXL as of March 3rd 2008

XML support was recently moved from our internal repository at Brown to the official VXL repository. However, the authors are still working on the details of how to get CMake to detect system features. While that is not fully done, here is a recipe to get the code to compile under Linux.

In order to get XML support in the newer vxl, I followed these steps.
First, update your CVS repository for the main VXL tree.
Run cmake, then make sure BUILD_EXPAT is on. Configure once again.

Now exit cmake, and download expat 2.0.0 from sourceforge:
Expat 2.0.0

Next, unpack the expat and run
./configure

This will generate a file called "expat_config.h".

Copy that file to contrib/brl/b3p/expatpp within the vxl tree.

Now run cmake again in VXL,
and set the option EXPAT_LIBRARY_PATH to the full path to that .h file:
(....) contrib/brl/b3p/expatpp/expat_config.h

Now tell cmake to configure and generate, then build the code.
Things should work now.

In the future the generation of expat_config.h will be integrated into vxl, but for now you have to follow the above procedure.

Ricardo Fabbri said...

As of 10/7/2008, I had to set the flag VXL_FORCE_B3P_EXPAT to ON in vxl to get contrib/brl/b3p/expatpp to build.

Now, in the lemsvxlsrc, libdbdet_xio.so has an undefined reference to "expatpp::ResetParser()". weird.

Ricardo Fabbri said...

Ok. Solved the "Undefined ResetParser()" problem.

First, we had a spurious expatpp header in lemsvxlsrc/db3p which was getting in the way. Remove that directory altogether.

Second, the new expatpp generates some header files and places in the bin compilation directory, whereas the include files are looked up in the src directory. Therefore, copy these headers to the expatpp src directory.

Third, you have to go to seg/dbdet/
then change the CMakeLists.txt to have the second INCLUDE_DIRECTORIES like this:
INCLUDE_DIRECTORIES( ${VXL_BRL_INCLUDE_DIR}/b3p )

that'll do the trick.

Ricardo Fabbri said...

I checked in the changes to CMakeLists.txt now.

Gamze will also remove expatpp from the LEMS tree so there will be no conflicts anymore

All you have to do now is copy the generated files to the src dir, although, according to Gamze, there is a VXL_BRL_BINARY_INCLUDE flag or something like that, which will get the compiler to find the generated headers.

Ricardo Fabbri said...

I recently downloaded the new vxl from subversion. The above trick with leaving the opengl_xmesa_include blank is still needed.

I also had to install ffmpeg from subversion, otherwise vidl wouldn't compile in Linux.

rfabbri said...

On the latest developer snapshot, I had to set MPEG2_mpeg2_LIBRARY to blank instead of the system mpeg2, otherwise it would complain that MPEG2_vo_LIBRARY wasn't found.

rfabbri said...

In Ubuntu, if vgui is desired, here is what Brandon Mayer suggested

install:
- gnome-core-devel (may not be needed but I tried it anyways)
- libgtkglext1
- libglu1-mesa-dev
* libgl1-mesa-dev
* mesa-common-dev