Another Sdl_image Compile Problem


chimpoid

Member
Joined
Jan 15, 2006
Messages
132
Age
51
Location
Scotland
Website
Visit site
Hi all,

I finally figured out the setup for compiling with image, mixer etc. in SDL but on running make I am getting the following errors.
Functions seem ok and the files are being found now but I am worried that my SDL image lib might be chewed. Can anyone shed any light on this?

Code:
garhol@ubuntu:~/gpdev/whack$ make
/usr/local/devkitPro/devkitGP2X/bin/arm-linux-g++ -static -o whack.gpe main.o `/usr/local/devkitPro/devkitGP2X/bin/arm-linux-sdl-config --libs` -lSDLmain -lSDL_image -lSDL_mixer -lSDL_ttf
/usr/local/devkitPro/devkitGP2X//lib/libSDL_image.a(IMG_jpg.o): In function `IMG_LoadJPG_RW':
/usr/local/gp2x/libs-gp2x/SDL_image/IMG_jpg.c:206: undefined reference to `jpeg_std_error'
/usr/local/gp2x/libs-gp2x/SDL_image/IMG_jpg.c:217: undefined reference to `jpeg_CreateDecompress'
/usr/local/gp2x/libs-gp2x/SDL_image/IMG_jpg.c:219: undefined reference to `jpeg_read_header'
/usr/local/gp2x/libs-gp2x/SDL_image/IMG_jpg.c:230: undefined reference to `jpeg_calc_output_dimensions'
/usr/local/gp2x/libs-gp2x/SDL_image/IMG_jpg.c:247: undefined reference to `jpeg_start_decompress'
/usr/local/gp2x/libs-gp2x/SDL_image/IMG_jpg.c:253: undefined reference to `jpeg_finish_decompress'
/usr/local/gp2x/libs-gp2x/SDL_image/IMG_jpg.c:257: undefined reference to `jpeg_destroy_decompress'
/usr/local/gp2x/libs-gp2x/SDL_image/IMG_jpg.c:251: undefined reference to `jpeg_read_scanlines'
/usr/local/gp2x/libs-gp2x/SDL_image/IMG_jpg.c:211: undefined reference to `jpeg_destroy_decompress'
/usr/local/gp2x/libs-gp2x/SDL_image/IMG_jpg.c:159: undefined reference to `jpeg_resync_to_restart'
/usr/local/devkitPro/devkitGP2X//lib/libSDL_image.a(IMG_png.o): In function `IMG_isPNG':
/usr/local/gp2x/libs-gp2x/SDL_image/IMG_png.c:86: undefined reference to `png_sig_cmp'
/usr/local/devkitPro/devkitGP2X//lib/libSDL_image.a(IMG_png.o): In function `png_read_data':
/usr/local/gp2x/libs-gp2x/SDL_image/IMG_png.c:94: undefined reference to `png_get_io_ptr'
/usr/local/devkitPro/devkitGP2X//lib/libSDL_image.a(IMG_png.o): In function `IMG_LoadPNG_RW':
/usr/local/gp2x/libs-gp2x/SDL_image/IMG_png.c:123: undefined reference to `png_create_read_struct'
/usr/local/gp2x/libs-gp2x/SDL_image/IMG_png.c:131: undefined reference to `png_create_info_struct'
/usr/local/gp2x/libs-gp2x/SDL_image/IMG_png.c:281: undefined reference to `png_destroy_read_struct'
/usr/local/gp2x/libs-gp2x/SDL_image/IMG_png.c:147: undefined reference to `png_set_read_fn'
/usr/local/gp2x/libs-gp2x/SDL_image/IMG_png.c:150: undefined reference to `png_read_info'
/usr/local/gp2x/libs-gp2x/SDL_image/IMG_png.c:151: undefined reference to `png_get_IHDR'
/usr/local/gp2x/libs-gp2x/SDL_image/IMG_png.c:155: undefined reference to `png_set_strip_16'
/usr/local/gp2x/libs-gp2x/SDL_image/IMG_png.c:160: undefined reference to `png_set_packing'
/usr/local/gp2x/libs-gp2x/SDL_image/IMG_png.c:169: undefined reference to `png_get_valid'
/usr/local/gp2x/libs-gp2x/SDL_image/IMG_png.c:198: undefined reference to `png_read_update_info'
/usr/local/gp2x/libs-gp2x/SDL_image/IMG_png.c:200: undefined reference to `png_get_IHDR'
/usr/local/gp2x/libs-gp2x/SDL_image/IMG_png.c:250: undefined reference to `png_read_image'
/usr/local/gp2x/libs-gp2x/SDL_image/IMG_png.c:172: undefined reference to `png_get_tRNS'
/usr/local/gp2x/libs-gp2x/SDL_image/IMG_png.c:189: undefined reference to `png_set_expand'
/usr/local/gp2x/libs-gp2x/SDL_image/IMG_png.c:164: undefined reference to `png_set_expand'
/usr/local/gp2x/libs-gp2x/SDL_image/IMG_png.c:196: undefined reference to `png_set_gray_to_rgb'
collect2: ld returned 1 exit status
make: *** [whack.gpe] Error 1

