Homebrew Errors when compiling sftdlib apps

mashers

Stubborn ape
OP
Member
Joined
Jun 10, 2015
Messages
3,837
Trophies
0
Age
40
Location
Kongo Jungle
XP
5,074
Country
I'm trying to get sftdlib working in the Homebrew launcher so I can change the font. I've installed SF2D, Freetype and sftdlib into my devkitpro environment. When I try to build the Homebrew Launcher, I get an error on the console saying "undefined reference to `sftd_load_font_mem'". The strange thing is that this method is defined in sftd.h, which is included at the top of my c file. If I try to compile the sample included with sftdlib then I get a load of undefined reference errors relating to libpng functions. I installed the libpng portlib but this doesn't seem to have made any difference.

Any help would be much appreciated!
 

mashers

Stubborn ape
OP
Member
Joined
Jun 10, 2015
Messages
3,837
Trophies
0
Age
40
Location
Kongo Jungle
XP
5,074
Country
Hi mate,

Thanks for your reply. I have two copies of sftd.h. One is in /opt/devkitPro/portlibs/armv6k/include, and the other is in /opt/devkitPro/libstru/include. I did try installing the portlibs with the Makefile you linked to but it only seemed to build them, not actually install them, so I downloaded the individual package and installed them manually.
 

mashers

Stubborn ape
OP
Member
Joined
Jun 10, 2015
Messages
3,837
Trophies
0
Age
40
Location
Kongo Jungle
XP
5,074
Country
Here you go:

