| Summary: | SDL fails to link in mingw+msys+libtool | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Carlo Bramini <carlo.bramix> |
| Component: | main | Assignee: | Sam Lantinga <slouken> |
| Status: | CLOSED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | 1.2.14 | ||
| Hardware: | x86 | ||
| OS: | Windows (All) | ||
| Attachments: | Removes refereces to mingwex and force creation on .la file. | ||
|
Description
Carlo Bramini
2010-01-27 10:06:17 UTC
Can you provide a patch to fix this issue? I tried to do a patch, it is complete itself but I was not able to tell to libtool to create the right thing with SDLmain. If a script called libSDLmain.la like this one exists near libSDLmain.a, compilation of third party softwares will always work fine: # libSDLmain.la - a libtool library file # Generated by ltmain.sh (GNU libtool) 2.2.6 # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='' # Names of this library. library_names='libSDLmain.a' # The name of the static archive. old_library='libSDLmain.a' # Linker flags that can not go in dependency_libs. inherited_linker_flags='' # Libraries that this one depends upon. dependency_libs='' # Names of additional weak libraries provided by this library weak_library_names='' # Version information for libSDLmain. current=11 age=11 revision=4 # Is this an already installed library? installed=yes # Should we warn about portability when linking against -modules? shouldnotlink=no # Files to dlopen/dlpreopen dlopen='' dlpreopen='' # Directory that this library needs to be installed in: libdir='/mingw/lib' But the problem is the library_names field. When building static libraries, that item is always *empty*, it seems to be filled only when building DLLs. If library_names is empty, this message will be printed: *** Warning: This system can not link to static lib archive c:/mingw/lib/libSDLmain.la. *** I have the capability to make that library automatically link in when *** you link to this library. But I can only do this if you have a *** shared version of the library, which you do not appear to have. *** But as you try to build a module library, libtool will still create *** a static module, that should work as long as the dlopening application *** is linked with the -dlopen flag to resolve symbols at runtime. I tried to experiment *all* options of libtool without success. If I compile a static only library, then there is library_names='' If some of you have some suggestions... Yeah, the .la file is only for shared libraries, and I think the result is that you end up not linking libSDLmain.a. I'm going to leave it alone since it's just a warning from libtool and not a real problem. Thank you for your reply, Sam. (In reply to comment #3) > Yeah, the .la file is only for shared libraries, and I think the result is that > you end up not linking libSDLmain.a. > > I'm going to leave it alone since it's just a warning from libtool and not a > real problem. but in fact, this is not exactly true, from what I could see, it is a *real* problem. I did again my test with XINE, which compiles a core and a set of DLLs (audio renderer, video renderer, etc) but hopefully this could be also quickly and easily tested with a sample application and it will be seen that's not a simple warning message. Let's assume that your project wants to build a DLL which depends on SDL. If the .la file is missing or library_names field is empty, it won't link a DLL but a static library .a file. So, everything will fail here: if an application wants to to do LoadLibrary() on this DLL, it won't work. I must also say that if people will encounter this troubles with some applications (especially when doing porting of existing un*x software to mingw+msys) and SDLmain, this problem can be also resolved by putting "--disable-sdl" at configure time, if supported. Created attachment 750 [details]
Removes refereces to mingwex and force creation on .la file.
I decided to share my patch anyways, if somebody will find it useful for some reasons.
It has been created on the most recent sources I could find in the repository.
I had not written it in previous comments, but libtool does not seem to be exactly happy to mix .lo and .o files (I'm talking about version.o).
Rather than doing things "by hand", it would be better to let libtool to call windres and leave all the task to him.
I used --tag option to libtool when building resources, newer versions will just ignore it, older versions required it: in the doubt, I placed it in the command.
I see why this is needed. I applied your patch, but I needed to change it so SDLmain is static on all platforms (e.g. Mac OS X). http://hg.libsdl.org/SDL/rev/987c365cc7bf Thanks! |