Oh I found pthreads, the toolchain, for some reason, has two sets of libs, one where you would normally expect to find them
/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib (where practically every lib is, even the SDL lib got installed there) and one in a arch specific directory
/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/lib, however linking to this, gives the same results, as if it were not being linked at all.
Does anyone have an basic example (like what I posted) with the
exact command line used to compile, with Open2k installed as per instructions, using SDL, that they can upload?
If I am doing something wrong, please correct me, I have pasted my compile command multiple times. Here it is revised to find the pthreads.
/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/arm-open2x-linux-gcc -I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include/SDL -L/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib -L/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/lib -o main main.c -lpthread -lSDLmain -lSDL -lSDL_image -lSDL_gfx -static
Here is the error output when compiled:
QUOTE
./compile_gp2x.sh
/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib/libSDL.a(SDL_sysmutex.o): In function `SDL_mutexV':
SDL_sysmutex.c
.text+0x14): undefined reference to `pthread_mutex_unlock'
/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib/libSDL.a(SDL_sysmutex.o): In function `SDL_mutexP':
SDL_sysmutex.c
.text+0x74): undefined reference to `pthread_mutex_lock'
/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib/libSDL.a(SDL_sysmutex.o): In function `SDL_DestroyMutex':
SDL_sysmutex.c
.text+0xcc): undefined reference to `pthread_mutex_destroy'
/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib/libSDL.a(SDL_sysmutex.o): In function `SDL_CreateMutex':
SDL_sysmutex.c
.text+0x108): undefined reference to `pthread_mutexattr_init'
SDL_sysmutex.c
.text+0x114): undefined reference to `pthread_mutexattr_setkind_np'
SDL_sysmutex.c
.text+0x120): undefined reference to `pthread_mutex_init'
/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib/libSDL.a(SDL_systhread.o): In function `SDL_SYS_KillThread':
SDL_systhread.c
.text+0x4): undefined reference to `pthread_cancel'
/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib/libSDL.a(SDL_systhread.o): In function `SDL_SYS_WaitThread':
SDL_systhread.c
.text+0x10): undefined reference to `pthread_join'
/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib/libSDL.a(SDL_systhread.o): In function `SDL_ThreadID':
SDL_systhread.c
.text+0x14): undefined reference to `pthread_self'
/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib/libSDL.a(SDL_systhread.o): In function `SDL_SYS_SetupThread':
SDL_systhread.c
.text+0x60): undefined reference to `pthread_sigmask'
SDL_systhread.c
.text+0x6c): undefined reference to `pthread_setcanceltype'
/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib/libSDL.a(SDL_systhread.o): In function `SDL_SYS_CreateThread':
SDL_systhread.c
.text+0x9c): undefined reference to `pthread_attr_init'
SDL_systhread.c
.text+0xb0): undefined reference to `pthread_attr_setdetachstate'
SDL_systhread.c
.text+0xc8): undefined reference to `pthread_create'
/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib/libSDL.a(SDL_systhread.o): In function `RunThread':
SDL_systhread.c
.text+0x128): undefined reference to `pthread_exit'
/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib/libSDL.a(SDL_syssem.o): In function `SDL_SemPost':
SDL_syssem.c
.text+0x24): undefined reference to `sem_post'
/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib/libSDL.a(SDL_syssem.o): In function `SDL_SemValue':
SDL_syssem.c
.text+0x7c): undefined reference to `sem_getvalue'
/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib/libSDL.a(SDL_syssem.o): In function `SDL_SemWait':
SDL_syssem.c
.text+0xbc): undefined reference to `sem_wait'
/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib/libSDL.a(SDL_syssem.o): In function `SDL_SemTryWait':
SDL_syssem.c
.text+0x110): undefined reference to `sem_trywait'
/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib/libSDL.a(SDL_syssem.o): In function `SDL_DestroySemaphore':
SDL_syssem.c
.text+0x1cc): undefined reference to `sem_destroy'
/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib/libSDL.a(SDL_syssem.o): In function `SDL_CreateSemaphore':
SDL_syssem.c
.text+0x20c): undefined reference to `sem_init'
collect2: ld returned 1 exit status