Compilation of OCCT 7.4.0 under Kubuntu 20.04 fails: trouble with libfontconfig.so

Hello,

I would be grateful for any advise on my problem.

Compilation under Kubuntu 20.04 on virtual machine (VMWare player) fails on the very last stages with a message:

<.....>
[100%] Built target TKQADraw
[100%] Linking CXX executable ../../lin64/gcc/bini/DRAWEXE
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libfontconfig.so: undefined reference to `FT_Done_MM_Var'
collect2: error: ld returned 1 exit status
make[2]: *** [src/DRAWEXE/CMakeFiles/DRAWEXE.dir/build.make:101: lin64/gcc/bini/DRAWEXE-7.4.0] Error 1
make[1]: *** [CMakeFiles/Makefile2:3558: src/DRAWEXE/CMakeFiles/DRAWEXE.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

Details on installed packages. Standard installation of Kubuntu was used, then I applied all available updates. Then, I installed obligatory prerequisits from sources:

tcl8.6.10, tk8.6.10, freetype-2.5.3

During compilation of OCCT 7.4.0, I installed packages with missing libraries (when I got corresponding errors) from standard repositories:

mesa-common-dev, libglu1-mesa-dev, freeglut3-dev, libfontconfig1-dev, libxmu-dev, libxi-dev

If I remove libfontconfig1-dev and re-invoke "make", the error message is like that:

<.....>
[100%] Built target TKQADraw
[100%] Linking CXX executable ../../lin64/gcc/bini/DRAWEXE
/usr/bin/ld: cannot find -lfontconfig
collect2: error: ld returned 1 exit status
make[2]: *** [src/DRAWEXE/CMakeFiles/DRAWEXE.dir/build.make:101: lin64/gcc/bini/DRAWEXE-7.4.0] Error 1
make[1]: *** [CMakeFiles/Makefile2:3558: src/DRAWEXE/CMakeFiles/DRAWEXE.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

 

Kirill Gavrilov's picture

You are using libfontconfig.so provided with system and depending on newer version of FreeType (supposedly - because you see linkage errors), and provide self-compiled version of FreeType.

On Linux platform it is best practice using system-provided libraries, when they are available - most distrubutions already provide FreeType, Tcl/Tk, FreeImage in their repositories, so that there is no need building them on your own. There are exceptions though - you need some fixes/features in newer versions of referred libraries, or you prepare self-sustained all-include Windows-alike application package.

arplyu_159709's picture

Thank you for such a quick response. [removed]

Update: bearing in mind Kirill's post as a hint, I googled for more info and solved the problem as follows:

1. Downloaded an earlier version (2.12.6) of libfontconfig package https://ubuntu.pkgs.org/18.04/ubuntu-main-amd64/libfontconfig1_2.12.6-0ubuntu2_amd64.deb.html

2. Extracted from there file libfontconfig.so.1.10.1 and put it in /usr/lib/x86_64-linux-gnu/

3. From /usr/lib/x86_64-linux-gnu/, made links:

$ sudo ln -s libfontconfig.so.1.10.1 libfontconfig.so.1
$ sudo ln -s libfontconfig.so.1.10.1 libfontconfig.s

4. Returned to OCCT build directory and repeated MAKE. This time the process finished successfully.

The post which I used for this solution: https://stackoverflow.com/questions/53910698/undefined-reference-to-ft-done-mm-var