libprojectM won’t compile under Ubuntu 7.10 on AMD64
January 14th, 2008 by draguWhile trying to compile my favorite music visualization library projectM, it failed with the following message:
[ 2%] Building CXX object CMakeFiles/projectM.dir/projectM.o
In file included from /usr/include/FTGL/FTFont.h:4,
from /usr/include/FTGL/FTGLPixmapFont.h:5,
from /home/dragu/Desktop/libprojectM-1.01/Renderer.hpp:25,
from /home/dragu/Desktop/libprojectM-1.01/projectM.cpp:59:
/usr/include/ft2build.h:56:38: error: freetype/config/ftheader.h: No such file or directory
In file included from /usr/include/FTGL/FTGLPixmapFont.h:5,
from /home/dragu/Desktop/libprojectM-1.01/Renderer.hpp:25,
from /home/dragu/Desktop/libprojectM-1.01/projectM.cpp:59:
/usr/include/FTGL/FTFont.h:5:10: error: #include expects “FILENAME” or
In file included from /usr/include/FTGL/FTFont.h:7,
from /usr/include/FTGL/FTGLPixmapFont.h:5,
from /home/dragu/Desktop/libprojectM-1.01/Renderer.hpp:25,
from /home/dragu/Desktop/libprojectM-1.01/projectM.cpp:59:
/usr/include/FTGL/FTFace.h:5:10: error: #include expects “FILENAME” or
/usr/include/FTGL/FTFace.h:6:10: error: #include expects “FILENAME” or
In file included from /usr/include/FTGL/FTFace.h:9,
from /usr/include/FTGL/FTFont.h:7,
from /usr/include/FTGL/FTGLPixmapFont.h:5,
from /home/dragu/Desktop/libprojectM-1.01/Renderer.hpp:25,
from /home/dragu/Desktop/libprojectM-1.01/projectM.cpp:59:
/usr/include/FTGL/FTPoint.h:5:10: error: #include expects “FILENAME” or
/usr/include/FTGL/FTPoint.h:6:10: error: #include expects “FILENAME” or
In file included from /usr/include/FTGL/FTFace.h:10,
from /usr/include/FTGL/FTFont.h:7,
from /usr/include/FTGL/FTGLPixmapFont.h:5,
from /home/dragu/Desktop/libprojectM-1.01/Renderer.hpp:25,
from /home/dragu/Desktop/libprojectM-1.01/projectM.cpp:59:
/usr/include/FTGL/FTSize.h:6:10: error: #include expects “FILENAME” or
/usr/include/FTGL/FTPoint.h:45: error: expected ‘,’ or ‘…’ before ‘&’ token
/usr/include/FTGL/FTPoint.h: In constructor ‘FTPoint::FTPoint(int)’:
/usr/include/FTGL/FTPoint.h:47: error: ‘ft_vector’ was not declared in this scope
/usr/include/FTGL/FTSize.h: At global scope:
/usr/include/FTGL/FTSize.h:43: error: ‘FT_Face’ has not been declared
/usr/include/FTGL/FTSize.h:102: error: ‘FT_Error’ does not name a type
/usr/include/FTGL/FTSize.h:108: error: expected ‘;’ before ‘*’ token
/usr/include/FTGL/FTSize.h:113: error: ‘FT_Size’ does not name a type
/usr/include/FTGL/FTSize.h:133: error: ‘FT_Error’ does not name a type
/usr/include/FTGL/FTFace.h:67: error: expected ‘;’ before ‘*’ token
/usr/include/FTGL/FTFace.h:79: error: expected `;’ before ‘const’
/usr/include/FTGL/FTFace.h:93: error: expected ‘;’ before ‘*’ token
/usr/include/FTGL/FTFace.h:103: error: ‘FT_GlyphSlot’ does not name a type
/usr/include/FTGL/FTFace.h:115: error: ‘FT_Error’ does not name a type
/usr/include/FTGL/FTFace.h:121: error: expected ‘;’ before ‘*’ token
/usr/include/FTGL/FTFace.h:133: error: expected ‘;’ before ‘*’ token
/usr/include/FTGL/FTFace.h:143: error: ‘FT_Error’ does not name a type
/usr/include/FTGL/FTFont.h:87: error: ‘FT_Encoding’ has not been declared
/usr/include/FTGL/FTFont.h:101: error: expected ‘;’ before ‘*’ token
/usr/include/FTGL/FTFont.h:217: error: ‘FT_Error’ does not name a type
/usr/include/FTGL/FTFont.h:251: error: ‘FT_Error’ does not name a type
make[2]: *** [CMakeFiles/projectM.dir/projectM.o] Error 1
make[1]: *** [CMakeFiles/projectM.dir/all] Error 2
make: *** [all] Error 2
After reading through the actual header files it whined about, I noticed that the paths were in fact wrong: it was looking for the file /usr/include/freetype/config/ftheader.h that actually recided in /usr/include/freetype2/freetype/config/ meaning that for some reason, the files were in a deeper level of directory hierarchies. This was easily fixed:
# sudo ln -s /usr/include/freetype2/freetype /usr/include/freetype
After this, things went well until it failed on the following:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.1.3/../../../../lib/libftgl.a(FTFont.o): relocation R_X86_64_32S against `vtable for FTFont' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.1.3/../../../../lib/libftgl.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: *** [libprojectM.so] Error 1
make[1]: *** [CMakeFiles/projectM.dir/all] Error 2
make: *** [all] Error 2
I made a google and found this and followed the instructions. I used grep to find the files that determined how the code was to be linked, which was found three directories deeper in the hierarchy, namely CMakeFiles/projectM.dir/link.txt and CMakeFiles/projectM.dir/relink.txt
Now all I did was replace the occurence of “-lftgl” with “-lftgl_pic” in both files. The snippet was quite at the end of the very long line.
now I just ran
# sudo make install
and voilá! It Works!
Posted in Helpdesk, Solved | 1 Comment »