Statically linking to libX11
Vanessa McHale
vanessa.mchale at iohk.io
Tue May 7 18:14:54 UTC 2019
Hi all,
I am trying to cross-compile xmobar for ARM and unfortunately my C
cross-compiler uses a different libc version; I figured static linking
would give me a usable binary. Unfortunately, trying to cross-compile
yields:
Linking
/home/vanessa/programming/haskell/done/xmobar-vanessa/dist-newstyle/build/aarch64-linux/ghc-8.6.4/xmobar-vanessa-0.1.0.0/x/xmobar/build/xmobar/xmobar
...
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld:
/usr/local/lib/aarch64-linux-gnu-ghc-8.6.4/rts/libHSrts.a(Linker.o): in
function `internal_dlopen':
/home/vanessa/cross/ghc-8.6.4/rts/Linker.c:600:0: error:
warning: Using 'dlopen' in statically linked applications requires
at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld:
/home/vanessa/.cabal/store/ghc-8.6.4/network-3.1.0.0-b60cf17d11d7eda024959ae28f710f94d7565bcd8e3372f04f32d2600769c2c1/lib/libHSnetwork-3.1.0.0-b60cf17d11d7eda024959ae28f710f94d7565bcd8e3372f04f32d2600769c2c1.a(HsNet.o):
in function `hsnet_getaddrinfo':
HsNet.c:(.text+0x10): warning: Using 'getaddrinfo' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld:
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/lib/../lib/libX11.a(xcb_io.o):
in function `require_socket':
/tmp/cpkg-2c6d48cdbb4678ca/libX11-1.6.7/src/xcb_io.c:68:0: error:
undefined reference to `xcb_take_socket'
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld:
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/lib/../lib/libX11.a(xcb_io.o):
in function `poll_for_event':
/tmp/cpkg-2c6d48cdbb4678ca/libX11-1.6.7/src/xcb_io.c:245:0: error:
undefined reference to `xcb_poll_for_event'
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld:
/tmp/cpkg-2c6d48cdbb4678ca/libX11-1.6.7/src/xcb_io.c:243: undefined
reference to `xcb_poll_for_queued_event'
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld:
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/lib/../lib/libX11.a(xcb_io.o):
in function `poll_for_response':
/tmp/cpkg-2c6d48cdbb4678ca/libX11-1.6.7/src/xcb_io.c:284:0: error:
undefined reference to `xcb_poll_for_reply64'
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld:
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/lib/../lib/libX11.a(xcb_io.o):
in function `_XSend':
/tmp/cpkg-2c6d48cdbb4678ca/libX11-1.6.7/src/xcb_io.c:499:0: error:
undefined reference to `xcb_writev'
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld:
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/lib/../lib/libX11.a(xcb_io.o):
in function `_XEventsQueued':
/tmp/cpkg-2c6d48cdbb4678ca/libX11-1.6.7/src/xcb_io.c:364:0: error:
undefined reference to `xcb_connection_has_error'
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld:
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/lib/../lib/libX11.a(xcb_io.o):
in function `_XReadEvents':
/tmp/cpkg-2c6d48cdbb4678ca/libX11-1.6.7/src/xcb_io.c:441:0: error:
undefined reference to `xcb_connection_has_error'
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld:
/tmp/cpkg-2c6d48cdbb4678ca/libX11-1.6.7/src/xcb_io.c:400: undefined
reference to `xcb_wait_for_event'
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld:
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/lib/../lib/libX11.a(xcb_io.o):
in function `_XAllocIDs':
/tmp/cpkg-2c6d48cdbb4678ca/libX11-1.6.7/src/xcb_io.c:549:0: error:
undefined reference to `xcb_generate_id'
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld:
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/lib/../lib/libX11.a(xcb_io.o):
in function `_XReply':
/tmp/cpkg-2c6d48cdbb4678ca/libX11-1.6.7/src/xcb_io.c:609:0: error:
undefined reference to `xcb_wait_for_reply64'
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld:
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/lib/../lib/libX11.a(ClDisplay.o):
in function `XCloseDisplay':
/tmp/cpkg-2c6d48cdbb4678ca/libX11-1.6.7/src/ClDisplay.c:71:0: error:
undefined reference to `xcb_disconnect'
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld:
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/lib/../lib/libX11.a(OpenDis.o):
in function `OutOfMemory':
/tmp/cpkg-2c6d48cdbb4678ca/libX11-1.6.7/src/OpenDis.c:705:0: error:
undefined reference to `xcb_disconnect'
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld:
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/lib/../lib/libX11.a(OpenDis.o):
in function `XOpenDisplay':
/tmp/cpkg-2c6d48cdbb4678ca/libX11-1.6.7/src/OpenDis.c:255:0: error:
undefined reference to `xcb_get_setup'
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld:
/tmp/cpkg-2c6d48cdbb4678ca/libX11-1.6.7/src/OpenDis.c:498: undefined
reference to `xcb_get_maximum_request_length'
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld:
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/lib/../lib/libX11.a(xcb_disp.o):
in function `_XConnectXCB':
/tmp/cpkg-2c6d48cdbb4678ca/libX11-1.6.7/src/xcb_disp.c:69:0: error:
undefined reference to `xcb_parse_display'
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld:
/tmp/cpkg-2c6d48cdbb4678ca/libX11-1.6.7/src/xcb_disp.c:76: undefined
reference to `xcb_connect_to_display_with_auth_info'
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld:
/tmp/cpkg-2c6d48cdbb4678ca/libX11-1.6.7/src/xcb_disp.c:81: undefined
reference to `xcb_get_file_descriptor'
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld:
/tmp/cpkg-2c6d48cdbb4678ca/libX11-1.6.7/src/xcb_disp.c:84: undefined
reference to `xcb_generate_id'
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld:
/tmp/cpkg-2c6d48cdbb4678ca/libX11-1.6.7/src/xcb_disp.c:92: undefined
reference to `xcb_connection_has_error'
/usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld:
/tmp/cpkg-2c6d48cdbb4678ca/libX11-1.6.7/src/xcb_disp.c:78: undefined
reference to `xcb_connect'
collect2: error: ld returned 1 exit status
`aarch64-linux-gnu-gcc' failed in phase `Linker'. (Exit code: 1)
I've had a look at libX11.a with
nm /usr/aarch64-linux-gnu/lib/libX11.a | grep 'xcb_take_socket'
which returns
U xcb_take_socket
As far as I can tell, the initial failure is expected given that result.
But I still don't know how to build libX11.a "properly" to get rid of
the Us.
Thanks!
Vanessa McHale
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.x.org/archives/xorg/attachments/20190507/5922c4c0/attachment.sig>
More information about the xorg
mailing list