Can't static link on LGPL project

Hi Guys-
I have to static link this project (will either be LGPL or I will supply a
non-static-linked version in addition) due to some implementation
constraints-
my compile command line uses: -lmingw32 -lSDLmain -lSDL -mwindows
and everything seems to link fine,
but when I try to run the program it complains that sdl.dll is not present-
How can I fix this?
Cheers,
Matt

Hello !

I have to static link this project (will either be LGPL or I will
supply a non-static-linked version in addition) due to some
implementation constraints-
my compile command line uses: -lmingw32 -lSDLmain -lSDL -mwindows
and everything seems to link fine,
but when I try to run the program it complains that sdl.dll is not present-
How can I fix this?

Just copy SDL.dll into the directory where your exe is.

CU

Just copy SDL.dll into the directory where your exe is.

Er Thanks but that doesn’t actually relate to my question, at all-
Cheers,
Matt

Yes it does ;)… At least the way you worded it. If you link your binary successfully after compiling, and then run it and get this error, then your program is just having a hard time finding the dll. You can also put SDL.dll in your windows/system32 folder.Jonny D> From: metamorphosis at softhome.net> To: sdl at lists.libsdl.org> Date: Mon, 11 Aug 2008 03:52:21 -0600> Subject: [SDL] Can’t static link on LGPL project> > >Just copy SDL.dll into the directory where your exe is.> > Er Thanks but that doesn’t actually relate to my question, at all-> Cheers,> Matt> _______________________________________________> SDL mailing list> SDL at lists.libsdl.org> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

metamorphosis at softhome.net wrote:

Just copy SDL.dll into the directory where your exe is.

Er Thanks but that doesn’t actually relate to my question, at all-

you need to tell the linker to aktually use the static version of the
given libraries. gcc usually calls the linker with the correct options
when using the -static command line switch. i cannot speak for other
plattforms though.

clemens

Er Thanks but that doesn’t actually relate to my question, at all-

you need to tell the linker to aktually use the static version of the
given libraries. gcc usually calls the linker with the correct options
when using the -static command line switch. i cannot speak for other
plattforms though.

