#28 Issue with -static
Closed 3 years ago by orbea. Opened 3 years ago by orbea.

slibtool: https://dev.midipix.org/cross/slibtool/c/f23d994?branch=main
sdl: 2.0.14

When building SDl2 with rlibtool it fails to create static libraries even when upstream uses -static.

https://github.com/libsdl-org/SDL/blob/cf7eef37b045bb3f841e26879fdc6d865c8aaf9a/Makefile.in#L157
https://github.com/libsdl-org/SDL/blob/cf7eef37b045bb3f841e26879fdc6d865c8aaf9a/Makefile.in#L160

--- /tmp/libsdl2.libtool        2021-03-20 10:36:46.103310158 -0700
+++ /tmp/libsdl2.slibtool       2021-03-20 10:39:38.193309977 -0700
@@ -107,19 +107,13 @@
 /usr/lib64/cmake/SDL2/sdl2-config-version.cmake
 /usr/lib64/libSDL2-2.0.so.0
 /usr/lib64/libSDL2-2.0.so.0.14.0
-/usr/lib64/libSDL2.a
-/usr/lib64/libSDL2main.a
 /usr/lib64/libSDL2.so
-/usr/lib64/libSDL2_test.a
 /usr/lib64/pkgconfig/sdl2.pc
 /usr/lib/cmake/SDL2/sdl2-config.cmake
 /usr/lib/cmake/SDL2/sdl2-config-version.cmake
 /usr/lib/libSDL2-2.0.so.0
 /usr/lib/libSDL2-2.0.so.0.14.0
-/usr/lib/libSDL2.a
-/usr/lib/libSDL2main.a
 /usr/lib/libSDL2.so
-/usr/lib/libSDL2_test.a
 /usr/lib/pkgconfig/sdl2.pc
 /usr/share/aclocal/sdl2.m4
 /usr/share/doc/libsdl2-2.0.14-r1/BUGS.txt.bz2

Upstream doesn't seem to have a working --disable-static, but gentoo fixed it with GNU libtool here.

https://gitweb.gentoo.org/repo/gentoo.git/tree/media-libs/libsdl2/files/libsdl2-2.0.14-static-libs.patch?id=f348c75259048a39b2e8f7496b53627644e6282b

This patch does not seem entirely correct in that it uses -all-static instead of -static or -static-libtool-libs.

From the GNU libtool docs:

-all-static

If output-file is a program, then do not link it against any shared libraries at all. 
If output-file is a library, then only create a static library. In general, this flag 
cannot be used together with ‘disable-static’ (see LT_INIT). 
-static

If output-file is a program, then do not link it against any uninstalled shared
libtool libraries. If output-file is a library, then only create a static library. 
-static-libtool-libs

If output-file is a program, then do not link it against any shared libtool
libraries. If output-file is a library, then only create a static library.

The docs indicate that -all-static should not be used with be used with disable-static which gentoo is using, but there is no such limitation for -static or -static-libtool-libs. Regardless libtool seems to have the same result with all three and slibtool behaves differently with -all-static and -static while -static-libtool-libs is currently a no-op.

Note these static libraries are important as some downstream projects expect them to exist as does some of the SDL2 tests.


Should be fixed on the slibtool side as of commit 9a5f968.

Metadata Update from @orbea:
- Issue status updated to: Closed (was: Open)

3 years ago

Login to comment on this ticket.

Metadata