pspdev / psp-ports

A collection of open source software ported to the PSP.
100 stars 37 forks source link

sdl_mixer and libmikmod fail linking against pspsdk's libc #10

Closed libcg closed 10 years ago

libcg commented 12 years ago

Here's what I get when I add -lSDL_mixer and -lmikmod to LIBS in my project's Makefile :

/usr/local/pspdev/lib/gcc/psp/4.6.3/../../../../psp/lib/libSDL_mixer.a(music_cmd.o): In function `MusicCMD_Start':
/home/geecko/psplibraries/build/SDL_mixer-1.2.11/music_cmd.c:166: undefined reference to `sigprocmask'
/home/geecko/psplibraries/build/SDL_mixer-1.2.11/music_cmd.c:173: undefined reference to `execvp'
/usr/local/pspdev/lib/gcc/psp/4.6.3/../../../../psp/lib/libSDL_mixer.a(music_cmd.o): In function `MusicCMD_Stop':
/home/geecko/psplibraries/build/SDL_mixer-1.2.11/music_cmd.c:198: undefined reference to `waitpid'
/usr/local/pspdev/lib/gcc/psp/4.6.3/../../../../psp/lib/libSDL_mixer.a(music_cmd.o): In function `MusicCMD_Active':
/home/geecko/psplibraries/build/SDL_mixer-1.2.11/music_cmd.c:234: undefined reference to `waitpid'
/usr/local/pspdev/lib/gcc/psp/4.6.3/../../../../psp/lib/libmikmod.a(mdriver.o): In function `MD_Access':
/home/geecko/psplibraries/build/libmikmod-3.2.0-beta2/libmikmod/../playercode/mdriver.c:913: undefined reference to `getuid'
/home/geecko/psplibraries/build/libmikmod-3.2.0-beta2/libmikmod/../playercode/mdriver.c:915: undefined reference to `getgid'
/usr/local/pspdev/lib/gcc/psp/4.6.3/../../../../psp/lib/libmikmod.a(mdriver.o): In function `MD_DropPrivileges':
/home/geecko/psplibraries/build/libmikmod-3.2.0-beta2/libmikmod/../playercode/mdriver.c:927: undefined reference to `geteuid'
/home/geecko/psplibraries/build/libmikmod-3.2.0-beta2/libmikmod/../playercode/mdriver.c:928: undefined reference to `getuid'
/home/geecko/psplibraries/build/libmikmod-3.2.0-beta2/libmikmod/../playercode/mdriver.c:936: undefined reference to `getpwnam'
/home/geecko/psplibraries/build/libmikmod-3.2.0-beta2/libmikmod/../playercode/mdriver.c:940: undefined reference to `setuid'
/home/geecko/psplibraries/build/libmikmod-3.2.0-beta2/libmikmod/../playercode/mdriver.c:930: undefined reference to `getuid'
/home/geecko/psplibraries/build/libmikmod-3.2.0-beta2/libmikmod/../playercode/mdriver.c:930: undefined reference to `setuid'

These functions are unavailable on the PSP.

artart78 commented 10 years ago

It probably means that part of SDL mixer/mikmod just can't work. Closing because it's old and I guess you can fix that too @libcg :P

wickles commented 7 years ago

I am running into this problem now trying to compile some old game. Those do not seem like good reasons to close an issue..

Anyway, I found the the offending functions are used in all newer versions series 3.1, 3.2, and 3.3. However every instance of these functions (that I checked) is wrapped in a preprocessor clause

#if defined unix || (defined __APPLE__ && defined __MACH__)
...
#endif

Since we are compiling for PSP and not unix or MacOS, it should be simple to fix by adjusting some definitions when compiling mikmod.

wickles commented 7 years ago

Indeed, I found a definition for unix in the makefiles:

> % grep -nr Dunix psp-ports/libmikmod
psp-ports/libmikmod/libmikmod/Makefile.in:32:CFLAGS=@CFLAGS@ -Dunix

Removing the definition resolves the errors listed here but reveals a couple remaining similar errors, which should also not be difficult to fix:

/usr/local/pspdev/lib/gcc/psp/4.8.5/../../../../psp/lib/libmikmod.a(drv_pipe.o): In function `pipe_Exit':
../drivers/drv_pipe.c:(.text+0xac): undefined reference to `pclose'
/usr/local/pspdev/lib/gcc/psp/4.8.5/../../../../psp/lib/libmikmod.a(drv_pipe.o): In function `pipe_Init':
../drivers/drv_pipe.c:(.text+0x130): undefined reference to `popen'