Thanks Clemens, have tried this (I’m using mingw ie gcc/g++) but the
compiler gives the following errors if I do (for reference the program works
fine when shared-linking)-
"c:/programming/mingw/bin/…/lib/gcc/mingw32/3.4.5/…/…/…\libSDL.a(SDL_sys
timer.o):SDL_systimer.c:(.text+0x18): undefined reference to
timeBeginPeriod at 4' c:/programming/mingw/bin/../lib/gcc/mingw32/3.4.5/../../..\libSDL.a(SDL_syst imer.o):SDL_systimer.c:(.text+0x20): undefined reference totimeGetTime at 0’
c:/programming/mingw/bin/…/lib/gcc/mingw32/3.4.5/…/…/…\libSDL.a(SDL_syst
imer.o):SDL_systimer.c:(.text+0xb8): undefined reference to timeGetTime at 0' c:/programming/mingw/bin/../lib/gcc/mingw32/3.4.5/../../..\libSDL.a(SDL_syst imer.o):SDL_systimer.c:(.text+0x11e): undefined reference totimeBeginPeriod at 4’
c:/programming/mingw/bin/…/lib/gcc/mingw32/3.4.5/…/…/…\libSDL.a(SDL_syst
imer.o):SDL_systimer.c:(.text+0x151): undefined reference to
timeSetEvent at 20' c:/programming/mingw/bin/../lib/gcc/mingw32/3.4.5/../../..\libSDL.a(SDL_syst imer.o):SDL_systimer.c:(.text+0x1b7): undefined reference totimeEndPeriod at 4’
c:/programming/mingw/bin/…/lib/gcc/mingw32/3.4.5/…/…/…\libSDL.a(SDL_syst
imer.o):SDL_systimer.c:(.text+0x1c4): undefined reference to
timeKillEvent at 4' c:/programming/mingw/bin/../lib/gcc/mingw32/3.4.5/../../..\libSDL.a(SDL_syst imer.o):SDL_systimer.c:(.text+0x1d3): undefined reference totimeEndPeriod at 4’
c:/programming/mingw/bin/…/lib/gcc/mingw32/3.4.5/…/…/…\libSDL.a(SDL_dx5v
ideo.o):SDL_dx5video.c:(.text+0x139): undefined reference to
`IID_IDirectDrawSurface"
etc

Any clues anyone?
Thanks,
Matt

Yes it does ;)… At least the way you worded it. If you link your binary
successfully after compiling, and then run it and get this error, then your
program is just having a hard time finding the dll. You can also put SDL.dll
in your windows/system32 folder.Jonny

No, your answers do not relate, at all. You have no understanding of what
static linking is.
I suggest you get educated.
Cheers-
m@

Because you’re linking statically to SDL, you now also need to link to
the libraries which SDL used to link to.

I’d guess the following:
winmm32.lib
ddraw.lib
maybe dxguid.lib? (I’ve not looked at the SDL DirectX driver)

A quick look in MSDN for the missing functions will tell you which
library they require.

Peter

2008/8/12 :>>> Er Thanks but that doesn’t actually relate to my question, at all-

you need to tell the linker to aktually use the static version of the
given libraries. gcc usually calls the linker with the correct options
when using the -static command line switch. i cannot speak for other
plattforms though.

Thanks Clemens, have tried this (I’m using mingw ie gcc/g++) but the
compiler gives the following errors if I do (for reference the program works
fine when shared-linking)-
"c:/programming/mingw/bin/…/lib/gcc/mingw32/3.4.5/…/…/…\libSDL.a(SDL_sys
timer.o):SDL_systimer.c:(.text+0x18): undefined reference to
timeBeginPeriod at 4' c:/programming/mingw/bin/../lib/gcc/mingw32/3.4.5/../../..\libSDL.a(SDL_syst imer.o):SDL_systimer.c:(.text+0x20): undefined reference totimeGetTime at 0’
c:/programming/mingw/bin/…/lib/gcc/mingw32/3.4.5/…/…/…\libSDL.a(SDL_syst
imer.o):SDL_systimer.c:(.text+0xb8): undefined reference to timeGetTime at 0' c:/programming/mingw/bin/../lib/gcc/mingw32/3.4.5/../../..\libSDL.a(SDL_syst imer.o):SDL_systimer.c:(.text+0x11e): undefined reference totimeBeginPeriod at 4’
c:/programming/mingw/bin/…/lib/gcc/mingw32/3.4.5/…/…/…\libSDL.a(SDL_syst
imer.o):SDL_systimer.c:(.text+0x151): undefined reference to
timeSetEvent at 20' c:/programming/mingw/bin/../lib/gcc/mingw32/3.4.5/../../..\libSDL.a(SDL_syst imer.o):SDL_systimer.c:(.text+0x1b7): undefined reference totimeEndPeriod at 4’
c:/programming/mingw/bin/…/lib/gcc/mingw32/3.4.5/…/…/…\libSDL.a(SDL_syst
imer.o):SDL_systimer.c:(.text+0x1c4): undefined reference to
timeKillEvent at 4' c:/programming/mingw/bin/../lib/gcc/mingw32/3.4.5/../../..\libSDL.a(SDL_syst imer.o):SDL_systimer.c:(.text+0x1d3): undefined reference totimeEndPeriod at 4’
c:/programming/mingw/bin/…/lib/gcc/mingw32/3.4.5/…/…/…\libSDL.a(SDL_dx5v
ideo.o):SDL_dx5video.c:(.text+0x139): undefined reference to
`IID_IDirectDrawSurface"
etc
Any clues anyone?
Thanks,
Matt


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

No, your answers do not relate, at all. You have no
understanding of what
static linking is.
I suggest you get educated.
Cheers-
m@

Few short things:

  1. You can’t just statically link libsdl from what’s distributed as it’s compiled specifically to be dynamically linked. If you want to statically link it, you need to download the source code, make adjustments so it’s compiled as a static lib with all the DECLSPEC references removed and so on and /then/ you can statically link it so long as a) it’s the only installation of the SDL libs you have (so the header files can only refer to one library) or b) the whole thing is renamed. I have no idea what environment you’re programming in, but http://www.dwheeler.com/program-library/ should at least give you an idea of the differences between the two types of library. The base concepts are fairly universal.

  2. What license is the main program being released under and is it compatible with LGPL? From the original question I think your own project is LGPL? The original question was quite poorly phrased and unclear which is why you’ve been getting a lot of wrong answers.

  3. Is is really necessary to statically link this? If I’m reading this right, you’re trying to make your own shared library but it’s really not uncommon for a shared library to use other shared libraries. There’s no great loss of efficiency (you’d have to be doing something major to actually be able to detect a performance drop) and there are good reasons for using shared libs wherever possible. SDL itself uses a good number of shared libs for all that it does.

Unless someone’s already produced a static version of SDL that you can use you’re setting yourself up for a lot of work.— On Mon, 8/11/08, metamorphosis at softhome.net wrote:

