Homebrew Question SDL2 Switch Development Woes

  • Thread starter Thread starter delete12345
  • Start date Start date
  • Views Views 25,748
  • Replies Replies 37
  • Likes Likes 10
I've updated evrtything with devkitpro's pacman, i'm checking if i did something wrong with my Makefile
Replace in your make file:
LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
With
LDFLAGS = -g $(ARCH) -Wl,-Map,$(notdir $*.map)
 
  • Like
Reactions: XorTroll
So this is a milestone for me using SDL2.

One of the hard parts in SDL2 development for the Switch, is how to load fonts.

After scouring tons of Github source codes, I've finally figured out how to do this. Steps for you to follow:

  1. In your Makefile, at the very bottom, add the following:

    Code:
    # Add this if your font file type is a TrueType Collection
    %.ttc.o :    %.ttc
        @echo $(notdir $<)
        @$(bin2o)
    
    # Add this if your font file type is a TrueType Font
    %.ttf.o :    %.ttf
        @echo $(notdir $<)
        @$(bin2o)

    Essentially, the Makefile would compile all binary data types (those that are not in text format) into the NRO build.

  2. In your topmost header file (.h), add the following in the format given:

    Code:
    #include <[name of font file][replace periods and whitespaces with underscores][file format].h>

    If you want to use Times New Roman, and it's a TTC file, aptly named "times NeW RoNaN.ttc" on Windows, you will add:

    Code:
    #include <times_NeW_RoNaN_ttc.h>

    This includes case-sensitivity, typos, whitespaces and periods.

  3. In your CPP file, to use SDL2's SDL_ttf function call to load fonts, you do this:

    Code:
    TTF_Font* myFont = TTF_OpenFontRW(SDL_RWFromMem((void *) times_NeW_RoNaN_ttc, times_NeW_RoNaN_ttc_size), 1, 36);

    Note there are 2 variables, times_NeW_RoNaN_ttc and times_NeW_RoNaN_ttc_size. [font name]_size is a variable included when generating the [font name] header files.
And there I go, I can now load fonts!

I know there is another way to do this, and that is to load fonts by passing in a file path to said font file.

I don't know how to make that work though, and I was fussing over this for 2 days, until I resorted to use the method given above.


-----------


The next step for me is to learn how to load a text file using the Makefile build method for the Switch.


if you want to make your life easier you can put your font in the ROMFS folder and load it from there.

Declare a pointer to your font:
TTF_Font *Arial

Init TTF and Romfs:
TTF_Init();
romfsInit();

Load your font from your ROMFS folder.
Arial = TTF_OpenFont("romfs:/arial.ttf", 36);

When you finish your program call this functions:
TTF_CloseFont(Arial);
TTF_Quit();
romfsExit();
 
I
if you want to make your life easier you can put your font in the ROMFS folder and load it from there.

Declare a pointer to your font:


Init TTF and Romfs:


Load your font from your ROMFS folder.


When you finish your program call this functions:
I already know how to use RomFS, thanks anyway again, I've loaded text from a font inside RomFS
 
if you want to make your life easier you can put your font in the ROMFS folder and load it from there.

Declare a pointer to your font:


Init TTF and Romfs:


Load your font from your ROMFS folder.


When you finish your program call this functions:
It's been a while since I touched my project, but thanks for the tips. I always appreciate any SDL2 information.
 
Sorry to bump but I've been having the original problem as well and this seems like a pretty appropriate place to ask.
Trying to use SDL2 but everything that isn't just init and quit results in a crash.
I have the following code in a .cpp file https://pastebin.com/q8g8gEfa
Makefile is the following https://pastebin.com/JW4yf7H2

At this point I've pretty much copied both of those things from this program, which I've actually managed to compile and successfully run, and that includes modifying it from how it originally was by renaming the files to .cpp/.hpp and putting draw.cpp/hpp in an include folder.
As you can see I haven't included switch.h, and if there are any weird things in the code like main() not having arguments or the window not being fullscreen it's because I have tried that, didn't work, and just ended up copying it the way it was from the sdl-hello-world program I linked, which has those peculiarities and still manages to run perfectly well when compiled.

