We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 782

Summary: undefined externals in SDL_atomic.c on linux
Product: SDL Reporter: marty leisner <martyleisner>
Component: threadAssignee: Sam Lantinga <slouken>
Status: RESOLVED INVALID QA Contact: Sam Lantinga <slouken>
Severity: critical    
Priority: P2 CC: realburner
Version: HG 2.0   
Hardware: Other   
OS: Linux   

Description marty leisner 2009-08-15 00:16:48 UTC
I get:
cc -pthread -o demo demo.o  -L/usr/local/SDL-svn-4681//lib  -Wl,-rpath,/usr/local/SDL-svn-4681//lib -lSDL -lSDL_ttf
/usr/local/SDL-svn-4681//lib/libSDL.so: undefined reference to `nativeClear32'
/usr/local/SDL-svn-4681//lib/libSDL.so: undefined reference to `nativeTestThenSet32'

I don't know where these would be (and if they should be expanded by the C compiler)
Comment 1 Sam Lantinga 2009-09-26 03:34:24 UTC
Can you retest with the current SDL snapshot?
http://www.libsdl.org/tmp/SDL-1.3.zip

Thanks!
Comment 2 Sam Lantinga 2009-09-26 03:41:03 UTC
*** Bug 799 has been marked as a duplicate of this bug. ***
Comment 3 realburner 2009-10-18 11:25:09 UTC
you can fix this by applying -march=native to the cflags
Comment 4 Sam Lantinga 2009-12-16 21:01:33 UTC
Still waiting to hear if this issue is still present in the current snapshot.  I've tested on both 32-bit and 64-bit Linux with no problems.
Comment 5 marty leisner 2009-12-16 23:34:01 UTC
(In reply to comment #4)
> Still waiting to hear if this issue is still present in the current snapshot. 
> I've tested on both 32-bit and 64-bit Linux with no problems.


I'll look into this some more -- after a configure/make/make install and trying to  configure tests I'm getting:
configure:3241: result: no
configure:3285: gcc -o conftest -g -O2 -I/usr/local/SDL-5384/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT   conftest.c  -L/usr/local/SDL-5384/lib -Wl,-rpath,/usr/local/SDL-5384/lib -lSDL -lpthread >&5
/usr/local/SDL-5384/lib/libSDL.so: undefined reference to `__sync_fetch_and_sub_4'
/usr/local/SDL-5384/lib/libSDL.so: undefined reference to `__sync_sub_and_fetch_4'
/usr/local/SDL-5384/lib/libSDL.so: undefined reference to `__sync_fetch_and_add_4'
/usr/local/SDL-5384/lib/libSDL.so: undefined reference to `__sync_add_and_fetch_4'
collect2: ld returned 1 exit status
configure:3292: $? = 1
configure: failed program was:

These are in SDL_atomic.c, I'll investigate more.

I'm using a ubuntu 7.10 on a PIII for this instance...

marty
Comment 6 Sam Lantinga 2009-12-16 23:49:05 UTC
What's the version of gcc you're using?
Comment 7 Sam Lantinga 2010-07-12 22:00:06 UTC
Hey Marty, I haven't been able to reproduce this and I haven't heard from you in a while.  What's the status of this?
Comment 8 Nathaniel J Fries 2011-01-07 12:21:13 UTC
I did not experience this on Ubuntu 9.04, so either the issue was fixed in GCC before then?

but IIRC those are GCC intrinsics and should have been available.
Comment 9 Sam Lantinga 2011-01-21 12:49:28 UTC
The atomic code has changed significantly, and if this is still an issue, let's enter a new bug for it.