Thread overview
Getting SDL working on MacOS X
Mar 11, 2006
Ryan Burton
Mar 12, 2006
Ryan Burton
Mar 13, 2006
Ryan Burton
March 11, 2006
I'm new to D, and I'd like to do some SDL programming on Tiger. I downloaded the SDL module from http://www.algonet.se/~afb/d/ and tried to build the example testbitmap.d, but I unfortunately get an error that I have no idea how to get around.

Typing "make testbitmap" gives this:
gdc -O -frelease -c testbitmap.d
gdc -O -frelease -c picture.d
gdc -O -frelease -c sdl/active.d
gdc -O -frelease -c sdl/cdrom.d
gdc -O -frelease -c sdl/error.d
gdc -O -frelease -c sdl/joystick.d
gdc -O -frelease -c sdl/main.d
gdc -O -frelease -c sdl/quit.d
gdc -O -frelease -c sdl/syswm.d
gdc -O -frelease -c sdl/audio.d
gdc -O -frelease -c sdl/events.d
gdc -O -frelease -c sdl/keyboard.d
gdc -O -frelease -c sdl/mouse.d
gdc -O -frelease -c sdl/rwops.d
gdc -O -frelease -c sdl/thread.d
gdc -O -frelease -c sdl/version.d
gdc -O -frelease -c sdl/byteorder.d
gdc -O -frelease -c sdl/endian.d
gdc -O -frelease -c sdl/getenv.d
gdc -O -frelease -c sdl/keysym.d
gdc -O -frelease -c sdl/mutex.d
gdc -O -frelease -c sdl/sdl.d
gdc -O -frelease -c sdl/timer.d
gdc -O -frelease -c sdl/video.d
ar cr libSDL_d.a active.o cdrom.o error.o joystick.o main.o quit.o
syswm.o audio.o events.o keyboard.o mouse.o rwops.o thread.o version.o
byteorder.o endian.o getenv.o keysym.o mutex.o sdl.o timer.o video.o
ranlib: file: libSDL_d.a(error.o) has no symbols
ranlib: file: libSDL_d.a(getenv.o) has no symbols
ranlib libSDL_d.a
ranlib: file: libSDL_d.a(error.o) has no symbols
ranlib: file: libSDL_d.a(getenv.o) has no symbols
ar cr sdl/libSDLmain_d.a sdl/SDLMain.o
ranlib sdl/libSDLmain_d.a
gdc -o testbitmap testbitmap.o picture.o libSDL_d.a sdl/libSDLmain_d.a
-L. -Wl,-framework,SDL -Wl,-framework,Cocoa -lSDL_d -Lsdl -lSDLmain_d
/usr/bin/ld: libSDL_d.a(mutex.o) has external relocation entries in
non-writable section (__TEXT,__text) for symbols:
_SDL_mutexV
_SDL_mutexP
collect2: ld returned 1 exit status
make: *** [testbitmap] Error 1



Any help would be much appreciated.
March 11, 2006
Ryan Burton wrote:

> I'm new to D, and I'd like to do some SDL programming on Tiger. I downloaded the SDL module from http://www.algonet.se/~afb/d/ and tried to build the example testbitmap.d, but I unfortunately get an error that I have no idea how to get around.
[...]
> /usr/bin/ld: libSDL_d.a(mutex.o) has external relocation entries in non-writable section (__TEXT,__text) for symbols:
> _SDL_mutexV
> _SDL_mutexP
> collect2: ld returned 1 exit status
> make: *** [testbitmap] Error 1

Looks good, so must be something new in the Tiger linker I guess ?

If you're bored, you can use the GCC-3.3 based version meanwhile...
(at least I hope that you can, as it seemed to work OK for Panther)

--anders
March 12, 2006
In article <duufn7$2pei$1@digitaldaemon.com>,
 Anders F Björklund <afb@algonet.se> wrote:

> Ryan Burton wrote:
> 
> > I'm new to D, and I'd like to do some SDL programming on Tiger. I downloaded the SDL module from http://www.algonet.se/~afb/d/ and tried to build the example testbitmap.d, but I unfortunately get an error that I have no idea how to get around.
> [...]
> > /usr/bin/ld: libSDL_d.a(mutex.o) has external relocation entries in
> > non-writable section (__TEXT,__text) for symbols:
> > _SDL_mutexV
> > _SDL_mutexP
> > collect2: ld returned 1 exit status
> > make: *** [testbitmap] Error 1
> 
> Looks good, so must be something new in the Tiger linker I guess ?
> 
> If you're bored, you can use the GCC-3.3 based version meanwhile... (at least I hope that you can, as it seemed to work OK for Panther)
> 
> --anders