I just don't see what can be wrong, I've tried everything and the code right now is just the simplest thing, almost fully copied from something else and still doesn't run. There must be one little thing I missed in the makefile or something but I've no idea.

Edit: the actual, longer code that isn't just a test that I want to eventually get running, which also crashes https://pastebin.com/JijWGbj2
 
Last edited by 730,
I was having weird hangs on console from my app after a good few seconds. Ran it on emulator to find that the emu said NOPE immediately.. dumped a stack trace and realized that Mix_OpenAudio is garbage. Mixer_Init is fine though. Not sure if people are aware, or have a work around. I'd like to hear if there is a work around. It throws a nullptr exception with the settings ive tried.

Edit: I'm thinking the hanging is another underlying issue and that Audio is fine and Ryujinx just doesnt like it. Hmmm
 
Last edited by Reisyukaku,
Edit: I'm thinking the hanging is another underlying issue and that Audio is fine and Ryujinx just doesnt like it. Hmmm
When you do get a follow-up, please update us. Any findings on SDL2, the problems around it, and the solutions after it, as a whole, would be great for me to log and add to the table of contents in OP.
 
Last edited by delete12345,
When you do get a follow-up, please update us. Any findings on SDL2, the problems around it, and the solutions after it, as a whole, would be great for me to log and add to the table of contents in OP.
Audio was fine on console. Talked to gdkchan and got audio issue figured out there.. The hanging itself was fragments of spaghetti code I was working with. Everything works like a dream now.
 
Audio was fine on console. Talked to gdkchan and got audio issue figured out there.. The hanging itself was fragments of spaghetti code I was working with. Everything works like a dream now.
Of course, as I did the sdl2 port, it must be perfect :p
 
Hey guys, I'm having various problems with SDL2.
I free everything before closing it, but if I close and reinit SDL2, I always get 2168-0002 error
I've has same error in various apps. Am I doing anything wrong, or is SDL2 fucked up?
 
How can I make it so my homebrew is in 1080p, It defaults to 720p and setting the windows size to 1920x1080 doesn't seem to change that... My switch is setup to do 1080p at least when connected to a TV.
 
How can I make it so my homebrew is in 1080p, It defaults to 720p and setting the windows size to 1920x1080 doesn't seem to change that... My switch is setup to do 1080p at least when connected to a TV.
Hi,

From what i remember it needs to be docked before launching the homebrew to be able to create a 1080p window. There is maybe some bugs thought as I only really tested in 720p. That said, I'm actually refactoring sdl2 video driver for the switch (as libnx will publish some change soon), and it for sure now work correctly. It should be out very soon (a few days I hope).
 
I can get SDL to work for audio, input and video but as soon as I try to use anything in TTF, I get crazy link errors.

Here is the relevent portion of my makefile


ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE
CFLAGS := -g -Wall -O2 -ffunction-sections \
$(ARCH) $(DEFINES)
CFLAGS += $(INCLUDE) -D__SWITCH__
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
LIBS := -lSDL2_ttf -lSDL2_gfx -lSDL2_image -lSDL2_mixer -lSDL2 -lpng -ljpeg -lglad -lEGL -lglapi -ldrm_nouveau -lvorbisidec -logg -lmpg123 -lmodplug -lstdc++ -lavformat -lavcodec -lswresample -lswscale -lavutil -lbz2 -lass -ltheora -lvorbis -lopus -lnx



and here is the code in question


#include <switch.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_ttf.h>
...

if (TTF_Init() < 0)
{
printf("Error initializing TTF : %s\n", TTF_GetError());
return false;
}


as soon as TTF_Init is put in the code, I get this in the terminal.


