Compiling latest version of SDL test programs (in Linux)

OK, I’ve been having some trouble for some time with this. The following
is exactly what I’ve typed:

hg clone http://hg.libsdl.org/SDL
cd SDL
mkdir BUILD
cd BUILD
cmake …
make (compiles without errors)
sudo make install (installs fine in /usr/local)

Next, I try to compile the test programs, as follows:

cd …/test
./configure
make

This results in multiple errors “/usr/bin/ld: cannot find -lSDL2_test”. It
seems that this library is needed, but it isn’t being built. Can someone
explain how to fix this issue?

Thanks,
Steve A.
Stella maintainer

I suppose the cmake build project (experimental) has not been updated
for SDL2_test yet. The official autoconf/automake route will work though.


cd BUILD
…/configure
make
sudo make install
…On 6/27/2013 12:42 PM, Stephen Anthony wrote:

OK, I’ve been having some trouble for some time with this. The
following is exactly what I’ve typed:

hg clone http://hg.libsdl.org/SDL

cd SDL

mkdir BUILD

cd BUILD

cmake …

make (compiles without errors)

sudo make install (installs fine in /usr/local)

Next, I try to compile the test programs, as follows:

cd …/test

./configure

make

This results in multiple errors “/usr/bin/ld: cannot find
-lSDL2_test”. It seems that this library is needed, but it isn’t being
built. Can someone explain how to fix this issue?

Thanks,

Steve A.

Stella maintainer


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Have you tried your computer after SDL installation or at least run
sudo ldconfig

SDL2_test is compiled as a static lib and wouldn’t require this step.

i.e.

make install


/usr/bin/install -c -m 644 build/libSDL2_test.a
/usr/local/lib/libSDL2_test.a
ranlib /usr/local/lib/libSDL2_test.a

Maybe someone who is familiar with the SDL cmake setup and could create
a patch.

Here is the automake/config setup for the SDL2_test lib:
configure.in
SDLTEST_SOURCES="$srcdir/src/test/*.c"
SDLTEST_OBJECTS=echo $SDLTEST_SOURCES
SDLTEST_DEPENDS=echo $SDLTEST_SOURCES
SDLTEST_OBJECTS=echo "$SDLTEST_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'
SDLTEST_DEPENDS=echo "$SDLTEST_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\ \\$(objects)/\\2.o: \\1/\\2.c\\\\ \\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"

Makefile.in
SDLTEST_TARGET = libSDL2_test.a
SDLTEST_OBJECTS = @SDLTEST_OBJECTS@
SDLTEST_HDRS = $(shell ls $(srcdir)/include | fgrep SDL_test)
$(objects)/$(SDLTEST_TARGET): $(SDLTEST_OBJECTS)
$(AR) cru $@ $(SDLTEST_OBJECTS)
$(RANLIB) $@On 6/27/2013 6:41 PM, Aggelos Kolaitis wrote:

Have you tried your computer after SDL installation or at least run
sudo ldconfig


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Some of the test programs fail with the latest hg update, in particular
teststreaming (which is exactly the functionality I need for my project).

Running through gdb seems to indicate problems with getting/setting an
error, and TLS. Maybe this is related to the latest TLS stuff??

The gdb log is as follows (both SDL and the test programs compiled with -
g):