Hmmm... I just tried the Panther GDC binaries and got the same error. I suppose I'll be building on Windows for now.

Thanks
-Ryan
March 12, 2006
Ryan Burton wrote:

>>Looks good, so must be something new in the Tiger linker I guess ?
>>
>>If you're bored, you can use the GCC-3.3 based version meanwhile...
>>(at least I hope that you can, as it seemed to work OK for Panther)
> 
> Hmmm... I just tried the Panther GDC binaries and got the same error. I suppose I'll be building on Windows for now.

Thanks for testing, but it was an error in my SDL wrapper (sorry) :-(

The order of the declarations need to be swapped around, and it works:
diff -u -r1.2 mutex.d
--- sdl/mutex.d 23 Oct 2004 08:16:37 -0000      1.2
+++ sdl/mutex.d 12 Mar 2006 08:06:58 -0000
@@ -48,12 +48,12 @@
 SDL_mutex * SDL_CreateMutex();

 /* Lock the mutex  (Returns 0, or -1 on error) */
-int SDL_LockMutex(SDL_mutex *m) { return SDL_mutexP(m); }
 int SDL_mutexP(SDL_mutex *mutex);
+int SDL_LockMutex(SDL_mutex *m) { return SDL_mutexP(m); }

 /* Unlock the mutex  (Returns 0, or -1 on error) */
-int SDL_UnlockMutex(SDL_mutex* m) { return SDL_mutexV(m); }
 int SDL_mutexV(SDL_mutex *mutex);
+int SDL_UnlockMutex(SDL_mutex* m) { return SDL_mutexV(m); }

 /* Destroy a mutex */
 void SDL_DestroyMutex(SDL_mutex *mutex);


> ld: libSDL_d.a(mutex.o) has external relocation entries in non-writable section (__TEXT,__text) for symbols:
> _SDL_mutexV
> _SDL_mutexP

Fixed in CVS, got "your error" before - and after this change it works.

Thanks!
--anders
March 13, 2006
Great! Works nicely now. Thanks!

-Ryan

In article <dv0krd$2s9c$1@digitaldaemon.com>,
 Anders F Björklund <afb@algonet.se> wrote:

> Ryan Burton wrote:
> 
> >>Looks good, so must be something new in the Tiger linker I guess ?
> >>
> >>If you're bored, you can use the GCC-3.3 based version meanwhile... (at least I hope that you can, as it seemed to work OK for Panther)
> > 
> > Hmmm... I just tried the Panther GDC binaries and got the same error. I suppose I'll be building on Windows for now.
> 
> Thanks for testing, but it was an error in my SDL wrapper (sorry) :-(
> 
> The order of the declarations need to be swapped around, and it works: diff -u -r1.2 mutex.d
> --- sdl/mutex.d 23 Oct 2004 08:16:37 -0000      1.2
> +++ sdl/mutex.d 12 Mar 2006 08:06:58 -0000
> @@ -48,12 +48,12 @@
>   SDL_mutex * SDL_CreateMutex();
> 
>   /* Lock the mutex  (Returns 0, or -1 on error) */
> -int SDL_LockMutex(SDL_mutex *m) { return SDL_mutexP(m); }
>   int SDL_mutexP(SDL_mutex *mutex);
> +int SDL_LockMutex(SDL_mutex *m) { return SDL_mutexP(m); }
> 
>   /* Unlock the mutex  (Returns 0, or -1 on error) */
> -int SDL_UnlockMutex(SDL_mutex* m) { return SDL_mutexV(m); }
>   int SDL_mutexV(SDL_mutex *mutex);
> +int SDL_UnlockMutex(SDL_mutex* m) { return SDL_mutexV(m); }
> 
>   /* Destroy a mutex */
>   void SDL_DestroyMutex(SDL_mutex *mutex);
> 
> 
> > ld: libSDL_d.a(mutex.o) has external relocation entries in non-writable
> > section (__TEXT,__text) for symbols:
> > _SDL_mutexV
> > _SDL_mutexP
> 
> Fixed in CVS, got "your error" before - and after this change it works.
> 
> Thanks!
> --anders