Code:
iMash:~ mash$ source ~/.bashrc
iMash:~ mash$ cd Downloads/sftdlib-master/sample/
iMash:sample mash$ make
FreeSans.ttf
main.c
arm-none-eabi-gcc -MMD -MP -MF /Users/mash/Downloads/sftdlib-master/sample/build/main.d -g -Wall -O2 -mword-relocations -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mfloat-abi=hard -I/Users/mash/Downloads/sftdlib-master/sample/include -I/opt/devkitPro/libctru/include -I/opt/devkitPro/portlibs/armv6k/include -I/opt/devkitPro/portlibs/3ds/include -I/Users/mash/Downloads/sftdlib-master/sample/build -DARM11 -D_3DS -c /Users/mash/Downloads/sftdlib-master/sample/source/main.c -o main.o
linking sftd_sample.elf
/opt/devkitPro/portlibs/armv6k/lib/libfreetype.a(sfnt.o): In function `error_callback':
sfnt.c:(.text+0x4760): undefined reference to `png_get_error_ptr'
sfnt.c:(.text+0x4778): undefined reference to `png_set_longjmp_fn'
/opt/devkitPro/portlibs/armv6k/lib/libfreetype.a(sfnt.o): In function `Load_SBit_Png.isra.14':
sfnt.c:(.text+0x69f4): undefined reference to `png_create_read_struct'
sfnt.c:(.text+0x6a08): undefined reference to `png_create_info_struct'
sfnt.c:(.text+0x6a28): undefined reference to `png_set_longjmp_fn'
sfnt.c:(.text+0x6a4c): undefined reference to `png_destroy_read_struct'
sfnt.c:(.text+0x6a70): undefined reference to `png_set_read_fn'
sfnt.c:(.text+0x6a7c): undefined reference to `png_read_info'
sfnt.c:(.text+0x6aac): undefined reference to `png_get_IHDR'
sfnt.c:(.text+0x6b34): undefined reference to `png_destroy_read_struct'
sfnt.c:(.text+0x6b78): undefined reference to `png_set_palette_to_rgb'
sfnt.c:(.text+0x6b8c): undefined reference to `png_set_expand_gray_1_2_4_to_8'
sfnt.c:(.text+0x6b9c): undefined reference to `png_get_valid'
sfnt.c:(.text+0x6bd8): undefined reference to `png_set_interlace_handling'
sfnt.c:(.text+0x6be8): undefined reference to `png_set_filler'
sfnt.c:(.text+0x6bf4): undefined reference to `png_read_update_info'
sfnt.c:(.text+0x6c2c): undefined reference to `png_get_IHDR'
sfnt.c:(.text+0x6c5c): undefined reference to `png_set_read_user_transform_fn'
sfnt.c:(.text+0x6ce4): undefined reference to `png_read_image'
sfnt.c:(.text+0x6cfc): undefined reference to `png_read_end'
sfnt.c:(.text+0x6d08): undefined reference to `png_set_gray_to_rgb'
sfnt.c:(.text+0x6d14): undefined reference to `png_set_packing'
sfnt.c:(.text+0x6d20): undefined reference to `png_set_tRNS_to_alpha'
sfnt.c:(.text+0x6d48): undefined reference to `png_set_strip_16'
sfnt.c:(.text+0x6d58): undefined reference to `png_set_read_user_transform_fn'
/opt/devkitPro/portlibs/armv6k/lib/libfreetype.a(sfnt.o): In function `read_data_from_FT_Stream':
sfnt.c:(.text+0x6e2c): undefined reference to `png_get_io_ptr'
sfnt.c:(.text+0x6e64): undefined reference to `png_get_error_ptr'
sfnt.c:(.text+0x6e78): undefined reference to `png_error'
collect2: error: ld returned 1 exit status
make[1]: *** [/Users/mash/Downloads/sftdlib-master/sample/sftd_sample.elf] Error 1
make: *** [build] Error 2
iMash:sample mash$

Edit - code tags
 

Garcia98

Hey! Listen!
Member
Joined
Sep 8, 2015
Messages
361
Trophies
0
Location
Salamanca
Website
github.com
XP
267
Country
Here you go:

Code:
iMash:~ mash$ source ~/.bashrc
iMash:~ mash$ cd Downloads/sftdlib-master/sample/
iMash:sample mash$ make
FreeSans.ttf
main.c
arm-none-eabi-gcc -MMD -MP -MF /Users/mash/Downloads/sftdlib-master/sample/build/main.d -g -Wall -O2 -mword-relocations -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mfloat-abi=hard -I/Users/mash/Downloads/sftdlib-master/sample/include -I/opt/devkitPro/libctru/include -I/opt/devkitPro/portlibs/armv6k/include -I/opt/devkitPro/portlibs/3ds/include -I/Users/mash/Downloads/sftdlib-master/sample/build -DARM11 -D_3DS -c /Users/mash/Downloads/sftdlib-master/sample/source/main.c -o main.o
linking sftd_sample.elf
/opt/devkitPro/portlibs/armv6k/lib/libfreetype.a(sfnt.o): In function `error_callback':
sfnt.c:(.text+0x4760): undefined reference to `png_get_error_ptr'
sfnt.c:(.text+0x4778): undefined reference to `png_set_longjmp_fn'
/opt/devkitPro/portlibs/armv6k/lib/libfreetype.a(sfnt.o): In function `Load_SBit_Png.isra.14':
sfnt.c:(.text+0x69f4): undefined reference to `png_create_read_struct'
sfnt.c:(.text+0x6a08): undefined reference to `png_create_info_struct'
sfnt.c:(.text+0x6a28): undefined reference to `png_set_longjmp_fn'
sfnt.c:(.text+0x6a4c): undefined reference to `png_destroy_read_struct'
sfnt.c:(.text+0x6a70): undefined reference to `png_set_read_fn'
sfnt.c:(.text+0x6a7c): undefined reference to `png_read_info'
sfnt.c:(.text+0x6aac): undefined reference to `png_get_IHDR'
sfnt.c:(.text+0x6b34): undefined reference to `png_destroy_read_struct'
sfnt.c:(.text+0x6b78): undefined reference to `png_set_palette_to_rgb'
sfnt.c:(.text+0x6b8c): undefined reference to `png_set_expand_gray_1_2_4_to_8'
sfnt.c:(.text+0x6b9c): undefined reference to `png_get_valid'
sfnt.c:(.text+0x6bd8): undefined reference to `png_set_interlace_handling'
sfnt.c:(.text+0x6be8): undefined reference to `png_set_filler'
sfnt.c:(.text+0x6bf4): undefined reference to `png_read_update_info'
sfnt.c:(.text+0x6c2c): undefined reference to `png_get_IHDR'
sfnt.c:(.text+0x6c5c): undefined reference to `png_set_read_user_transform_fn'
sfnt.c:(.text+0x6ce4): undefined reference to `png_read_image'
sfnt.c:(.text+0x6cfc): undefined reference to `png_read_end'
sfnt.c:(.text+0x6d08): undefined reference to `png_set_gray_to_rgb'
sfnt.c:(.text+0x6d14): undefined reference to `png_set_packing'
sfnt.c:(.text+0x6d20): undefined reference to `png_set_tRNS_to_alpha'
sfnt.c:(.text+0x6d48): undefined reference to `png_set_strip_16'
sfnt.c:(.text+0x6d58): undefined reference to `png_set_read_user_transform_fn'
/opt/devkitPro/portlibs/armv6k/lib/libfreetype.a(sfnt.o): In function `read_data_from_FT_Stream':
sfnt.c:(.text+0x6e2c): undefined reference to `png_get_io_ptr'
sfnt.c:(.text+0x6e64): undefined reference to `png_get_error_ptr'
sfnt.c:(.text+0x6e78): undefined reference to `png_error'
collect2: error: ld returned 1 exit status
make[1]: *** [/Users/mash/Downloads/sftdlib-master/sample/sftd_sample.elf] Error 1
make: *** [build] Error 2
iMash:sample mash$

