#698052 [libsdl1.2-dev] sdl-config --static-libs doesn't add Required.private libs

Package:
libsdl1.2-dev
Source:
libsdl1.2
Description:
SDL 1.2 binary compatibility library - development files
Submitter:
Schrober
Date:
2023-07-12 22:27:06 UTC
Severity:
normal
Tags:
#698052#5
Date:
2013-01-13 15:01:52 UTC
From:
To:
Compiling a program statically with `sdl-config --static-libs ...` will result
in missing symbols:

/usr/lib/i386-linux-gnu/libX11.a(ClDisplay.o): In function `XCloseDisplay':
(.text+0xbd): undefined reference to `xcb_disconnect'
/usr/lib/i386-linux-gnu/libX11.a(OpenDis.o): In function `OutOfMemory':
(.text+0x456): undefined reference to `xcb_disconnect'
/usr/lib/i386-linux-gnu/libX11.a(OpenDis.o): In function `XOpenDisplay':
(.text+0x81e): undefined reference to `xcb_get_setup'
/usr/lib/i386-linux-gnu/libX11.a(OpenDis.o): In function `XOpenDisplay':
(.text+0xc59): undefined reference to `xcb_get_maximum_request_length'
/usr/lib/i386-linux-gnu/libX11.a(xcb_disp.o): In function `_XConnectXCB':
(.text+0x187): undefined reference to `xcb_parse_display'
/usr/lib/i386-linux-gnu/libX11.a(xcb_disp.o): In function `_XConnectXCB':
(.text+0x1e8): undefined reference to `xcb_connect_to_display_with_auth_info'
/usr/lib/i386-linux-gnu/libX11.a(xcb_disp.o): In function `_XConnectXCB':
(.text+0x206): undefined reference to `xcb_get_file_descriptor'
/usr/lib/i386-linux-gnu/libX11.a(xcb_disp.o): In function `_XConnectXCB':
(.text+0x221): undefined reference to `xcb_generate_id'
/usr/lib/i386-linux-gnu/libX11.a(xcb_disp.o): In function `_XConnectXCB':
(.text+0x29b): undefined reference to `xcb_connection_has_error'
/usr/lib/i386-linux-gnu/libX11.a(xcb_disp.o): In function `_XConnectXCB':
(.text+0x2bc): undefined reference to `xcb_connect'
/usr/lib/i386-linux-gnu/libX11.a(xcb_io.o): In function
`require_socket.part.0':
(.text+0x724): undefined reference to `xcb_take_socket'
/usr/lib/i386-linux-gnu/libX11.a(xcb_io.o): In function `poll_for_event':
(.text+0x7c6): undefined reference to `xcb_poll_for_event'
/usr/lib/i386-linux-gnu/libX11.a(xcb_io.o): In function `poll_for_response':
(.text+0x8fb): undefined reference to `xcb_poll_for_reply'
/usr/lib/i386-linux-gnu/libX11.a(xcb_io.o): In function `_XSend':
(.text+0xb44): undefined reference to `xcb_writev'
/usr/lib/i386-linux-gnu/libX11.a(xcb_io.o): In function `_XReadEvents':
(.text+0xd1f): undefined reference to `xcb_connection_has_error'
/usr/lib/i386-linux-gnu/libX11.a(xcb_io.o): In function `_XReadEvents':
(.text+0xdab): undefined reference to `xcb_wait_for_event'
/usr/lib/i386-linux-gnu/libX11.a(xcb_io.o): In function `_XEventsQueued':
(.text+0xec2): undefined reference to `xcb_connection_has_error'
/usr/lib/i386-linux-gnu/libX11.a(xcb_io.o): In function `_XAllocIDs':
(.text+0xfec): undefined reference to `xcb_generate_id'
/usr/lib/i386-linux-gnu/libX11.a(xcb_io.o): In function `_XReply':
(.text+0x1166): undefined reference to `xcb_wait_for_reply'

A pkg-config based config (.pc) would use "Required.private: x11" to fix this.
Adding also `pkg-config --static --libs x11` is currently used by me as
workaround. But this is no real solution
Debian Release: 7.0
  500 unstable        www.deb-multimedia.org
  500 unstable        http.debian.net
  500 testing         http.debian.net
    1 experimental    www.deb-multimedia.org
    1 experimental    http.debian.net
--- Package information. ---
Depends                 (Version) | Installed
=================================-+-=============
libsdl1.2debian      (= 1.2.15-5) |
libasound2-dev                    |
libcaca-dev                       |
libdirectfb-dev       (>= 0.9.22) |
libglu1-mesa-dev                  |
 OR libglu-dev                    |
libpulse-dev                      |
libx11-dev                        |
libts-dev                         |
libxext-dev                       |


Package's Recommends field is empty.

Package's Suggests field is empty.

#698052#10
Date:
2013-07-27 18:28:33 UTC
From:
To:
Thanks for the report, I forwarded it upstream, with the URL above.
#698052#17
Date:
2013-07-30 03:22:06 UTC
From:
To:
FWIW, I encountered similar looking errors while trying to configure and
build a statically linked gvim binary . The complete information (including
configure logs etc.,) can be found at
https://groups.google.com/forum/#!topic/vim_use/rQBp0rsJ98U .

To summarize, consider the following
rajulocal@hogwarts:~/compile_static_gvim_native/problems$ cat conftest.c
/* confdefs.h */
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
#define UNIX 1
#define STDC_HEADERS 1
#define HAVE_SYS_WAIT_H 1
#define HAVE_SELINUX 1
#define FEAT_HUGE 1
#define USE_XSMP_INTERACT 1
#define HAVE_LIBNSL 1
#define FEAT_NETBEANS_INTG 1
/* end confdefs.h.  */
#include <X11/Xlib.h>
int
main ()
{
XrmInitialize ()
  ;
  return 0;
}

