Compiling SDL_mixer for SDL 1.3

I just decided to update to the latest versions of SDL and SDL_mixer,
which I haven’t done since everything switched to Mercurial. SDL
compiled and installed fine. SDL_mixer gives this error when I run
configure:

checking for SDL - version >= 1.2.10… no
*** Could not run SDL test program, checking why…
*** The test program failed to compile or link. See the file config.log for the
*** exact error that occured. This usually means SDL was incorrectly installed
*** or that you have moved SDL since it was installed. In the latter case, you
*** may want to edit the sdl-config script: /usr/local/bin/sdl-config
configure: error: *** SDL version 1.2.10 not found!

Running
/usr/local/bin/sdl-config --version
gives me
1.3.0

So in configure I changed SDL_VERSION from 1.2.10 to 1.3.0. The new error is:

checking for SDL - version >= 1.3.0… no
*** Could not run SDL test program, checking why…
*** The test program failed to compile or link. See the file config.log for the
*** exact error that occured. This usually means SDL was incorrectly installed
*** or that you have moved SDL since it was installed. In the latter case, you
*** may want to edit the sdl-config script: /usr/local/bin/sdl-config
configure: error: *** SDL version 1.3.0 not found!

I’m stumped. Anyone know how to fix this? On this computer I have
SDL and SDL_mixer installed, but I do not have SDL-devel or
SDL_mixer-devel, so I wouldn’t expect any interference from other
packages.–
Terry Welsh
mogumbo ‘at’ gmail.com
www.reallyslick.com

Terry Welsh writes:

*** The test program failed to compile or link. See the file config.log for the
*** exact error that occured.

Terry, please post the last lines of config.log showing that error.–
Alberto

Alberto, thanks for getting me to look at config.log a bit closer. I
just followed its suggestions to fix the problem. I didn’t have a
PKG_CONFIG_PATH environment variable, so I just created one and ran
./configure and it worked. Should have spotted that before. Should
the creation of PKG_CONFIG_PATH be automated if it doesn’t already
exist?

Just for the sake of completeness, here’s the part of config.log with
the error, but it probably doesn’t matter anymore:

configure:12020: checking for SDL
configure:12028: $PKG_CONFIG --exists --print-errors "sdl >= $min_sdl_version"
Package sdl was not found in the pkg-config search path.
Perhaps you should add the directory containing sdl.pc' to the PKG_CONFIG_PATH environment variable No package 'sdl' found configure:12031: $? = 1 configure:12046: $PKG_CONFIG --exists --print-errors "sdl >= $min_sdl_version" Package sdl was not found in the pkg-config search path. Perhaps you should add the directory containingsdl.pc’
to the PKG_CONFIG_PATH environment variable
No package ‘sdl’ found
configure:12049: $? = 1
No package ‘sdl’ found
configure:12077: result: no
configure:12079: result: no
configure:12121: checking for sdl-config
configure:12139: found /usr/local/bin/sdl-config
configure:12152: result: /usr/local/bin/sdl-config
configure:12161: checking for SDL - version >= 1.2.10
configure:12259: gcc -o conftest -g -O2 -D_GNU_SOURCE=1
-I/usr/local/include/SDL -D_REENTRANT -D_GNU_SOURCE=1 conftest.c
-L/usr/local/lib -Wl,-rpath,/usr/local/lib -lSDL -lpthread >&5
/usr/local/lib/libSDL.so: undefined reference to __sync_fetch_and_sub_4' /usr/local/lib/libSDL.so: undefined reference to__sync_sub_and_fetch_4’
/usr/local/lib/libSDL.so: undefined reference to __sync_fetch_and_add_4' /usr/local/lib/libSDL.so: undefined reference to__sync_add_and_fetch_4’
collect2: ld returned 1 exit status
configure:12262: $? = 1
configure: program exited with status 1
configure: failed program was:
| /* confdefs.h. */–
Terry Welsh
mogumbo ‘at’ gmail.com
www.reallyslick.com

Message: 1
Date: Mon, 13 Sep 2010 11:00:34 +0200
From: Alberto Luaces
To: sdl at libsdl.org
Subject: Re: [SDL] compiling SDL_mixer for SDL 1.3
Message-ID: <87bp826mrx.fsf at eps142.cdf.udc.es>
Content-Type: text/plain; charset=us-ascii

Terry Welsh writes:

*** The test program failed to compile or link. See the file config.log for the
*** exact error that occured.

Terry, please post the last lines of config.log showing that error.


Alberto

Terry Welsh writes:

Alberto, thanks for getting me to look at config.log a bit closer. I
just followed its suggestions to fix the problem. I didn’t have a
PKG_CONFIG_PATH environment variable, so I just created one and ran
./configure and it worked. Should have spotted that before. Should
the creation of PKG_CONFIG_PATH be automated if it doesn’t already
exist?

Usually pkg-config looks for .pc files in the filesystem hierarchy it
was installed (details in the man page). This means 99% of the time
/usr/lib/pkgconfig for most distributions. The PKG_CONFIG_PATH variable
lets you to choose which SDL version you want to use at compile
time. For example, you wanted to use a locally compiled version, but you
could also select the one that comes with your distribution.

I’m glad you solved your problem.–
Alberto