Oh yh,
When I tried to link it with the static library;
gcc fire.c -I /usr/local/include/SDL/ -L …/…/SDL-1.2.13/build/.libs/
-lSDL -o tesyn
I got error messages stating the following;
…/…/SDL-1.2.13/build/.libs//libSDL.a(SDL_systhread.o): In function
SDL_SYS_WaitThread': /home/Michael/project/SDL-1.2.13/./src/thread/pthread/SDL_systhread.c:107: undefined reference to
pthread_join’
…/…/SDL-1.2.13/build/.libs//libSDL.a(SDL_systhread.o): In function
SDL_SYS_SetupThread': /home/Michael/project/SDL-1.2.13/./src/thread/pthread/SDL_systhread.c:89: undefined reference to
pthread_sigmask’
…/…/SDL-1.2.13/build/.libs//libSDL.a(SDL_systhread.o): In function
SDL_SYS_CreateThread': /home/Michael/project/SDL-1.2.13/./src/thread/pthread/SDL_systhread.c:64: undefined reference to
pthread_create’
…/…/SDL-1.2.13/build/.libs//libSDL.a(SDL_systhread.o): In function
SDL_SYS_KillThread': /home/Michael/project/SDL-1.2.13/./src/thread/pthread/SDL_systhread.c:113: undefined reference to
pthread_cancel’
…/…/SDL-1.2.13/build/.libs//libSDL.a(SDL_syssem.o): In function
SDL_SemPost': /home/Michael/project/SDL-1.2.13/./src/thread/pthread/SDL_syssem.c:149: undefined reference to
sem_post’
…/…/SDL-1.2.13/build/.libs//libSDL.a(SDL_syssem.o): In function
SDL_SemValue': /home/Michael/project/SDL-1.2.13/./src/thread/pthread/SDL_syssem.c:132: undefined reference to
sem_getvalue’
…/…/SDL-1.2.13/build/.libs//libSDL.a(SDL_syssem.o): In function
SDL_SemWait': /home/Michael/project/SDL-1.2.13/./src/thread/pthread/SDL_syssem.c:90: undefined reference to
sem_wait’
…/…/SDL-1.2.13/build/.libs//libSDL.a(SDL_syssem.o): In function
SDL_SemTryWait': /home/Michael/project/SDL-1.2.13/./src/thread/pthread/SDL_syssem.c:75: undefined reference to
sem_trywait’
…/…/SDL-1.2.13/build/.libs//libSDL.a(SDL_syssem.o): In function
SDL_DestroySemaphore': /home/Michael/project/SDL-1.2.13/./src/thread/pthread/SDL_syssem.c:61: undefined reference to
sem_destroy’
…/…/SDL-1.2.13/build/.libs//libSDL.a(SDL_syssem.o): In function
SDL_CreateSemaphore': /home/Michael/project/SDL-1.2.13/./src/thread/pthread/SDL_syssem.c:47: undefined reference to
sem_init’
…/…/SDL-1.2.13/build/.libs//libSDL.a(SDL_sysmutex.o): In function
SDL_CreateMutex': /home/Michael/project/SDL-1.2.13/./src/thread/pthread/SDL_sysmutex.c:49: undefined reference to
pthread_mutexattr_init’
/home/Michael/project/SDL-1.2.13/./src/thread/pthread/SDL_sysmutex.c:51:
undefined reference to pthread_mutexattr_settype' ../../SDL-1.2.13/build/.libs//libSDL.a(SDL_gamma.o): In function
CalculateGammaFromRamp’:
/home/Michael/project/SDL-1.2.13/./src/video/SDL_gamma.c:84: undefined
reference to log' /home/Michael/project/SDL-1.2.13/./src/video/SDL_gamma.c:84: undefined reference to
log’
…/…/SDL-1.2.13/build/.libs//libSDL.a(SDL_gamma.o): In function
CalculateGammaRamp': /home/Michael/project/SDL-1.2.13/./src/video/SDL_gamma.c:63: undefined reference to
pow’
…/…/SDL-1.2.13/build/.libs//libSDL.a(SDL_x11gl.o): In function
X11_GL_UnloadLibrary': /home/Michael/project/SDL-1.2.13/./src/video/x11/SDL_x11gl.c:450: undefined reference to
dlclose’
…/…/SDL-1.2.13/build/.libs//libSDL.a(SDL_x11gl.o): In function
X11_GL_LoadLibrary': /home/Michael/project/SDL-1.2.13/./src/video/x11/SDL_x11gl.c:487: undefined reference to
dlopen’
/home/Michael/project/SDL-1.2.13/./src/video/x11/SDL_x11gl.c:501: undefined
reference to dlsym' /home/Michael/project/SDL-1.2.13/./src/video/x11/SDL_x11gl.c:503: undefined reference to
dlsym’
/home/Michael/project/SDL-1.2.13/./src/video/x11/SDL_x11gl.c:505: undefined
reference to dlsym' /home/Michael/project/SDL-1.2.13/./src/video/x11/SDL_x11gl.c:507: undefined reference to
dlsym’
/home/Michael/project/SDL-1.2.13/./src/video/x11/SDL_x11gl.c:509: undefined
reference to dlsym' ../../SDL-1.2.13/build/.libs//libSDL.a(SDL_x11gl.o):/home/Michael/project/SDL-1.2.13/./src/video/x11/SDL_x11gl.c:511: more undefined references to
dlsym’ follow
…/…/SDL-1.2.13/build/.libs//libSDL.a(SDL_sysloadso.o): In function
SDL_LoadFunction': /home/Michael/project/SDL-1.2.13/./src/loadso/dlopen/SDL_sysloadso.c:56: undefined reference to
dlerror’
…/…/SDL-1.2.13/build/.libs//libSDL.a(SDL_sysloadso.o): In function
SDL_LoadObject': /home/Michael/project/SDL-1.2.13/./src/loadso/dlopen/SDL_sysloadso.c:36: undefined reference to
dlopen’
/home/Michael/project/SDL-1.2.13/./src/loadso/dlopen/SDL_sysloadso.c:37:
undefined reference to dlerror' ../../SDL-1.2.13/build/.libs//libSDL.a(SDL_sysloadso.o): In function
SDL_UnloadObject’:
/home/Michael/project/SDL-1.2.13/./src/loadso/dlopen/SDL_sysloadso.c:65:
undefined reference to `dlclose’
collect2: ld returned 1 exit status
Now, based on the above, I noticed it was complaining about the following;
-ldl (which I thought was only meant to be called when making use of
dynamic libraries)
-lpthread
Ok, I included them, using;
gcc fire.c -I /usr/local/include/SDL/ -L …/…/SDL-1.2.13/build/.libs/ -lSDL
-ldl -lpthread -o tesyn
which also gave errors (below)
…/…/SDL-1.2.13/build/.libs//libSDL.a(SDL_gamma.o): In function
CalculateGammaFromRamp': /home/Michael/project/SDL-1.2.13/./src/video/SDL_gamma.c:84: undefined reference to
log’
/home/Michael/project/SDL-1.2.13/./src/video/SDL_gamma.c:84: undefined
reference to log' ../../SDL-1.2.13/build/.libs//libSDL.a(SDL_gamma.o): In function
CalculateGammaRamp’:
/home/Michael/project/SDL-1.2.13/./src/video/SDL_gamma.c:63: undefined
reference to `pow’
collect2: ld returned 1 exit status
Now, at this point I didn’t know what to do.
Any ideas?
Thanks in advance.
MichaelOn Sun, Mar 22, 2009 at 10:37 AM, Mike Mike <@Mike_Mike> wrote:
Hello World;
I believe I’m having an issue with static libraries of SDL. I have a
sample source that I have compiled and linked using shared libraries.
Created the respective executable, ran it and it worked fine. Figured if I
link it with a static version of the library, it would work too. But to my
amazement, it didn’t.
Any reason for this?
Thanks in advance.