Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error with SDL2/SDL2_ttf #69

Closed
hlimbo opened this issue Oct 4, 2021 · 1 comment
Closed

error with SDL2/SDL2_ttf #69

hlimbo opened this issue Oct 4, 2021 · 1 comment

Comments

@hlimbo
Copy link

hlimbo commented Oct 4, 2021

I'm trying to port a game clone I developed from the PC to the PS Vita. I tried following the solution for this resolved issue: #58 but their solution does not work for me. I'm running into linker errors when linking SDL2_ttf dependency for the project.

Operating System: Windows 10
Terminal Used: Ubuntu on Windows

[ 16%] Linking CXX executable breakout_clone
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: /usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/lib/libSDL2_ttf.a(SDL_ttf.c.obj): in function `TTF_Init':
(.text+0x205a): undefined reference to `FT_Init_FreeType'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: /usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/lib/libSDL2_ttf.a(SDL_ttf.c.obj): in function `TTF_OpenFontIndexDPIRW':
(.text+0x223e): undefined reference to `FT_Open_Face'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: (.text+0x2322): undefined reference to `FT_Set_Charmap'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: /usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/lib/libSDL2_ttf.a(SDL_ttf.c.obj): in function `TTF_SetFontSizeDPI':
(.text+0x2436): undefined reference to `FT_Set_Char_Size'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: (.text+0x2486): undefined reference to `FT_Select_Size'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: /usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/lib/libSDL2_ttf.a(SDL_ttf.c.obj): in function `TTF_initFontMetrics':
(.text+0x252c): undefined reference to `FT_MulFix'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: (.text+0x2544): undefined reference to `FT_MulFix'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: (.text+0x2566): undefined reference to `FT_MulFix'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: (.text+0x257e): undefined reference to `FT_MulFix'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: (.text+0x2596): undefined reference to `FT_MulFix'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: /usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/lib/libSDL2_ttf.a(SDL_ttf.c.obj):(.text+0x25aa): more undefined references to `FT_MulFix' follow
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: /usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/lib/libSDL2_ttf.a(SDL_ttf.c.obj): in function `Load_Glyph':
(.text+0x2916): undefined reference to `FT_Load_Glyph'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: (.text+0x2b62): undefined reference to `FT_Outline_Translate'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: (.text+0x2baa): undefined reference to `FT_Outline_Transform'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: (.text+0x2bde): undefined reference to `FT_Get_Glyph'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: (.text+0x2c08): undefined reference to `FT_Stroker_New'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: (.text+0x2c2a): undefined reference to `FT_Stroker_Set'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: (.text+0x2c38): undefined reference to `FT_Glyph_Stroke'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: (.text+0x2c40): undefined reference to `FT_Stroker_Done'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: (.text+0x2c50): undefined reference to `FT_Glyph_To_Bitmap'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: (.text+0x2c60): undefined reference to `FT_Done_Glyph'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: (.text+0x2c90): undefined reference to `FT_Render_Glyph'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: (.text+0x35a6): undefined reference to `FT_Done_Glyph'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: /usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/lib/libSDL2_ttf.a(SDL_ttf.c.obj): in function `get_char_index':
(.text+0x37c2): undefined reference to `FT_Get_Char_Index'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: (.text+0x37e6): undefined reference to `FT_Get_Char_Index'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: /usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/lib/libSDL2_ttf.a(SDL_ttf.c.obj): in function `TTF_CloseFont':
(.text+0x3856): undefined reference to `FT_Done_Face'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: /usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/lib/libSDL2_ttf.a(SDL_ttf.c.obj): in function `TTF_Size_Internal':
(.text+0x4458): undefined reference to `FT_Get_Kerning'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: /usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/lib/libSDL2_ttf.a(SDL_ttf.c.obj): in function `TTF_Quit':
(.text+0x5766): undefined reference to `FT_Done_FreeType'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: /usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/lib/libSDL2_ttf.a(SDL_ttf.c.obj): in function `TTF_GetFontKerningSize':
(.text+0x57ce): undefined reference to `FT_Get_Kerning'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: /usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/lib/libSDL2_ttf.a(SDL_ttf.c.obj): in function `TTF_GetFontKerningSizeGlyphs32':
(.text+0x58a4): undefined reference to `FT_Get_Kerning'
collect2: error: ld returned 1 exit status
CMakeFiles/breakout_clone.dir/build.make:94: recipe for target 'breakout_clone' failed
make[2]: *** [breakout_clone] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/breakout_clone.dir/all' failed
make[1]: *** [CMakeFiles/breakout_clone.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

The lib file is currently in the vita sdk folders:

ls /usr/local/vitasdk/arm-vita-eabi/lib/ | grep libSDL2_ttf
libSDL2_ttf.a

Here is my target link libraries from my CMakeLists.txt

target_link_libraries(${PROJECT_NAME}
  SDL2
  SDL2_ttf
  SceDisplay_stub
  SceCtrl_stub
  SceAudio_stub
  SceSysmodule_stub
  SceGxm_stub
  SceCommonDialog_stub
  SceAppMgr_stub
  SceTouch_stub
  SceHid_stub
  SceMotion_stub
  m
)
@hlimbo
Copy link
Author

hlimbo commented Oct 6, 2021

For anyone else running into this issue, I was able to compile my .vpk file successfully by including the following library dependencies in the target_link_libraries section:

target_link_libraries(${PROJECT_NAME}
  SDL2
  SDL2_ttf
  # SDL2_ttf dependencies
  -lfreetype
  -lpng
  -lz
  SceDisplay_stub
  SceCtrl_stub
  SceAudio_stub
  SceSysmodule_stub
  SceGxm_stub
  SceCommonDialog_stub
  SceAppMgr_stub
  SceTouch_stub
  SceHid_stub
  SceMotion_stub
  m
)

In the terminal in the following path: /usr/local/vitasdk/arm-vita-eabi/lib, you must have the following libraries installed:

libz.a
libfreetype.a
libpng.a

This can be done by running the install-all.sh command from instructions on https://vitasdk.org/.

@hlimbo hlimbo closed this as completed Oct 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant