Error: cannot find -lfreetype

Hello, I'm trying to compile OCCT for x86 ABI but got an error.

I'm using, CMake 3.9.0 gui and Windows 10

No problem in compiling using freetype libs armeabi-v7a.

Following is the details about x86: 

[ 38%] Linking CXX shared library ..\..\lin32\clang\libd\libTKService.so
C:/Users/Luigi/AppData/Local/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld: warning: skipping incompatible C:\occt\freetype\libs\x86/libfreetype.so while searching for freetype
C:/Users/Luigi/AppData/Local/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld: error: cannot find -lfreetype
C:/occt/src/Font/Font_FontMgr.cxx:194: error: undefined reference to 'FT_New_Face'
C:/occt/src/Font/Font_FontMgr.cxx:216: error: undefined reference to 'FT_Select_Charmap'
C:/occt/src/Font/Font_FontMgr.cxx:223: error: undefined reference to 'FT_Done_Face'
C:/occt/src/Font/Font_FTFont.cxx:63: error: undefined reference to 'FT_Done_Face'
C:/occt/src/Font/Font_FTFont.cxx:86: error: undefined reference to 'FT_New_Face'
C:/occt/src/Font/Font_FTFont.cxx:92: error: undefined reference to 'FT_Select_Charmap'
C:/occt/src/Font/Font_FTFont.cxx:98: error: undefined reference to 'FT_Set_Char_Size'
C:/occt/src/Font/Font_FTFont.cxx:137: error: undefined reference to 'FT_Load_Char'
C:/occt/src/Font/Font_FTFont.cxx:156: error: undefined reference to 'FT_Load_Char'
C:/occt/src/Font/Font_FTFont.cxx:237: error: undefined reference to 'FT_Get_Kerning'
C:/occt/src/Font/Font_FTFont.cxx:256: error: undefined reference to 'FT_Get_Kerning'
C:/occt/src/Font/Font_FTLibrary.cxx:28: error: undefined reference to 'FT_Init_FreeType'
C:/occt/src/Font/Font_FTLibrary.cxx:42: error: undefined reference to 'FT_Done_FreeType'
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
src\TKService\CMakeFiles\TKService.dir\build.make:675: recipe for target 'lin32/clang/libd/libTKService.so' failed
mingw32-make[2]: *** [lin32/clang/libd/libTKService.so] Error 1
CMakeFiles\Makefile2:1192: recipe for target 'src/TKService/CMakeFiles/TKService.dir/all' failed
mingw32-make[1]: *** [src/TKService/CMakeFiles/TKService.dir/all] Error 2
mingw32-make[1]: *** Waiting for unfinished jobs....
[ 39%] Built target TKBO
[ 44%] Built target TKXSBase
Makefile:128: recipe for target 'all' failed
mingw32-make: *** [all] Error 2

Please help I'm shattered

Kirill Gavrilov's picture

warning: skipping incompatible C:\occt\freetype\libs\x86/libfreetype.so while searching for freetype

Make sure you have built libfreetype.so using the same NDK + compiler + compiler flags for x86 arch.

Luigi D'Alessio's picture

Hello thanks for your answer,
I didn't built libfreetype.so but I downloaded it here
https://www.opencascade.com/sites/default/files/private/occt/3rdparty/An...
where are included
libs/x86/libfreetype.so
lobs/armeabi-v7a/libfreetype.so

What means for 'compiler flags for x86 arch'?
I'm not very skilled on that so if you can give me more details.

Do you know about a specific tutorial to follow on that?

Thank you so much.

Kirill Gavrilov's picture

The libfreetype.so from OCC site is built by gcc, not CLang (used by you for building OCCT).
But probably the x86 build was just broken.

You can try newer version (Freetype 2.7.1) from OCC site:
https://www.opencascade.com/content/3rd-party-components

Do you know about a specific tutorial to follow on that?

You can check building instruction from official site of this library:
https://www.freetype.org/