Compiling SDL_image: Unable to find XYZ library

I’m installing SDL_image-1.2.3 from source on a Win98SE system using MSYS.
I’ve already installed the JPEG, PNG, and Zlib libraries from source using
MSYS; libjpeg.a, libpng.a, and libz.a all appear in the /usr/local/lib
directory. libSDL_image.a and SDL_image.dll are created in the
/usr/local/lib directory, but apparently do not include JPEG and PNG
support, which is a serious deficiency in my mind.

What am I missing? Output from ./configure is below. Any assistance is
appreciated. Thanks.

Glenn Carlson

—output from ./configure -----------------
$ ./configure
loading cache ./config.cache
checking host system type… i686-pc-mingw32
checking target system type… i686-pc-mingw32
checking for a BSD compatible install… (cached) /bin/install -c
checking whether build environment is sane… yes
checking whether make sets ${MAKE}… (cached) yes
checking for working aclocal… missing
checking for working autoconf… missing
checking for working automake… missing
checking for working autoheader… missing
checking for working makeinfo… found
checking whether to enable maintainer-specific portions of Makefiles… no
checking build system type… i686-pc-mingw32
checking for ranlib… (cached) ranlib
checking for gcc… (cached) gcc
checking whether the C compiler (gcc ) works… yes
checking whether the C compiler (gcc ) is a cross-compiler… no
checking whether we are using GNU C… (cached) yes
checking whether gcc accepts -g… (cached) yes
checking for ld used by GCC… (cached) e:/mingw/mingw32/bin/ld.exe
checking if the linker (e:/mingw/mingw32/bin/ld.exe) is GNU ld… (cached)
yes
checking for BSD-compatible nm… (cached) /mingw/bin/nm
checking whether ln -s works… (cached) no
checking for dlltool… (cached) dlltool
checking for as… (cached) as
checking for objdump… (cached) objdump
loading cache ./config.cache within ltconfig
checking for object suffix… o
checking for executable suffix… (cached) .exe
checking for gcc option to produce PIC… none
checking if gcc supports -c -o file.o… yes
checking if gcc supports -c -o file.lo… yes
checking if gcc supports -fno-rtti -fno-exceptions … yes
checking if gcc static flag -static works… -static
checking if the linker (e:/mingw/mingw32/bin/ld.exe) is GNU ld… yes
checking whether the linker (e:/mingw/mingw32/bin/ld.exe) supports shared
libraries… yes
checking command to parse /mingw/bin/nm output… ok
checking how to hardcode library paths into programs… immediate
checking for e:/mingw/mingw32/bin/ld.exe option to reload object files… -r
checking dynamic linker characteristics… Win32 ld.exe
checking if libtool supports shared libraries… yes
checking if package supports dlls… yes
checking whether to build shared libraries… yes
checking whether to build static libraries… yes
checking for objdir… .libs
creating libtool
loading cache ./config.cache
checking whether make sets ${MAKE}… (cached) yes
checking for gcc… (cached) gcc
checking whether the C compiler (gcc -g -O2 ) works… yes
checking whether the C compiler (gcc -g -O2 ) is a cross-compiler… no
checking whether we are using GNU C… (cached) yes
checking whether gcc accepts -g… (cached) yes
checking for inline… (cached) inline
checking for a BSD compatible install… /bin/install -c
./configure: ./: is a directory
checking for sdl-config… (cached) /usr/local/bin/sdl-config
checking for SDL - version >= 1.2.4… GetModuleHandleA succeed