Edit - code tags

Are you sure that libpng is properly installed?
 

mashers

Stubborn ape
OP
Member
Joined
Jun 10, 2015
Messages
3,837
Trophies
0
Age
40
Location
Kongo Jungle
XP
5,074
Country
You're right - it wasn't linked in the makefile. I added -lpng and got lots of errors about VFP register arguments. I changed from hard to soft float and then started getting this error:

Code:
iMash:sample mash$ make clean
clean ...
iMash:sample mash$ make
FreeSans.ttf
main.c
arm-none-eabi-gcc -MMD -MP -MF /Users/mash/Downloads/sftdlib-master/sample/build/main.d -g -Wall -O2 -mword-relocations -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mfloat-abi=soft -I/Users/mash/Downloads/sftdlib-master/sample/include -I/opt/devkitPro/libctru/include -I/opt/devkitPro/portlibs/armv6k/include -I/opt/devkitPro/portlibs/3ds/include -I/Users/mash/Downloads/sftdlib-master/sample/build -DARM11 -D_3DS -c /Users/mash/Downloads/sftdlib-master/sample/source/main.c -o main.o
linking sftd_sample.elf
/opt/devkitPro/devkitARM/bin/../lib/gcc/arm-none-eabi/4.9.2/../../../../arm-none-eabi/bin/ld: cannot find 3dsx_crt0.o: No such file or directory
collect2: error: ld returned 1 exit status
make[1]: *** [/Users/mash/Downloads/sftdlib-master/sample/sftd_sample.elf] Error 1
make: *** [build] Error 2

which apparently means I have to use hard float... So I really have no idea how to get this working. I'm actually wondering if the problem is that I'm using a Mac. Do you think it would make any difference if I set up devkitpro in a Linux VM and try building there?
 

Garcia98

Hey! Listen!
Member
Joined
Sep 8, 2015
Messages
361
Trophies
0
Location
Salamanca
Website
github.com
XP
267
Country
These are linker errors. you need to add the libraries to your makefile.

In the example libraries are already in the Makefile (obviously).
You're right - it wasn't linked in the makefile. I added -lpng and got lots of errors about VFP register arguments. I changed from hard to soft float and then started getting this error:

Code:
iMash:sample mash$ make clean
clean ...
iMash:sample mash$ make
FreeSans.ttf
main.c
arm-none-eabi-gcc -MMD -MP -MF /Users/mash/Downloads/sftdlib-master/sample/build/main.d -g -Wall -O2 -mword-relocations -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mfloat-abi=soft -I/Users/mash/Downloads/sftdlib-master/sample/include -I/opt/devkitPro/libctru/include -I/opt/devkitPro/portlibs/armv6k/include -I/opt/devkitPro/portlibs/3ds/include -I/Users/mash/Downloads/sftdlib-master/sample/build -DARM11 -D_3DS -c /Users/mash/Downloads/sftdlib-master/sample/source/main.c -o main.o
linking sftd_sample.elf
/opt/devkitPro/devkitARM/bin/../lib/gcc/arm-none-eabi/4.9.2/../../../../arm-none-eabi/bin/ld: cannot find 3dsx_crt0.o: No such file or directory
collect2: error: ld returned 1 exit status
make[1]: *** [/Users/mash/Downloads/sftdlib-master/sample/sftd_sample.elf] Error 1
make: *** [build] Error 2

