Neo TeAm Forum

The 10th. NEO Project for N64 => The 10th. NEO Project for N64 Dev kit. => N64 development section => Topic started by: vinnyvicious on February 08, 2014, 09:03:51 PM

Title: Problems with libdragon's mksprite
Post by: vinnyvicious on February 08, 2014, 09:03:51 PM
I'm trying to compile libdragon's mksprite on Linux Mint 16, but it fails, as if libpng wasn't installed:

Code: [Select]
cc -std=gnu99 -O2 -Wall -I../../include -lpng    mksprite.c   -o mksprite
/tmp/ccPnKE64.o: In function `read_png':
mksprite.c:(.text+0xf3): undefined reference to `png_create_read_struct'
mksprite.c:(.text+0x10e): undefined reference to `png_create_info_struct'
mksprite.c:(.text+0x136): undefined reference to `png_destroy_read_struct'
mksprite.c:(.text+0x184): undefined reference to `png_init_io'
mksprite.c:(.text+0x191): undefined reference to `png_read_info'
mksprite.c:(.text+0x1c8): undefined reference to `png_get_IHDR'
mksprite.c:(.text+0x2c4): undefined reference to `png_get_valid'
mksprite.c:(.text+0x2e5): undefined reference to `png_set_interlace_handling'
mksprite.c:(.text+0x2f2): undefined reference to `png_read_update_info'
mksprite.c:(.text+0x362): undefined reference to `png_get_rowbytes'
mksprite.c:(.text+0x408): undefined reference to `png_read_image'
mksprite.c:(.text+0x495): undefined reference to `png_set_gray_to_rgb'
mksprite.c:(.text+0x4a5): undefined reference to `png_set_tRNS_to_alpha'
mksprite.c:(.text+0x54f): undefined reference to `png_set_gray_1_2_4_to_8'
mksprite.c:(.text+0x560): undefined reference to `png_set_strip_16'
mksprite.c:(.text+0x56e): undefined reference to `png_set_palette_to_rgb'
collect2: error: ld returned 1 exit status
make[2]: *** [mksprite] Error 1

I have tried installing the libpng package, compiling the 1.2 version from source, as well 1.6. None worked. Any ideas why?
Title: Re: Problems with libdragon's mksprite
Post by: Conle on February 10, 2014, 02:12:51 PM


I have tried installing the libpng package, compiling the 1.2 version from source, as well 1.6. None worked. Any ideas why?

Did you also tried to manually set the lib/inc path in the makefile of the freshly-built-lpng ?(just to be sure that there is no issue with the installation of the library) ?
Title: Re: Problems with libdragon's mksprite
Post by: ChillyWilly on February 19, 2014, 06:17:05 AM
I'm not sure about Mint, but in Ubuntu you need more than libpng, you need libpng-dev, which has all the developer files.
Title: Re: Problems with libdragon's mksprite
Post by: root670 on March 14, 2014, 06:32:04 AM
I figured out how to fix this... the issue resided in the Makefile. After some digging, I was able to make it compile with this makefile:

Code: [Select]
INSTALLDIR = $(N64_INST)
CFLAGS = -std=gnu99 -O2 -Wall -I../../include -lpng

all: mksprite convtool

mksprite: mksprite.c
$(CC) $< -o $@ $(CFLAGS)

convtool: convtool.c
$(CC) $< -o $@ $(CFLAGS)

install: mksprite convtool
install -D --mode=755 mksprite $(INSTALLDIR)/bin
install -D --mode=755 convtool $(INSTALLDIR)/bin

.PHONY: clean install

clean:
rm -rf mksprite
rm -rf convtool


Basically, remove -Werror from the CFLAGS variable and add the lines under mksprite and convtool.
Title: Re: Problems with libdragon's mksprite
Post by: ChillyWilly on March 14, 2014, 07:46:54 PM
-Werror is a good way to catch errors for correction, but there are times when it's just a pain. This seems to be one of them. It looks like it's not finding the protos during the compile, but IS finding them later in the link stage. Weird...
 ???
Title: Re: Problems with libdragon's mksprite
Post by: sanni on July 11, 2014, 05:41:58 PM
Thank you so much for this solution.  :)
I was googling for half an hour about how to link lpng correctly since I had the exact same error ... should have searched here first instead  ~sm-79.gif~.gif
Title: Re: Problems with libdragon's mksprite
Post by: Faellthinz on December 26, 2014, 07:24:37 PM
Hi guys, ~sm-55.gif~.gif

When i try to compile the examples i get the following error:

/usr/mips64-elf/bin/mips64elf-ld: cannot find -lc

Whats wrong? I tried to check the makefile but it seems ok.

Maybe someone is facing the same problem.
Title: Re: Problems with libdragon's mksprite
Post by: Faellthinz on December 26, 2014, 07:34:16 PM
By the way im on ubuntu 12.04
Title: Re: Problems with libdragon's mksprite
Post by: Conle on December 26, 2014, 08:08:09 PM
Hi guys, ~sm-55.gif~.gif

When i try to compile the examples i get the following error:

/usr/mips64-elf/bin/mips64elf-ld: cannot find -lc

Whats wrong? I tried to check the makefile but it seems ok.

Maybe someone is facing the same problem.

It cannot find libc....Are you sure that you did everything correctly and that your OS setup contains all the required dev packages?