Thanks

Chimpoid
 
I finally figured out the setup for compiling with image, mixer etc. in SDL but on running make I am getting the following errors.
Functions seem ok and the files are being found now but I am worried that my SDL image lib might be chewed. Can anyone shed any light on this?

Those errors show that at link-time, your linker couldn't find the JPEG and PNG libraries that SDL_image depends on. Have you got them as well?
 
Last edited by a moderator:
Yeah, libjpeg.a, libjpeg.la & ...hang on....
My libpng.so is linked to /usr/local/devkitPro/devkitGP2X/lib/libpng.so.3.1.2.8 and the file I have is /usr/local/devkitPro/devkitGP2X/lib/libpng.so.0.1.2.8

I will try relinking it this afternoon.

Chimpoid
 
Bah, nothing :(
Might try and remove the dev environment altogther and re-install. I'm sure my monkeying about is causing 95% of the problems.

Chimpoid
 
Ran the script to install the toolchain and it locked up and cooked my filesystem :)
Compiling from a standard makefile as follows

Code:
CROSS_COMPILE = /usr/local/devkitPro/devkitGP2X/bin/arm-linux-
SDL_BASE = /usr/local/devkitPro/devkitGP2X/bin/arm-linux-
LDFLAGS = -static

CC = $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++
STRIP = $(CROSS_COMPILE)strip

CFLAGS = `$(SDL_BASE)sdl-config --cflags` -O2 -Wall 
CXXFLAGS = `$(SDL_BASE)sdl-config --cflags` -O2 -Wall 
LIBS = `$(SDL_BASE)sdl-config --libs`
STATIC_LIBS = -lSDLmain -lSDL_image -lSDL_mixer -lSDL_ttf

SDLTEST_TARGET = whack.gpe
SDLTEST_OBJS = main.o

ALL_TARGETS = $(SDLTEST_TARGET) 

all : $(ALL_TARGETS)

$(SDLTEST_TARGET) : $(SDLTEST_OBJS)
	$(CXX) $(LDFLAGS) -o $(SDLTEST_TARGET) $(SDLTEST_OBJS) $(LIBS) $(STATIC_LIBS)
	$(STRIP) $(SDLTEST_TARGET)

clean:
	rm -f $(ALL_TARGETS) *.o *~

-lSDLmain should come last maybe?
Reinstalling devkit just now and will try again.

Chimpoid
 
Just finshed a complete reinstall with threebots libs.

I tried adding -lpng and -ljpeg to the start of the static definition and it game me
Code:
garhol@ubuntu:~/gpdev/whack$ make
/usr/local/devkitPro/devkitGP2X/bin/arm-linux-g++ -static -o whack.gpe main.o `/usr/local/devkitPro/devkitGP2X/bin/arm-linux-sdl-config --libs` -ljpeg -lpng -lSDL_image
/usr/local/devkitPro/devkitGP2X//lib/libSDL_image.a(IMG_jpg.o): In function `jpeg_SDL_RW_src':
IMG_jpg.c:(.text+0x38c): undefined reference to `jpeg_resync_to_restart'
/usr/local/devkitPro/devkitGP2X//lib/libSDL_image.a(IMG_jpg.o): In function `IMG_LoadJPG_RW':
IMG_jpg.c:(.text+0x41c): undefined reference to `jpeg_std_error'
IMG_jpg.c:(.text+0x45c): undefined reference to `jpeg_destroy_decompress'
IMG_jpg.c:(.text+0x490): undefined reference to `jpeg_CreateDecompress'
IMG_jpg.c:(.text+0x4b0): undefined reference to `jpeg_read_header'
IMG_jpg.c:(.text+0x4cc): undefined reference to `jpeg_calc_output_dimensions'
IMG_jpg.c:(.text+0x53c): undefined reference to `jpeg_start_decompress'
IMG_jpg.c:(.text+0x588): undefined reference to `jpeg_read_scanlines'
IMG_jpg.c:(.text+0x5a4): undefined reference to `jpeg_finish_decompress'
IMG_jpg.c:(.text+0x5b0): undefined reference to `jpeg_destroy_decompress'
/usr/local/devkitPro/devkitGP2X//lib/libSDL_image.a(IMG_png.o): In function `IMG_isPNG':
IMG_png.c:(.text+0x60): undefined reference to `png_sig_cmp'
/usr/local/devkitPro/devkitGP2X//lib/libSDL_image.a(IMG_png.o): In function `png_read_data':
IMG_png.c:(.text+0xa8): undefined reference to `png_get_io_ptr'
/usr/local/devkitPro/devkitGP2X//lib/libSDL_image.a(IMG_png.o): In function `IMG_LoadPNG_RW':
IMG_png.c:(.text+0x144): undefined reference to `png_create_read_struct'
IMG_png.c:(.text+0x170): undefined reference to `png_create_info_struct'
IMG_png.c:(.text+0x1c8): undefined reference to `png_set_read_fn'
IMG_png.c:(.text+0x1dc): undefined reference to `png_read_info'
IMG_png.c:(.text+0x224): undefined reference to `png_get_IHDR'
IMG_png.c:(.text+0x230): undefined reference to `png_set_strip_16'
IMG_png.c:(.text+0x23c): undefined reference to `png_set_packing'
IMG_png.c:(.text+0x254): undefined reference to `png_set_expand'
IMG_png.c:(.text+0x26c): undefined reference to `png_get_valid'
IMG_png.c:(.text+0x2a0): undefined reference to `png_get_tRNS'
IMG_png.c:(.text+0x34c): undefined reference to `png_set_expand'
IMG_png.c:(.text+0x370): undefined reference to `png_set_gray_to_rgb'
IMG_png.c:(.text+0x384): undefined reference to `png_read_update_info'
IMG_png.c:(.text+0x3cc): undefined reference to `png_get_IHDR'
IMG_png.c:(.text+0x618): undefined reference to `png_read_image'
IMG_png.c:(.text+0x810): undefined reference to `png_destroy_read_struct'
collect2: ld returned 1 exit status
make: *** [whack.gpe] Error 1