which apparently means I have to use hard float... So I really have no idea how to get this working. I'm actually wondering if the problem is that I'm using a Mac. Do you think it would make any difference if I set up devkitpro in a Linux VM and try building there?

Lol I asked you what were the errors of sftd example, not the errors of your project
 

mashers

Stubborn ape
OP
Member
Joined
Jun 10, 2015
Messages
3,837
Trophies
0
Age
40
Location
Kongo Jungle
XP
5,074
Country
I think I might have taken -lpng out of the makefile to try to resolve errors before installing libpng properly since I didn't think libpng would be required for text. In any case, the most recent error is now the relevant one.
 

mashers

Stubborn ape
OP
Member
Joined
Jun 10, 2015
Messages
3,837
Trophies
0
Age
40
Location
Kongo Jungle
XP
5,074
Country
Actually I put -mfloat-abi-soft, but I've just changed it to softfp and got the same error:

Code:
iMash:sample mash$ make
FreeSans.ttf
main.c
arm-none-eabi-gcc -MMD -MP -MF /Users/mash/Downloads/sftdlib-master/sample/build/main.d -g -Wall -O2 -mword-relocations -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mfloat-abi=softfp -I/Users/mash/Downloads/sftdlib-master/sample/include -I/opt/devkitPro/libctru/include -I/opt/devkitPro/portlibs/armv6k/include -I/opt/devkitPro/portlibs/3ds/include -I/Users/mash/Downloads/sftdlib-master/sample/build -DARM11 -D_3DS -c /Users/mash/Downloads/sftdlib-master/sample/source/main.c -o main.o
linking sftd_sample.elf
/opt/devkitPro/devkitARM/bin/../lib/gcc/arm-none-eabi/4.9.2/../../../../arm-none-eabi/bin/ld: cannot find 3dsx_crt0.o: No such file or directory
collect2: error: ld returned 1 exit status
make[1]: *** [/Users/mash/Downloads/sftdlib-master/sample/sftd_sample.elf] Error 1
make: *** [build] Error 2
iMash:sample mash$
 

Garcia98

Hey! Listen!
Member
Joined
Sep 8, 2015
Messages
361
Trophies
0
Location
Salamanca
Website
github.com
XP
267
Country
Actually I put -mfloat-abi-soft, but I've just changed it to softfp and got the same error:

Code:
iMash:sample mash$ make
FreeSans.ttf
main.c
arm-none-eabi-gcc -MMD -MP -MF /Users/mash/Downloads/sftdlib-master/sample/build/main.d -g -Wall -O2 -mword-relocations -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mfloat-abi=softfp -I/Users/mash/Downloads/sftdlib-master/sample/include -I/opt/devkitPro/libctru/include -I/opt/devkitPro/portlibs/armv6k/include -I/opt/devkitPro/portlibs/3ds/include -I/Users/mash/Downloads/sftdlib-master/sample/build -DARM11 -D_3DS -c /Users/mash/Downloads/sftdlib-master/sample/source/main.c -o main.o
linking sftd_sample.elf
/opt/devkitPro/devkitARM/bin/../lib/gcc/arm-none-eabi/4.9.2/../../../../arm-none-eabi/bin/ld: cannot find 3dsx_crt0.o: No such file or directory
collect2: error: ld returned 1 exit status
make[1]: *** [/Users/mash/Downloads/sftdlib-master/sample/sftd_sample.elf] Error 1
make: *** [build] Error 2
iMash:sample mash$

Lol, you must use hard

Why do you modify things in the example? The example will compile correctly if your environment is properly set
 

mashers

Stubborn ape
OP
Member
Joined
Jun 10, 2015
Messages
3,837
Trophies
0
Age
40
Location
Kongo Jungle
XP
5,074
Country
Well I've just extracted sftdlib from the github archive again and got exactly the same errors ("VFP register arguments" errors when using hard float, "cannot find 3dsx_crt0.o" when using softfp).
 

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,032
Country
United States
After changing the float from soft to hard you need to rebuild everything. Libraries and your project - make clean && make
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    I @ idonthave: :)