LoadLibrary returns baaa0000
yes
checking for jpeg_CreateDecompress in -ljpeg… (cached) no
configure: warning:
*** Unable to find JPEG library (http://www.ijg.org/)

configure: warning: JPG image loading disabled
checking for png_create_read_struct in -lpng… (cached) no
configure: warning:
*** Unable to find PNG library (http://www.libpng.org/pub/png/libpng.html)

checking for uncompress in -lz… (cached) no
configure: warning:
*** Unable to find Zlib library (http://www.gzip.org/zlib/)

configure: warning: PNG image loading disabled
creating ./config.status
creating Makefile
creating SDL_image.spec---------------------

What am I missing? Output from ./configure is below. Any assistance is
appreciated. Thanks.

checking for jpeg_CreateDecompress in -ljpeg… (cached) no
configure: warning:
*** Unable to find JPEG library (http://www.ijg.org/)

configure: warning: JPG image loading disabled
checking for png_create_read_struct in -lpng… (cached) no
configure: warning:
*** Unable to find PNG library (http://www.libpng.org/pub/png/libpng.html)

checking for uncompress in -lz… (cached) no
configure: warning:
*** Unable to find Zlib library (http://www.gzip.org/zlib/)

configure: warning: PNG image loading disabled

Try removing the file config.cache, and re-run configure. If you ran configure before installing jpeg/z/png, it caches the results of those library checks into the config.cache file so if you run configure again it goes faster. (At least I think that’s the reason, though it seems kinda silly to me :). You can tell this is happening by the fact that “(cached)” appears in the line “checking for…”. So just remove that file, configure, compile/install, and hopefully it’ll work!

-Mike

Just as I was about to declare victory -----

Deleting config.cache worked exactly as you predicted. Yes, I did run
configure before installing jpeg/z/png. And thanks for the brief tutorial
on how to read the ./configure output. Good info.

But there is still a problem. I was able to complete the SDL_image build,
but I found that the sample program, showimage, was not displaying jpgs.
Gifs, bmps, pcxs worked fine, but no jpgs (I didn’t try pngs). So I try to
reinstall the jpeg libraries and build SDL_image again. I run ‘make
distclean’ and make sure config-cache is not present. ./configure
completes, and the jpeg/z/png libraries are found (right?). But when I run
make, the compilation of IMG_jpg.c fails with “jpeglib.h: No such file or
directory.” The jpeg/z/png header files are in /usr/local/include and the
libraries are in /usr/local/lib, but the compiler doesn’t see them. I can’t
figure out what’s different about then and now.

The configure and make output are below.

Thanks for the help!

Glenn

What am I missing? Output from ./configure is below. Any assistance is
appreciated. Thanks.

checking for jpeg_CreateDecompress in -ljpeg… (cached) no
configure: warning:
*** Unable to find JPEG library (http://www.ijg.org/)

configure: warning: JPG image loading disabled
checking for png_create_read_struct in -lpng… (cached) no
configure: warning:
*** Unable to find PNG library
(http://www.libpng.org/pub/png/libpng.html)

checking for uncompress in -lz… (cached) no
configure: warning:
*** Unable to find Zlib library (http://www.gzip.org/zlib/)

configure: warning: PNG image loading disabled

Try removing the file config.cache, and re-run configure. If you ran
configure before installing
jpeg/z/png, it caches the results of those library checks into the
config.cache file so if you run
configure again it goes faster. (At least I think that’s the reason,
though it seems kinda silly to me :).
You can tell this is happening by the fact that “(cached)” appears in the
line “checking for…”. So
just remove that file, configure, compile/install, and hopefully it’ll
work!

-Mike

– SDL_image configure output --------------
$ ./configure
creating cache ./config.cache
checking host system type… i686-pc-mingw32
checking target system type… i686-pc-mingw32
checking for a BSD compatible install… /bin/install -c
checking whether build environment is sane… yes
checking whether make sets ${MAKE}… yes
checking for working aclocal… missing
checking for working autoconf… missing
checking for working automake… missing
checking for working autoheader… missing
checking for working makeinfo… found
checking whether to enable maintainer-specific portions of Makefiles… no
checking build system type… i686-pc-mingw32
checking for ranlib… ranlib
checking for gcc… gcc
checking whether the C compiler (gcc ) works… yes
checking whether the C compiler (gcc ) is a cross-compiler… no
checking whether we are using GNU C… yes
checking whether gcc accepts -g… yes
checking for ld used by GCC… e:/mingw/mingw32/bin/ld.exe
checking if the linker (e:/mingw/mingw32/bin/ld.exe) is GNU ld… yes
checking for BSD-compatible nm… /mingw/bin/nm
checking whether ln -s works… no
checking for dlltool… dlltool
checking for as… as
checking for objdump… objdump
updating cache ./config.cache
loading cache ./config.cache within ltconfig
checking for object suffix… o
checking for executable suffix… .exe
checking for gcc option to produce PIC… none
checking if gcc supports -c -o file.o… yes
checking if gcc supports -c -o file.lo… yes
checking if gcc supports -fno-rtti -fno-exceptions … yes
checking if gcc static flag -static works… -static
checking if the linker (e:/mingw/mingw32/bin/ld.exe) is GNU ld… yes
checking whether the linker (e:/mingw/mingw32/bin/ld.exe) supports shared
libraries… yes
checking command to parse /mingw/bin/nm output… ok
checking how to hardcode library paths into programs… immediate
checking for e:/mingw/mingw32/bin/ld.exe option to reload object files… -r
checking dynamic linker characteristics… Win32 ld.exe
checking if libtool supports shared libraries… yes
checking if package supports dlls… yes
checking whether to build shared libraries… yes
checking whether to build static libraries… yes
checking for objdir… .libs
creating libtool
updating cache ./config.cache
loading cache ./config.cache
checking whether make sets ${MAKE}… (cached) yes
checking for gcc… (cached) gcc
checking whether the C compiler (gcc -g -O2 ) works… yes
checking whether the C compiler (gcc -g -O2 ) is a cross-compiler… no
checking whether we are using GNU C… (cached) yes
checking whether gcc accepts -g… (cached) yes
checking for inline… inline
checking for a BSD compatible install… /bin/install -c
./configure: ./: is a directory
checking for sdl-config… /usr/local/bin/sdl-config
checking for SDL - version >= 1.2.4… yes
checking for jpeg_CreateDecompress in -ljpeg… yes
checking for png_create_read_struct in -lpng… yes
checking for uncompress in -lz… yes
updating cache ./config.cache
creating ./config.status
creating Makefile
creating SDL_image.spec-------------------------------------

– SDL_image make output --------
$ make
/bin/sh ./libtool --mode=compile
gcc -DPACKAGE=“SDL_image” -DVERSION=“1.2.3” -I. -I. -g -O2 -I/usr/
local/include/SDL -Dmain=SDL_main -DLOAD_BMP -DLOAD_GIF -DLOAD_JPG -DLOAD_LB
M -DLOAD_PCX -DLOAD_PNG -DLOAD_PNM -DLOAD_TGA -DLOAD_XPM -c IMG.c
mkdir .libs
gcc -DPACKAGE=“SDL_image” -DVERSION=“1.2.3” -I. -I. -g -O2 -I/usr/local/
include/SDL -Dmain=SDL_main -DLOAD_BMP -DLOAD_GIF -DLOAD_JPG -DLOAD_LBM -DLO
AD_PCX -DLOAD_PNG -DLOAD_PNM -DLOAD_TGA -DLOAD_XPM -c IMG.c -DPIC -o
.libs/IMG.lo
mv -f .libs/IMG.lo IMG.o
(cd . && ln IMG.o IMG.lo)
/bin/sh ./libtool --mode=compile
gcc -DPACKAGE=“SDL_image” -DVERSION=“1.2.3” -I. -I. -g -O2 -I/usr/
local/include/SDL -Dmain=SDL_main -DLOAD_BMP -DLOAD_GIF -DLOAD_JPG -DLOAD_LB
M -DLOAD_PCX -DLOAD_PNG -DLOAD_PNM -DLOAD_TGA -DLOAD_XPM -c IMG_bmp.c
rm -f .libs/IMG_bmp.lo
gcc -DPACKAGE=“SDL_image” -DVERSION=“1.2.3” -I. -I. -g -O2 -I/usr/local/
include/SDL -Dmain=SDL_main -DLOAD_BMP -DLOAD_GIF -DLOAD_JPG -DLOAD_LBM -DLO
AD_PCX -DLOAD_PNG -DLOAD_PNM -DLOAD_TGA -DLOAD_XPM -c IMG_bmp.c -DPIC -o
.libs/IMG_bmp.lo
mv -f .libs/IMG_bmp.lo IMG_bmp.o
(cd . && ln IMG_bmp.o IMG_bmp.lo)
/bin/sh ./libtool --mode=compile
gcc -DPACKAGE=“SDL_image” -DVERSION=“1.2.3” -I. -I. -g -O2 -I/usr/
local/include/SDL -Dmain=SDL_main -DLOAD_BMP -DLOAD_GIF -DLOAD_JPG -DLOAD_LB
M -DLOAD_PCX -DLOAD_PNG -DLOAD_PNM -DLOAD_TGA -DLOAD_XPM -c IMG_gif.c
rm -f .libs/IMG_gif.lo
gcc -DPACKAGE=“SDL_image” -DVERSION=“1.2.3” -I. -I. -g -O2 -I/usr/local/
include/SDL -Dmain=SDL_main -DLOAD_BMP -DLOAD_GIF -DLOAD_JPG -DLOAD_LBM -DLO
AD_PCX -DLOAD_PNG -DLOAD_PNM -DLOAD_TGA -DLOAD_XPM -c IMG_gif.c -DPIC -o
.libs/IMG_gif.lo
mv -f .libs/IMG_gif.lo IMG_gif.o
(cd . && ln IMG_gif.o IMG_gif.lo)
/bin/sh ./libtool --mode=compile
gcc -DPACKAGE=“SDL_image” -DVERSION=“1.2.3” -I. -I. -g -O2 -I/usr/
local/include/SDL -Dmain=SDL_main -DLOAD_BMP -DLOAD_GIF -DLOAD_JPG -DLOAD_LB
M -DLOAD_PCX -DLOAD_PNG -DLOAD_PNM -DLOAD_TGA -DLOAD_XPM -c IMG_jpg.c
rm -f .libs/IMG_jpg.lo
gcc -DPACKAGE=“SDL_image” -DVERSION=“1.2.3” -I. -I. -g -O2 -I/usr/local/
include/SDL -Dmain=SDL_main -DLOAD_BMP -DLOAD_GIF -DLOAD_JPG -DLOAD_LBM -DLO
AD_PCX -DLOAD_PNG -DLOAD_PNM -DLOAD_TGA -DLOAD_XPM -c IMG_jpg.c -DPIC -o
.libs/IMG_jpg.lo
IMG_jpg.c:35:21: jpeglib.h: No such file or directory
IMG_jpg.c:62: field `pub’ has incomplete type
IMG_jpg.c:66: confused by earlier errors, bailing out
make: *** [IMG_jpg.lo] Error 1


Mmm, actually it seems MSys is configured to only look at mingw/include
by default, and /usr/local/include is not taken into account, unless
explicitely specified as sdl-config does. So you have to move all the
’.h’ in mingw/include (and the .a in mingw/lib), unless somebody has
another suggestion :/–
Sylvain