(gdb) bt 20
#0 0x00007ffff7a989bc in SDL_SetError (fmt=<error reading variable: Cannot
access memory at address 0x7fffff7fefe8>)
at /home/stephen/src/SDL/src/SDL_error.c:54
#1 0x00007ffff7ba927b in SDL_TLSSet (id=1, value=0x17de890) at
/home/stephen/src/SDL/src/thread/pthread/SDL_systls.c:75
#2 0x00007ffff7b28cb5 in SDL_GetErrBuf () at
/home/stephen/src/SDL/src/thread/SDL_thread.c:62
#3 0x00007ffff7a989dc in SDL_SetError (fmt=0x7ffff7bbae9f “Parameter ‘%s’ is
invalid”) at /home/stephen/src/SDL/src/SDL_error.c:62
#4 0x00007ffff7ba927b in SDL_TLSSet (id=1, value=0x17de580) at
/home/stephen/src/SDL/src/thread/pthread/SDL_systls.c:75
#5 0x00007ffff7b28cb5 in SDL_GetErrBuf () at
/home/stephen/src/SDL/src/thread/SDL_thread.c:62
#6 0x00007ffff7a989dc in SDL_SetError (fmt=0x7ffff7bbae9f “Parameter ‘%s’ is
invalid”) at /home/stephen/src/SDL/src/SDL_error.c:62
#7 0x00007ffff7ba927b in SDL_TLSSet (id=1, value=0x17de270) at
/home/stephen/src/SDL/src/thread/pthread/SDL_systls.c:75
#8 0x00007ffff7b28cb5 in SDL_GetErrBuf () at
/home/stephen/src/SDL/src/thread/SDL_thread.c:62
#9 0x00007ffff7a989dc in SDL_SetError (fmt=0x7ffff7bbae9f “Parameter ‘%s’ is
invalid”) at /home/stephen/src/SDL/src/SDL_error.c:62
#10 0x00007ffff7ba927b in SDL_TLSSet (id=1, value=0x17ddf60) at
/home/stephen/src/SDL/src/thread/pthread/SDL_systls.c:75
#11 0x00007ffff7b28cb5 in SDL_GetErrBuf () at
/home/stephen/src/SDL/src/thread/SDL_thread.c:62
#12 0x00007ffff7a989dc in SDL_SetError (fmt=0x7ffff7bbae9f “Parameter ‘%s’ is
invalid”) at /home/stephen/src/SDL/src/SDL_error.c:62
#13 0x00007ffff7ba927b in SDL_TLSSet (id=1, value=0x17ddc50) at
/home/stephen/src/SDL/src/thread/pthread/SDL_systls.c:75
#14 0x00007ffff7b28cb5 in SDL_GetErrBuf () at
/home/stephen/src/SDL/src/thread/SDL_thread.c:62
#15 0x00007ffff7a989dc in SDL_SetError (fmt=0x7ffff7bbae9f “Parameter ‘%s’ is
invalid”) at /home/stephen/src/SDL/src/SDL_error.c:62
#16 0x00007ffff7ba927b in SDL_TLSSet (id=1, value=0x17dd940) at
/home/stephen/src/SDL/src/thread/pthread/SDL_systls.c:75
#17 0x00007ffff7b28cb5 in SDL_GetErrBuf () at
/home/stephen/src/SDL/src/thread/SDL_thread.c:62
#18 0x00007ffff7a989dc in SDL_SetError (fmt=0x7ffff7bbae9f “Parameter ‘%s’ is
invalid”) at /home/stephen/src/SDL/src/SDL_error.c:62
#19 0x00007ffff7ba927b in SDL_TLSSet (id=1, value=0x17dd630) at
/home/stephen/src/SDL/src/thread/pthread/SDL_systls.c:75
(More stack frames follow…)

Sorry to respond to myself. Going back to the 7390 changeset (before TLS
stuff was added) fixes the teststreaming issue.

Thanks,
Steve A.
Stella maintainerOn July 10, 2013 11:48:01 AM Stephen Anthony wrote:

Some of the test programs fail with the latest hg update, in particular
teststreaming (which is exactly the functionality I need for my
project).

Running through gdb seems to indicate problems with getting/setting an
error, and TLS. Maybe this is related to the latest TLS stuff??

There’s a circular dependency problem in the code.

SDL_TLSSet fails, then -> SDL_SetError -> SDL_GetErrBuf -> SDL_TLSSet ->
and the loop goes on

My fix would be removing the SDL_SetError related functions from SDL_TLSSet
and just return -1, but let’s see what Sam thinks.

2013/7/10 Stephen Anthony > On July 10, 2013 11:48:01 AM Stephen Anthony wrote:

Some of the test programs fail with the latest hg update, in particular
teststreaming (which is exactly the functionality I need for my
project).

Running through gdb seems to indicate problems with getting/setting an
error, and TLS. Maybe this is related to the latest TLS stuff??

Sorry to respond to myself. Going back to the 7390 changeset (before TLS
stuff was added) fixes the teststreaming issue.

Thanks,
Steve A.
Stella maintainer


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Gabriel.

This bug is filed heret: http://bugzilla.libsdl.org/show_bug.cgi?id=1954

2013/7/10 Stephen Anthony > On July 10, 2013 11:48:01 AM Stephen Anthony wrote:

Some of the test programs fail with the latest hg update, in particular
teststreaming (which is exactly the functionality I need for my
project).

Running through gdb seems to indicate problems with getting/setting an
error, and TLS. Maybe this is related to the latest TLS stuff??

Sorry to respond to myself. Going back to the 7390 changeset (before TLS
stuff was added) fixes the teststreaming issue.

Thanks,
Steve A.
Stella maintainer


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Gabriel.

This should be fixed in this changeset:

Please let me know if there are any issues!On Wed, Jul 10, 2013 at 7:40 AM, Gabriel Jacobo wrote:

There’s a circular dependency problem in the code.

SDL_TLSSet fails, then -> SDL_SetError -> SDL_GetErrBuf -> SDL_TLSSet ->
and the loop goes on

My fix would be removing the SDL_SetError related functions from
SDL_TLSSet and just return -1, but let’s see what Sam thinks.

2013/7/10 Stephen Anthony

On July 10, 2013 11:48:01 AM Stephen Anthony wrote:

Some of the test programs fail with the latest hg update, in particular
teststreaming (which is exactly the functionality I need for my
project).

Running through gdb seems to indicate problems with getting/setting an
error, and TLS. Maybe this is related to the latest TLS stuff??

Sorry to respond to myself. Going back to the 7390 changeset (before TLS
stuff was added) fixes the teststreaming issue.

Thanks,
Steve A.
Stella maintainer


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Gabriel.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

It’s now working fine for me.

SteveOn July 10, 2013 11:06:25 PM Sam Lantinga wrote:

This should be fixed in this changeset:
http://hg.libsdl.org/SDL/rev/358696c354a8

Please let me know if there are any issues!