I've been able to use mingw-cross-env to cross-compile a SDL-based application. However, I tried using a function from the SDL_image library, and I get a link error.
At first I installed package sdl, then later on I installed package sdl_image. >From what I remember, it brought some other packages (libpng, jpeg, tiff at least, maybe some others).
386-mingw32msvc-g++ -g -O2 -o ube.exe ube.o ../engine/libube-engine.a libube-client.a -llua -lm -lintl -liconv -L/home/phtrivier/sandbox/src/mingw-cross-env-2.8/usr/i386-mingw32msvc/lib -lmingw32 -lSDLmain -lSDL -lwinmm -mwindows -lSDL_image
The library SDL_image was properly installed in /home/phtrivier/sandbox/src/mingw-cross-env-2.8/usr/i386-mingw32msvc/lib, I have files :
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/usr/i386-mingw32msvc/lib/libSDL_image.a(IMG_jpg.o): In function `IMG_InitJPG':
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_jpg.c:145: undefined reference to `_jpeg_calc_output_dimensions'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_jpg.c:146: undefined reference to `_jpeg_CreateDecompress'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_jpg.c:147: undefined reference to `_jpeg_destroy_decompress'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_jpg.c:148: undefined reference to `_jpeg_finish_decompress'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_jpg.c:149: undefined reference to `_jpeg_read_header'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_jpg.c:150: undefined reference to `_jpeg_read_scanlines'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_jpg.c:151: undefined reference to `_jpeg_resync_to_restart'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_jpg.c:152: undefined reference to `_jpeg_start_decompress'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_jpg.c:153: undefined reference to `_jpeg_std_error'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/usr/i386-mingw32msvc/lib/libSDL_image.a(IMG_png.o): In function `IMG_InitPNG':
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_png.c:233: undefined reference to `_png_create_info_struct'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_png.c:234: undefined reference to `_png_create_read_struct'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_png.c:235: undefined reference to `_png_destroy_read_struct'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_png.c:236: undefined reference to `_png_get_IHDR'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_png.c:237: undefined reference to `_png_get_io_ptr'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_png.c:238: undefined reference to `_png_get_tRNS'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_png.c:239: undefined reference to `_png_get_valid'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_png.c:240: undefined reference to `_png_read_image'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_png.c:241: undefined reference to `_png_read_info'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_png.c:242: undefined reference to `_png_read_update_info'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_png.c:243: undefined reference to `_png_set_expand'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_png.c:244: undefined reference to `_png_set_gray_to_rgb'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_png.c:245: undefined reference to `_png_set_packing'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_png.c:246: undefined reference to `_png_set_read_fn'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_png.c:247: undefined reference to `_png_set_strip_16'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_png.c:248: undefined reference to `_png_sig_cmp'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/usr/i386-mingw32msvc/lib/libSDL_image.a(IMG_tif.o): In function `IMG_InitTIF':
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_tif.c:105: undefined reference to `_TIFFClientOpen'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_tif.c:106: undefined reference to `_TIFFClose'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_tif.c:107: undefined reference to `_TIFFGetField'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_tif.c:108: undefined reference to `_TIFFReadRGBAImage'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_tif.c:109: undefined reference to `_TIFFSetErrorHandler'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_tif.c:105: undefined reference to `_TIFFClientOpen'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_tif.c:106: undefined reference to `_TIFFClose'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_tif.c:107: undefined reference to `_TIFFGetField'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_tif.c:108: undefined reference to `_TIFFReadRGBAImage'
/home/phtrivier/sandbox/src/mingw-cross-env-2.8/tmp-sdl_image/SDL_image-1.2.7/IMG_tif.c:109: undefined reference to `_TIFFSetErrorHandler'
collect2: ld returned 1 exit status
I tried a few combinations of manually adding some other libraries (-lpng, -ljpeg, -lz, -ltiff, -ltiffxx ...) but could not come to a set that worked.
Is there something wrong with the way I installed package sdl_image ? Do I need to install something else ? Is there a binary than can produce the proper set of ld flags ?
Thanks
PH