You are not logged in.

#1 2019-03-28 12:35:12

ruffy
Member
Registered: 2017-06-10
Posts: 19

missing static libraries

Hi all!

I am working on an OCaml project which I want to compile statically, but the problem is that on arch some static libraries are missing.

I can compile it dynamically, but when I want to compile it statically I get the following:

/usr/bin/ld: cannot find -lgmp
/usr/bin/ld: cannot find -lxslt
/usr/bin/ld: cannot find -lxml2
/usr/bin/ld: cannot find -licui18n
/usr/bin/ld: cannot find -licuuc
/usr/bin/ld: cannot find -licudata
/usr/bin/ld: cannot find -llzma

So I tried to install them manually, but I again get some errors:

/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/../../../../lib/libxml2.a(xmlmodule.o): in function `xmlModuleOpen':
(.text+0x40): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/lib/ocaml/libunix.a(initgroups.o): in function `unix_initgroups':
(.text+0x1f): warning: Using 'initgroups' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/lib/ocaml/libunix.a(getgr.o): in function `unix_getgrgid':
(.text+0x18e): warning: Using 'getgrgid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/lib/ocaml/libunix.a(getgr.o): in function `unix_getgrnam':
(.text+0x134): warning: Using 'getgrnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/lib/ocaml/libunix.a(getpw.o): in function `unix_getpwnam':
(.text+0x194): warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/lib/ocaml/libunix.a(getpw.o): in function `unix_getpwuid':
(.text+0x1ee): warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/lib/ocaml/libunix.a(getaddrinfo.o): in function `unix_getaddrinfo':
(.text+0x229): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/lib/ocaml/libunix.a(gethost.o): in function `unix_gethostbyaddr':
(.text+0x22f): warning: Using 'gethostbyaddr_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/../../../../lib/libxml2.a(nanohttp.o): in function `xmlNanoHTTPConnectHost':
(.text+0x955): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/lib/ocaml/libunix.a(gethost.o): in function `unix_gethostbyname':
(.text+0x2d9): warning: Using 'gethostbyname_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/lib/ocaml/libunix.a(getproto.o): in function `unix_getprotobynumber':
(.text+0x108): warning: Using 'getprotobynumber' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/lib/ocaml/libunix.a(getproto.o): in function `unix_getprotobyname':
(.text+0xe1): warning: Using 'getprotobyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/lib/ocaml/libunix.a(getserv.o): in function `unix_getservbyname':
(.text+0x138): warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/lib/ocaml/libunix.a(getserv.o): in function `unix_getservbyport':
(.text+0x186): warning: Using 'getservbyport' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/../../../../lib/libxml2.a(encoding.o): in function `openIcuConverter':
(.text+0xf2d): undefined reference to `ucnv_open_63'
/usr/bin/ld: (.text+0xf59): undefined reference to `UCNV_FROM_U_CALLBACK_STOP_63'
/usr/bin/ld: (.text+0xf5f): undefined reference to `ucnv_setFromUCallBack_63'
/usr/bin/ld: (.text+0xf7f): undefined reference to `ucnv_open_63'
/usr/bin/ld: (.text+0xf99): undefined reference to `ucnv_close_63'
/usr/bin/ld: (.text+0xfd3): undefined reference to `UCNV_TO_U_CALLBACK_STOP_63'
/usr/bin/ld: (.text+0xfd9): undefined reference to `ucnv_setToUCallBack_63'
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/../../../../lib/libxml2.a(encoding.o): in function `xmlUconvWrapper':
(.text+0x1188): undefined reference to `ucnv_convertEx_63'
/usr/bin/ld: (.text+0x1213): undefined reference to `ucnv_convertEx_63'
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/../../../../lib/libxml2.a(encoding.o): in function `closeIcuConverter.part.1':
(.text+0x12dc): undefined reference to `ucnv_close_63'
/usr/bin/ld: (.text+0x12e6): undefined reference to `ucnv_close_63'
collect2: error: ld returned 1 exit status
File "caml_startup", line 1:
Error: Error during linking

I have tried it on a Linux Mint machine of a friend, where static compilation worked out of the box.

Does anybody has a solution for that?
Is there a general solution to get static libraries via pacman?

Thanks!

Last edited by ruffy (2019-03-28 12:46:56)

Offline

#2 2019-03-28 12:55:05

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 21,708
Website

Re: missing static libraries

ruffy wrote:

Is there a general solution to get static libraries via pacman?

No.  Pacman is completely orthogonal to the issue.  Arch just generally does not package static libraries.  If you need to do any static linking, then rebuilding any (and all) libraries you need to staticly link to is the right approach.  I don't know enough about libxml2 to help with the errors of rebuilding it, but that's where you need to keep working.

Note, if you intend to frequently statically link substantial projects, arch may not be an ideal distro.  I statically link many simple / small tools I use, but they have a pretty trivial library dependency tree to start with.

Last edited by Trilby (2019-03-28 12:56:50)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2019-03-28 13:24:45

ruffy
Member
Registered: 2017-06-10
Posts: 19

Re: missing static libraries

Trilby wrote:
ruffy wrote:

Is there a general solution to get static libraries via pacman?

No.  Pacman is completely orthogonal to the issue.  Arch just generally does not package static libraries.  If you need to do any static linking, then rebuilding any (and all) libraries you need to staticly link to is the right approach.  I don't know enough about libxml2 to help with the errors of rebuilding it, but that's where you need to keep working.

Note, if you intend to frequently statically link substantial projects, arch may not be an ideal distro.  I statically link many simple / small tools I use, but they have a pretty trivial library dependency tree to start with.


Hmmmmm, I definitely do not want to switch to a different distribution.

Is there a possibility to change the PKGBUILD before pacman builds/installs the package?
I think there I could change something that I also get static libs...

Offline

#4 2019-03-28 13:51:01

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 8,867
Website

Re: missing static libraries

Arch (typically? There may be exceptions) does not package static libraries if there is a shared equivalent. You can disable this behaviour by rebuilding the affected packages with the "staticlibs" option.

man PKGBUILD | less -p '  options'

Do you really need to statically link whatever it is that you're building? If so, it may be easier to create a chroot/container of a staticlib-friendly distribution (e.g. debian) and build in that instead of rebuilding Arch packages.


Sakura:-
Mobo: MSI X299 TOMAHAWK ARCTIC // Processor: Intel Core i7-7820X 3.6GHz // GFX: nVidia GeForce GTX 970 // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 5x 1TB HDD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#5 2019-03-28 14:02:34

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 21,708
Website

Re: missing static libraries

ruffy wrote:

Is there a possibility to change the PKGBUILD before pacman builds/installs the package?
I think there I could change something that I also get static libs...

Ah, yeah.  It's very clearly covered in the documentation.  But that would - as stated - require rebuilding the packages.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

Board footer

Powered by FluxBB