Sorry I didn’t take your subject line over your content. But thanks for the insults, anyhow. There’s no better way to make friends, huh? If you’re trying to solicit help from people, you should be a little more civil. I have no way to differentiate you from anyone else that comes here with an error that sounds like a simple dynamic linking problem. Think on that. As per your suggestion, I guess I should get back to work on my doctorate program.Respectfully,Jonny D> From: metamorphosis at softhome.net> To: sdl at lists.libsdl.org> Date: Mon, 11 Aug 2008 17:22:58 -0600> Subject: Re: [SDL] Can’t static link on LGPL project> > >Yes it does ;)… At least the way you worded it. If you link your binary> >successfully after compiling, and then run it and get this error, then your> >program is just having a hard time finding the dll. You can also put SDL.dll> >in your windows/system32 folder.Jonny> > No, your answers do not relate, at all. You have no understanding of what > static linking is.> I suggest you get educated.> Cheers-> m@> _______________________________________________> SDL mailing list> SDL at lists.libsdl.org> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

In Johnathan’s defense, the original post seemed more like the original
poster didn’t know what static linking was… I thought that the actual
question/problem that was stated in the body of post was addressed quite
succesfully.
I guess if people want the right answers, they first need to ask the right
questions!
-Dave> ----- Original Message -----

From: grimfang4@hotmail.com (Jonathan Dearborn)
To: "A list for developers using the SDL library. (includes SDL-announce)"

Sent: Tuesday, August 12, 2008 7:58 AM
Subject: Re: [SDL] Can’t static link on LGPL project

Sorry I didn’t take your subject line over your content. But thanks for
the insults, anyhow. There’s no better way to make friends, huh? If
you’re trying to solicit help from people, you should be a little more
civil. I have no way to differentiate you from anyone else that comes
here with an error that sounds like a simple dynamic linking problem.
Think on that. As per your suggestion, I guess I should get back to work
on my doctorate program.Respectfully,Jonny D> From:
metamorphosis at softhome.net> To: sdl at lists.libsdl.org> Date: Mon, 11 Aug
2008 17:22:58 -0600> Subject: Re: [SDL] Can’t static link on LGPL project>

Yes it does ;)… At least the way you worded it. If you link your
binary> >successfully after compiling, and then run it and get this error,
then your> >program is just having a hard time finding the dll. You can
also put SDL.dll> >in your windows/system32 folder.Jonny> > No, your
answers do not relate, at all. You have no understanding of what > stati
c linking is.> I suggest you get educated.> Cheers-> m@>
_______________________________________________> SDL mailing list>
SDL at lists.libsdl.org> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Because you’re linking statically to SDL, you now also need to link to
the libraries which SDL used to link to.

I’d guess the following:
winmm32.lib
ddraw.lib
maybe dxguid.lib? (I’ve not looked at the SDL DirectX driver)

A quick look in MSDN for the missing functions will tell you which
library they require.

Thanks Peter, I will look into this.
Cheers,
Matt

  1. You can’t just statically link libsdl from what’s distributed as it’s
    compiled specifically to be dynamically linked. If you want to statically >link
    it, you need to download the source code, make adjustments so it’s >compiled as
    a static lib with all the DECLSPEC references removed and so on and /then/ >you
    can statically link it so long as a) it’s the only installation of the SDL >libs
    you have (so the header files can only refer to one library) or b) the >whole
    thing is renamed. I have no idea what environment you’re programming in, >but
    http://www.dwheeler.com/program-library/ should at least give you an idea >of
    the differences between the two types of library. The base concepts are >fairly
    universal.

Thanks, will look into it=-
the environment has been listed in both emails.

  1. What license is the main program being released under and is it >compatible
    with LGPL? From the original question I think your own project is LGPL? The
    original question was quite poorly phrased and unclear which is why you’ve >been
    getting a lot of wrong answers.

The original question was very clear, I take no responsibility for people
not reading it.

  1. Is is really necessary to statically link this?

Yes.
Thanks,
Matt

Hello !

Just copy SDL.dll into the directory where your exe is.

Er Thanks but that doesn’t actually relate to my question, at all-

Sorry, i misread your email.

I am using SDL with CYGWIN and if i want to build something static
i do it that way :

cc testsprite.c -o testsprite sdl-config --cflags --static-libs -static

Something like that should also help
you when building your own DLLs.

CU

Sorry I didn’t take your subject line over your content. But thanks for the
insults, anyhow. There’s no better way to make friends, huh? If you’re >trying
to solicit help from people, you should be a little more civil. I have no >way
to differentiate you from anyone else that comes here with an error that >sounds
like a simple dynamic linking problem.

Other than reading what’s been written? I think not.
If you’re insulted, perhaps you should try reading what you’ve written, in
both posts, and seeing how smarmy it comes across.
Bye-
M@

In Johnathan’s defense, the original post seemed more like the original
poster didn’t know what static linking was… I thought that the actual
question/problem that was stated in the body of post was addressed quite
succesfully.

Well we’ll agree to disagree then shall we?
If you’ve actually tried statically linking this library what I’ve written
makes perfect sense-
Cheers,
m@