SDL_image & libtiff

Hi,

When configuring SDL_image with libtiff, libtiff wasn’t found in my case.
I solved the problem by adding: ‘LIBS="$LIBS $IMG_LIBS"’ after line 163
of configure.in (‘if test x$enable_tif = xyes; then’).
I guess the problem is that my libtiff is a static lib, I didn’t bother
to create the shared one, and that libtiff depends on libjpeg and libz.

I also guess that other static libraries (like possibly libpng) might
share (sic) this problem.

If I have a time, I’ll review the configure.in and post a patch (don’t
use my solution above, it’s ugly !)

Julien

Quoting Julien Lecomte :

Hi,

When configuring SDL_image with libtiff, libtiff wasn’t found in my case.
I solved the problem by adding: ‘LIBS="$LIBS $IMG_LIBS"’ after line 163
of configure.in (‘if test x$enable_tif = xyes; then’).
I guess the problem is that my libtiff is a static lib, I didn’t bother
to create the shared one, and that libtiff depends on libjpeg and libz.
you can try with

export CFLAGS=-I/usr/MyLibTiff/include
export LDFLAGS=-L/usr/MyLibTiff/lib -ltiff

Cheers,
Michael

Attached is a patch that modifies configure.in and makefile.am for
SDL_image.
Changes are:

  • Checks for dependency libs before checking for other libraries (z is
    checked before png, z and jpeg are checked before tiff) which was the
    fix I was targetting (at the start)

  • IMG_LIBS was removed and LIBS was used instead, which facilitates the
    search of libraries.

  • Changed CFLAGS for EXTRA_CFLAGS. This allows environment CFLAGS to be
    overwritten during make (ie. export CFLAGS="-g -O0" && ./configure &&
    make CFLAGS="-O3").

  • Some reorganization, replaced deprecated AC_* calls and redundant ones
    (ie. AC_PROG_INSTALL is called by AM_INIT_AUTOMAKE)

Of note:

  • Setting ‘ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc’
    for `$host != $build’ on a cygwin/mingw host seems quite hazardous.
    What happens if you’re on Linux trying to cross compile with a mingw
    cross compiler ? Why overwrite the default prefix, especially with a
    non-standard path ?

  • I can’t get -lpng to show up in ‘dependency_libs’ in libSDL_image.la.
    This might be a libtool bug (I’m using 1.5.22 and had regenerated ltmain.sh)

  • Why does `sdl-config --libs’ show a path (/mingw/lib in my case) that
    afterwards is put in libSDL_image.la ?

Otherwise, I don’t think I broke anything :wink:
Julien
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed…
Name: sdl-image.patch
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20060426/e9236449/attachment.ascOn 26/04/2006 13:43, I wrote:

When configuring SDL_image with libtiff, libtiff wasn’t found in my case.
I solved the problem by adding: ‘LIBS="$LIBS $IMG_LIBS"’ after line 163
of configure.in (‘if test x$enable_tif = xyes; then’).
I guess the problem is that my libtiff is a static lib, I didn’t bother
to create the shared one, and that libtiff depends on libjpeg and libz.

I also guess that other static libraries (like possibly libpng) might
share (sic) this problem.

If I have a time, I’ll review the configure.in and post a patch (don’t
use my solution above, it’s ugly !)

Attached is a patch that modifies configure.in and makefile.am for
SDL_image.
Changes are:

  • Checks for dependency libs before checking for other libraries (z is
    checked before png, z and jpeg are checked before tiff) which was the
    fix I was targetting (at the start)

This is in subversion, thanks!

You can try out the snapshot here:
http://www.libsdl.org/tmp/SDL_image-1.2.5.tar.gz

  • IMG_LIBS was removed and LIBS was used instead, which facilitates the
    search of libraries.

I left this as-is, since I wanted the image libraries to be linked
directly with the SDL_image library, but indirectly (if necessary)
to showimage.

  • Changed CFLAGS for EXTRA_CFLAGS. This allows environment CFLAGS to be
    overwritten during make (ie. export CFLAGS="-g -O0" && ./configure &&
    make CFLAGS="-O3").

Your change forced automake to include the compile script and generate
some really messy build rules. I used AC_DEFINE instead.

  • Some reorganization, replaced deprecated AC_* calls and redundant ones
    (ie. AC_PROG_INSTALL is called by AM_INIT_AUTOMAKE)

I agree this is a good idea, but it should probably be done for all
the SDL* libraries in a single sweep.

Of note:

  • Setting ‘ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc’
    for `$host != $build’ on a cygwin/mingw host seems quite hazardous.
    What happens if you’re on Linux trying to cross compile with a mingw
    cross compiler ? Why overwrite the default prefix, especially with a
    non-standard path ?

It was actually done for cross compiling from Linux to mingw, and the
path listed is the install path for my cross-compilation package. :slight_smile:
Without that, it gets installed to /usr/local, overwriting my native
install. :slight_smile:

Also, I reverted your change to remove SDL_CFLAGS and SDL_LIBS from
the CFLAGS and LIBS used in configure.in. This is necessary to use
the mingw environment on a cygwin install.

  • Why does `sdl-config --libs’ show a path (/mingw/lib in my case) that
    afterwards is put in libSDL_image.la ?

I’m not sure… I think it’s the SDL library install path, -rpath style.

Thanks! :slight_smile:

-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment

Attached is a patch that modifies configure.in and makefile.am for
SDL_image.

Changes are:

  • Changed CFLAGS for EXTRA_CFLAGS. This allows environment CFLAGS to be
    overwritten during make (ie. export CFLAGS="-g -O0" && ./configure
    && make CFLAGS="-O3").

Your change forced automake to include the compile script and generate
some really messy build rules. I used AC_DEFINE instead.
I get your point; the verbose of automake also becomes quite awfull.

  • Some reorganization, replaced deprecated AC_* calls and redundant
    ones (ie. AC_PROG_INSTALL is called by AM_INIT_AUTOMAKE)

I agree this is a good idea, but it should probably be done for all
the SDL* libraries in a single sweep.
It’s a daunting task, especially if trying not to break anything. I also
noticed that libTool (2.1 alpha) removes the unnecessary C++ and fortran
checks. I can’t wait for it to released…

Of note:

  • Setting
    ’ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc’ for `$host
    != $build’ on a cygwin/mingw host seems quite hazardous.

What happens if you’re on Linux trying to cross compile with a mingw
cross compiler ? Why overwrite the default prefix, especially with a
non-standard path ?

It was actually done for cross compiling from Linux to mingw, and the
path listed is the install path for my cross-compilation package. :slight_smile:
Without that, it gets installed to /usr/local, overwriting my native
install. :slight_smile:

I think you should use a prefix such as ‘/usr/i686-pc-mingw32’ (or
whatever the prefix is for a msvc compiler), but I haven’t tried
x-compiling SDL or a SDL app from my gnu-linux (although I do have a
mingw x-compiler installed on it).

I wonder how sdl-config behaves in a cross-compiler environment, since
no ‘i686-pc-mingw32-sdl-config’ is created.

JulienOn 01/05/2006 11:16, Sam Lantinga wrote: