Error compiling tetgen_plugin

Discussion about building and installing Elmer
Post Reply
smaddox
Posts: 2
Joined: 25 May 2010, 10:06

Error compiling tetgen_plugin

Post by smaddox »

I'm having trouble compiling the tetgen_plugin from svn version 4481. From the last call onward:

Code: Select all

g++ -Wl,-O1 -o plugin ElmerAPI.o predicates.o tetgen.o    -L/usr/lib -lQtGui -lQtCore -lpthread
ElmerAPI.o: In function `delegate_tetrahedralize':
ElmerAPI.cpp:(.text+0xcf): undefined reference to `tetrahedralize(char*, tetgenio*, tetgenio*, tetgenio*, tetgenio*)'
collect2: ld returned 1 exit status
make[1]: *** [plugin] Error 1
make[1]: Leaving directory `/home/smaddox/Downloads/elmerfem/elmerfem/trunk/misc/tetgen_plugin/plugin'
make: *** [sub-plugin-make_default] Error 2
It looks like there are some #ifdef and #ifndef's of TETLIBRARY trying to set it up for cli or library. If I force #define TETLIBRARY in tetgen.h, I get the following error:

Code: Select all

g++ -Wl,-O1 -o plugin ElmerAPI.o predicates.o tetgen.o    -L/usr/lib -lQtGui -lQtCore -lpthread
/usr/lib/gcc/i486-linux-gnu/4.4.1/../../../../lib/crt1.o: In function `_start':
/build/buildd/eglibc-2.10.1/csu/../sysdeps/i386/elf/start.S:115: undefined reference to `main'
collect2: ld returned 1 exit status
make[1]: *** [plugin] Error 1
make[1]: Leaving directory `/home/smaddox/Downloads/elmerfem/elmerfem/trunk/misc/tetgen_plugin/plugin'
make: *** [sub-plugin-make_default] Error 2
My guess is that someone messed with the preprocessors and didn't test it before submitting. It looks like either TETLIBRARY defined, or not defined there is a problem. Can anyone help me out?
smaddox
Posts: 2
Joined: 25 May 2010, 10:06

Re: Error compiling tetgen_plugin

Post by smaddox »

I figured it out. Here was the solution (after installing the necessary dependencies , e.g. qt-sdk):

Set up environment variables by adding these to your .bashrc and restarting your bash session. Note, these are for the default Ubuntu install, so some changes will be necessary depending on your distro:

Code: Select all

export LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH
export ELMER_HOME=/usr
export ELMERGUI_HOME=/usr/share/ElmerGUI
export ELMER_POST_HOME=/usr/share/elmerpost
Check out svn version 4440:

Code: Select all

svn co --revision 4440 https://elmerfem.svn.sourceforge.net/svnroot/elmerfem elmersrc
Compile and install the plugin:

Code: Select all

cd elmersrc/trunk/misc/tetgen_plugin/
qmake
make
sudo make install
Link to the installed file, since it's named wrong:

Code: Select all

sudo ln -s $LD_LIBRARY_PATH/libtetplugin.so $LD_LIBRARY_PATH/libtet.so
Post Reply