This program compiles without the "-static" option. But gives errors
otherwise.

The following command works. But the one after does not.

rajulocal@hogwarts:~/compile_static_gvim_native/problems$ gcc -o conftest
-g -O2  -I/usr/local/include -L/usr/local/lib file1.c -lX11 -lnsl  -lselinux

rajulocal@hogwarts:~/compile_static_gvim_native/problems$ gcc -o conftest
-g -O2  -I/usr/local/include -static -L/usr/local/lib file1.c -lX11 -lnsl
-lselinux
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xim_trans.o):
In function `_XimXTransSocketUNIXConnect':
(.text+0xe12): warning: Using 'getaddrinfo' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_io.o):
In function `require_socket':
(.text+0x652): undefined reference to `xcb_take_socket'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_io.o):
In function `poll_for_event':
(.text+0x7d4): undefined reference to `xcb_poll_for_event'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_io.o):
In function `poll_for_response':
(.text+0x8c2): undefined reference to `xcb_poll_for_reply'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_io.o):
In function `_XSend':
(.text+0xada): undefined reference to `xcb_writev'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_io.o):
In function `_XReadEvents':
(.text+0xc38): undefined reference to `xcb_connection_has_error'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_io.o):
In function `_XReadEvents':
(.text+0xcd4): undefined reference to `xcb_wait_for_event'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_io.o):
In function `_XEventsQueued':
(.text+0xdfd): undefined reference to `xcb_connection_has_error'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_io.o):
In function `_XAllocIDs':
(.text+0xedb): undefined reference to `xcb_generate_id'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_io.o):
In function `_XReply':
(.text+0x1045): undefined reference to `xcb_wait_for_reply'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(ClDisplay.o):
In function `XCloseDisplay':
(.text+0xd3): undefined reference to `xcb_disconnect'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(OpenDis.o):
In function `OutOfMemory':
(.text+0x4d4): undefined reference to `xcb_disconnect'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(OpenDis.o):
In function `XOpenDisplay':
(.text+0x8fd): undefined reference to `xcb_get_setup'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(OpenDis.o):
In function `XOpenDisplay':
(.text+0xb41): undefined reference to `xcb_get_maximum_request_length'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_disp.o):
In function `_XConnectXCB':
(.text+0x1ac): undefined reference to `xcb_parse_display'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_disp.o):
In function `_XConnectXCB':
(.text+0x206): undefined reference to
`xcb_connect_to_display_with_auth_info'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_disp.o):
In function `_XConnectXCB':
(.text+0x226): undefined reference to `xcb_get_file_descriptor'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_disp.o):
In function `_XConnectXCB':
(.text+0x243): undefined reference to `xcb_generate_id'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_disp.o):
In function `_XConnectXCB':
(.text+0x29c): undefined reference to `pthread_cond_init'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_disp.o):
In function `_XConnectXCB':
(.text+0x2ae): undefined reference to `pthread_cond_init'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_disp.o):
In function `_XConnectXCB':
(.text+0x2b6): undefined reference to `xcb_connection_has_error'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_disp.o):
In function `_XConnectXCB':
(.text+0x2d6): undefined reference to `xcb_connect'
collect2: error: ld returned 1 exit status

rajulocal@hogwarts:~/compile_static_gvim_native/problems$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5'
--with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.7 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--enable-gnu-unique-object --enable-plugin --enable-objc-gc
--with-arch-32=i586 --with-tune=generic --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.2 (Debian 4.7.2-5)

rajulocal@hogwarts:~/compile_static_gvim_native/problems$ dpkg -l libc6
ii  libc6:amd64
2.13-38                      amd64                        Embedded GNU C
Library: Shared libraries
ii  libc6:i386
2.13-38                      i386                         Embedded GNU C
Library: Shared libraries

rajulocal@hogwarts:~/compile_static_gvim_native/problems$ uname -a
Linux hogwarts 3.2.0-4-amd64 #1 SMP Debian 3.2.39-2 x86_64 GNU/Linux

#698052#24
Date:
2023-07-12 22:23:26 UTC
From:
To:
Control: retitle -1 libsdl1.2-dev: static linking not supported
Control: severity -1 wishlist
Control: notforwarded -1
Control: tags -1 = wontfix

libsdl1.2-dev is now provided by sdl12-compat, which doesn't ship a static
library, so this is not going to be fixable.

It wouldn't make much sense to link programs to sdl12-compat statically,
because sdl12-compat works by dlopen()ing SDL2, so there is dynamic
linking happening there whether you want it to or not.

In newer programs that have been ported to SDL2, linking to a static
SDL2 with CMake is possible (and there's an automated test for it), but
fully-static linking is impossible because some of SDL2's dependencies
(notably libasound) do not provide a static library at all.

    smcv

#698052#35
Date:
2023-07-12 22:23:26 UTC
From:
To:
Control: retitle -1 libsdl1.2-dev: static linking not supported
Control: severity -1 wishlist
Control: notforwarded -1
Control: tags -1 = wontfix

libsdl1.2-dev is now provided by sdl12-compat, which doesn't ship a static
library, so this is not going to be fixable.

It wouldn't make much sense to link programs to sdl12-compat statically,
because sdl12-compat works by dlopen()ing SDL2, so there is dynamic
linking happening there whether you want it to or not.

In newer programs that have been ported to SDL2, linking to a static
SDL2 with CMake is possible (and there's an automated test for it), but
fully-static linking is impossible because some of SDL2's dependencies
(notably libasound) do not provide a static library at all.

    smcv