Adding them after -lSDL_image gives
Code:
 make
/usr/local/devkitPro/devkitGP2X/bin/arm-linux-g++ -static -o whack.gpe main.o `/ usr/local/devkitPro/devkitGP2X/bin/arm-linux-sdl-config --libs` -lSDL_image -ljp eg -lpng
/usr/local/devkitPro/devkitGP2X//lib/libpng.a(png.o): In function `png_reset_crc ':
png.c:(.text+0x118): undefined reference to `crc32'
/usr/local/devkitPro/devkitGP2X//lib/libpng.a(png.o): In function `png_calculate _crc':
png.c:(.text+0x14c): undefined reference to `crc32'
png.c:(.text+0x168): undefined reference to `crc32'
/usr/local/devkitPro/devkitGP2X//lib/libpng.a(png.o): In function `png_reset_zst ream':
png.c:(.text+0x4a4): undefined reference to `inflateReset'
/usr/local/devkitPro/devkitGP2X//lib/libpng.a(pngread.o): In function `png_creat e_read_struct_2':
pngread.c:(.text+0x194): undefined reference to `inflateInit_'
/usr/local/devkitPro/devkitGP2X//lib/libpng.a(pngread.o): In function `png_read_ init_3':
pngread.c:(.text+0x3d0): undefined reference to `inflateInit_'
/usr/local/devkitPro/devkitGP2X//lib/libpng.a(pngread.o): In function `png_read_ row':
pngread.c:(.text+0xd20): undefined reference to `inflate'
/usr/local/devkitPro/devkitGP2X//lib/libpng.a(pngread.o): In function `png_read_ destroy':
pngread.c:(.text+0x1dd4): undefined reference to `inflateEnd'
/usr/local/devkitPro/devkitGP2X//lib/libpng.a(pngrutil.o): In function `png_deco mpress_chunk':
pngrutil.c:(.text+0xfc): undefined reference to `inflate'
pngrutil.c:(.text+0x220): undefined reference to `inflateReset'
pngrutil.c:(.text+0x32c): undefined reference to `inflateReset'
/usr/local/devkitPro/devkitGP2X//lib/libpng.a(pngrutil.o): In function `png_read _finish_row':
pngrutil.c:(.text+0x5b98): undefined reference to `inflate'
pngrutil.c:(.text+0x5c24): undefined reference to `inflateReset'
collect2: ld returned 1 exit status
make: *** [whack.gpe] Error 1

Most worrying. I thought that a clean install would work but it seems there is something I am screwing up. It shouldn't be the devkit stuff as it is stock. The only thing I can think is that I am assing up the makefile somewhere along the line.

Thanks
Chimpoid
 
I have a working library line somewhere, I'll find it for you.

EDIT: Your STATIC_LIBS should be "-lSDLmain -lSDL_image -lpng12 -ljpeg -lz -lc -lm -lgcc -lSDL_mixer -lvorbisidec -lmikmod -lSDL -lpthread" (without the quotes)
 
Code:
garhol@ubuntu:~/gpdev/whack$ make
/usr/local/devkitPro/devkitGP2X/bin/arm-linux-g++ -static -o whack.gpe main.o `/usr/local/devkitPro/devkitGP2X/bin/arm-linux-sdl-config --libs` -lSDLmain -lSDL_image -lpng12 -ljpeg -lz -lc -lm -lgcc -lSDL_mixer -lvorbisidec -lmikmod -lSDL -lpthread
/usr/local/devkitPro/devkitGP2X/bin/arm-linux-strip whack.gpe
garhol@ubuntu:~/gpdev/whack$

Nickspoon :D
I'm gonna make a little poster of you surrounded by lights and sparkles and post it on my fridge. Then every day when I wake up I'll remember just how much you rock.

Thanks
Chimpoid
 
Back
Top