aarch64-none-elf-g++ -MMD -MP -MF /c/development/Projects/CPP/Switch_SDLPractice/Switch_SDLPractice/build/window.d -g -Wall -O2 -ffunction-sections -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE -I/c/development/Projects/CPP/Switch_SDLPractice/Switch_SDLPractice/include -I/C\devkitPro/portlibs/switch/include -IC:\devkitPro/libnx/include -I/c/development/Projects/CPP/Switch_SDLPractice/Switch_SDLPractice/build -D__SWITCH__ -fno-rtti -fno-exceptions -c /c/development/Projects/CPP/Switch_SDLPractice/Switch_SDLPractice/source/window.cpp -o window.o
linking Switch_SDLPractice.elf
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/portlibs/switch/lib\libSDL2_ttf.a(SDL_ttf.o): in function `Load_Glyph':
/home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:602: undefined reference to `FT_Load_Glyph'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:687: undefined reference to `FT_Render_Glyph'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:888: undefined reference to `FT_Done_Glyph'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:600: undefined reference to `FT_Get_Char_Index'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:602: undefined reference to `FT_Load_Glyph'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:670: undefined reference to `FT_Get_Glyph'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:671: undefined reference to `FT_Stroker_New'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:675: undefined reference to `FT_Stroker_Set'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:676: undefined reference to `FT_Glyph_Stroke'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:677: undefined reference to `FT_Stroker_Done'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:679: undefined reference to `FT_Glyph_To_Bitmap'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:664: undefined reference to `FT_Outline_Transform'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:681: undefined reference to `FT_Done_Glyph'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/portlibs/switch/lib\libSDL2_ttf.a(SDL_ttf.o): in function `TTF_Init':
/home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:339: undefined reference to `FT_Init_FreeType'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/portlibs/switch/lib\libSDL2_ttf.a(SDL_ttf.o): in function `TTF_CloseFont':
/home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:920: undefined reference to `FT_Done_Face'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/portlibs/switch/lib\libSDL2_ttf.a(SDL_ttf.o): in function `TTF_OpenFontIndexRW':
/home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:431: undefined reference to `FT_Open_Face'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:453: undefined reference to `FT_Set_Charmap'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:483: undefined reference to `FT_Set_Pixel_Sizes'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:459: undefined reference to `FT_Set_Char_Size'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:468: undefined reference to `FT_MulFix'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:469: undefined reference to `FT_MulFix'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:471: undefined reference to `FT_MulFix'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:472: undefined reference to `FT_MulFix'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:473: undefined reference to `FT_MulFix'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/portlibs/switch/lib\libSDL2_ttf.a(SDL_ttf.o): in function `TTF_GlyphIsProvided':
/home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:1131: undefined reference to `FT_Get_Char_Index'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/portlibs/switch/lib\libSDL2_ttf.a(SDL_ttf.o): in function `TTF_SizeUTF8':
/home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:1234: undefined reference to `FT_Get_Kerning'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/portlibs/switch/lib\libSDL2_ttf.a(SDL_ttf.o): in function `TTF_RenderUTF8_Solid':
/home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:1422: undefined reference to `FT_Get_Kerning'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/portlibs/switch/lib\libSDL2_ttf.a(SDL_ttf.o): in function `TTF_RenderUTF8_Shaded':
/home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:1603: undefined reference to `FT_Get_Kerning'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/portlibs/switch/lib\libSDL2_ttf.a(SDL_ttf.o): in function `TTF_RenderUTF8_Blended':
/home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:1773: undefined reference to `FT_Get_Kerning'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/portlibs/switch/lib\libSDL2_ttf.a(SDL_ttf.o): in function `TTF_RenderUTF8_Blended_Wrapped':
/home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:2041: undefined reference to `FT_Get_Kerning'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/portlibs/switch/lib\libSDL2_ttf.a(SDL_ttf.o): in function `TTF_Quit':
/home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:2189: undefined reference to `FT_Done_FreeType'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/portlibs/switch/lib\libSDL2_ttf.a(SDL_ttf.o): in function `TTF_GetFontKerningSize':
/home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:2203: undefined reference to `FT_Get_Kerning'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/portlibs/switch/lib\libSDL2_ttf.a(SDL_ttf.o): in function `TTF_GetFontKerningSizeGlyphs':
/home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:2235: undefined reference to `FT_Get_Kerning'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [C:\devkitPro/libnx/switch_rules:80: /c/development/Projects/CPP/Switch_SDLPractice/Switch_SDLPractice/Switch_SDLPractice.elf] Error 1
make: *** [Makefile:290: build] Error 2




I've tried:
  1. reinstalling all switch related pacman packages.
  2. Re-ordering include statements.
  3. Re-ordering libs := ...
Does anyone have any pointers for where to go next with this?
 
I can get SDL to work for audio, input and video but as soon as I try to use anything in TTF, I get crazy link errors.

Here is the relevent portion of my makefile


ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE
CFLAGS := -g -Wall -O2 -ffunction-sections \
$(ARCH) $(DEFINES)
CFLAGS += $(INCLUDE) -D__SWITCH__
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
LIBS := -lSDL2_ttf -lSDL2_gfx -lSDL2_image -lSDL2_mixer -lSDL2 -lpng -ljpeg -lglad -lEGL -lglapi -ldrm_nouveau -lvorbisidec -logg -lmpg123 -lmodplug -lstdc++ -lavformat -lavcodec -lswresample -lswscale -lavutil -lbz2 -lass -ltheora -lvorbis -lopus -lnx



and here is the code in question


#include <switch.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_ttf.h>
...

if (TTF_Init() < 0)
{
printf("Error initializing TTF : %s\n", TTF_GetError());
return false;
}


as soon as TTF_Init is put in the code, I get this in the terminal.


aarch64-none-elf-g++ -MMD -MP -MF /c/development/Projects/CPP/Switch_SDLPractice/Switch_SDLPractice/build/window.d -g -Wall -O2 -ffunction-sections -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE -I/c/development/Projects/CPP/Switch_SDLPractice/Switch_SDLPractice/include -I/C\devkitPro/portlibs/switch/include -IC:\devkitPro/libnx/include -I/c/development/Projects/CPP/Switch_SDLPractice/Switch_SDLPractice/build -D__SWITCH__ -fno-rtti -fno-exceptions -c /c/development/Projects/CPP/Switch_SDLPractice/Switch_SDLPractice/source/window.cpp -o window.o
linking Switch_SDLPractice.elf
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/portlibs/switch/lib\libSDL2_ttf.a(SDL_ttf.o): in function `Load_Glyph':
/home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:602: undefined reference to `FT_Load_Glyph'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:687: undefined reference to `FT_Render_Glyph'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:888: undefined reference to `FT_Done_Glyph'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:600: undefined reference to `FT_Get_Char_Index'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:602: undefined reference to `FT_Load_Glyph'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:670: undefined reference to `FT_Get_Glyph'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:671: undefined reference to `FT_Stroker_New'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:675: undefined reference to `FT_Stroker_Set'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:676: undefined reference to `FT_Glyph_Stroke'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:677: undefined reference to `FT_Stroker_Done'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:679: undefined reference to `FT_Glyph_To_Bitmap'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:664: undefined reference to `FT_Outline_Transform'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:681: undefined reference to `FT_Done_Glyph'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/portlibs/switch/lib\libSDL2_ttf.a(SDL_ttf.o): in function `TTF_Init':
/home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:339: undefined reference to `FT_Init_FreeType'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/portlibs/switch/lib\libSDL2_ttf.a(SDL_ttf.o): in function `TTF_CloseFont':
/home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:920: undefined reference to `FT_Done_Face'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/portlibs/switch/lib\libSDL2_ttf.a(SDL_ttf.o): in function `TTF_OpenFontIndexRW':
/home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:431: undefined reference to `FT_Open_Face'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:453: undefined reference to `FT_Set_Charmap'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:483: undefined reference to `FT_Set_Pixel_Sizes'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:459: undefined reference to `FT_Set_Char_Size'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:468: undefined reference to `FT_MulFix'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:469: undefined reference to `FT_MulFix'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:471: undefined reference to `FT_MulFix'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:472: undefined reference to `FT_MulFix'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:473: undefined reference to `FT_MulFix'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/portlibs/switch/lib\libSDL2_ttf.a(SDL_ttf.o): in function `TTF_GlyphIsProvided':
/home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:1131: undefined reference to `FT_Get_Char_Index'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/portlibs/switch/lib\libSDL2_ttf.a(SDL_ttf.o): in function `TTF_SizeUTF8':
/home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:1234: undefined reference to `FT_Get_Kerning'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/portlibs/switch/lib\libSDL2_ttf.a(SDL_ttf.o): in function `TTF_RenderUTF8_Solid':
/home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:1422: undefined reference to `FT_Get_Kerning'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/portlibs/switch/lib\libSDL2_ttf.a(SDL_ttf.o): in function `TTF_RenderUTF8_Shaded':
/home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:1603: undefined reference to `FT_Get_Kerning'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/portlibs/switch/lib\libSDL2_ttf.a(SDL_ttf.o): in function `TTF_RenderUTF8_Blended':
/home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:1773: undefined reference to `FT_Get_Kerning'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/portlibs/switch/lib\libSDL2_ttf.a(SDL_ttf.o): in function `TTF_RenderUTF8_Blended_Wrapped':
/home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:2041: undefined reference to `FT_Get_Kerning'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/portlibs/switch/lib\libSDL2_ttf.a(SDL_ttf.o): in function `TTF_Quit':
/home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:2189: undefined reference to `FT_Done_FreeType'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/portlibs/switch/lib\libSDL2_ttf.a(SDL_ttf.o): in function `TTF_GetFontKerningSize':
/home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:2203: undefined reference to `FT_Get_Kerning'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/portlibs/switch/lib\libSDL2_ttf.a(SDL_ttf.o): in function `TTF_GetFontKerningSizeGlyphs':
/home/davem/projects/devkitpro/pacman-packages/switch/SDL2_ttf/src/SDL2_ttf-2.0.14/SDL_ttf.c:2235: undefined reference to `FT_Get_Kerning'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [C:\devkitPro/libnx/switch_rules:80: /c/development/Projects/CPP/Switch_SDLPractice/Switch_SDLPractice/Switch_SDLPractice.elf] Error 1
make: *** [Makefile:290: build] Error 2




I've tried:
  1. reinstalling all switch related pacman packages.
  2. Re-ordering include statements.
  3. Re-ordering libs := ...
Does anyone have any pointers for where to go next with this?

I have had a hard time compiling some newer stuff with the libnx from the devkitpro, but it looks like you are just using a sample template build. While packman grabs libnx 2.0.1, there are a lot of commits since then. Build it yourself it fixed a lot of problems I was having. Just a guess though.
 
I have had a hard time compiling some newer stuff with the libnx from the devkitpro, but it looks like you are just using a sample template build. While packman grabs libnx 2.0.1, there are a lot of commits since then. Build it yourself it fixed a lot of problems I was having. Just a guess though.

I'm a bit confused, this is from my own project that I'm porting over, all that's left is text implementation. So with that said I've been building it the whole time. The makefile is a slightly modified version compiled from a template in examples, the SDL_Helper repo, and from a comment I found while bug fixing.

I got all the libraries through the latest devkitpro last week and see them installed with pacman -Sl. Is there some other way I can get more recent revisions of the dependencies then just pacman?

--------------------- MERGED ---------------------------

I'm a bit confused, this is from my own project that I'm porting over, all that's left is text implementation. So with that said I've been building it the whole time. The makefile is a slightly modified version compiled from a template in examples, the SDL_Helper repo, and from a comment I found while bug fixing.

I got all the libraries through the latest devkitpro last week and see them installed with pacman -Sl. Is there some other way I can get more recent revisions of the dependencies then just pacman?

EDIT:

So from what I can tell, grabbing this tarball https://github.com/devkitPro/buildscripts/releases/tag/v20190220 and run ./build-devkit.sh.
At which point my includes will be up to date?

EDIT 2:

I tried what I mentioned in the first Edit but nothing changed, I may have done something wrong though. I chose 'switch' for which to download and let everything extract, it doesn't look like any files were changed though.
 
Last edited by Shachah,
I tried what I mentioned in the first Edit but nothing changed, I may have done something wrong though. I chose 'switch' for which to download and let everything extract, it doesn't look like any files were changed though.

You might've solved it already, but in case you didn't, you were missing "-lfreetype" in your LIBS line on the makefile, possibly among some others. Just use "`$(PORTLIBS)/bin/freetype-config --libs`" somewhere in your LIBS line instead. If you wanna take a look at my makefile, here you go: https://pastebin.com/hPBnZi2w
 

Site & Scene News

Popular threads in this forum