Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libcurl-devel should depend on libunistring-devel for static linking #50980

Open
MoSal opened this issue Jun 25, 2024 · 5 comments
Open

libcurl-devel should depend on libunistring-devel for static linking #50980

MoSal opened this issue Jun 25, 2024 · 5 comments
Labels
bug Something isn't working needs-testing Testing a PR or reproducing an issue needed

Comments

@MoSal
Copy link

MoSal commented Jun 25, 2024

Is this a new report?

Yes

System Info

Void 6.6.35-2-lts x86_64-musl GenuineIntel uptodate rFF

Package(s) Affected

libcurl-devel-8.8.0_1

Does a report exist for this bug with the project's home (upstream) and/or another distro?

No response

Expected behaviour

Linking against libcurl statically should work.

Actual behaviour

Linking against libcurl statically fails due to:

  • Missing libunistring-devel package dependency
  • Missing -lunistring from the Libs.private line in /usr/lib/pkgconfig/libcurl.pc
Libs.private: -lnghttp2 -lidn2 -lssh2 -lssh2 -lpsl -lssl -lcrypto -lssl -lcrypto -lzstd -lzstd -lz

Steps to reproduce

Example file t.c:

#include <curl/curl.h>

int main() {
  curl_version_info_data *curl_info = curl_version_info(CURLVERSION_NOW);
  return 0;
}

Build and link statically (after installing libunistring-devel):

% gcc -o t t.c --static `pkg-config --libs --static libcurl`
/usr/sbin/ld: /usr/lib64/gcc/x86_64-linux-musl/13.2.0/../../../../lib64/libpsl.a(libpsl_la-psl.o): in function `psl_str_to_utf8lower':
(.text+0x13b4): undefined reference to `u8_strlen'
/usr/sbin/ld: (.text+0x13c9): undefined reference to `uninorm_nfkc'
/usr/sbin/ld: (.text+0x13d6): undefined reference to `u8_tolower'
/usr/sbin/ld: (.text+0x142f): undefined reference to `uninorm_nfkc'
/usr/sbin/ld: (.text+0x1434): undefined reference to `u8_tolower'
/usr/sbin/ld: /usr/lib64/gcc/x86_64-linux-musl/13.2.0/../../../../lib64/libidn2.a(lookup.o): in function `idn2_lookup_u8':
(.text+0x4e3): undefined reference to `u8_strlen'
/usr/sbin/ld: (.text+0x4f4): undefined reference to `u8_to_u32'
/usr/sbin/ld: (.text+0x613): undefined reference to `u32_to_u8'
/usr/sbin/ld: (.text+0x676): undefined reference to `u32_cmp'
/usr/sbin/ld: (.text+0x9c7): undefined reference to `u32_to_u8'
/usr/sbin/ld: (.text+0xa9a): undefined reference to `u32_to_u8'
/usr/sbin/ld: /usr/lib64/gcc/x86_64-linux-musl/13.2.0/../../../../lib64/libidn2.a(lookup.o): in function `idn2_to_ascii_4i2.part.0':
(.text+0xc25): undefined reference to `u32_cpy'
/usr/sbin/ld: (.text+0xc40): undefined reference to `u32_to_u8'
/usr/sbin/ld: /usr/lib64/gcc/x86_64-linux-musl/13.2.0/../../../../lib64/libidn2.a(lookup.o): in function `idn2_lookup_ul':
(.text+0xcef): undefined reference to `u8_strconv_from_encoding'
/usr/sbin/ld: /usr/lib64/gcc/x86_64-linux-musl/13.2.0/../../../../lib64/libidn2.a(lookup.o): in function `idn2_to_ascii_4z':
(.text+0xe2b): undefined reference to `u32_strlen'
/usr/sbin/ld: (.text+0xe3c): undefined reference to `u32_to_u8'
/usr/sbin/ld: /usr/lib64/gcc/x86_64-linux-musl/13.2.0/../../../../lib64/libidn2.a(decode.o): in function `idn2_to_unicode_8z4z':
(.text+0xae): undefined reference to `u8_to_u32'
/usr/sbin/ld: (.text+0xf1): undefined reference to `u32_cpy'
/usr/sbin/ld: (.text+0x127): undefined reference to `u32_cpy_alloc'
/usr/sbin/ld: (.text+0x1c1): undefined reference to `u32_cpy'
/usr/sbin/ld: /usr/lib64/gcc/x86_64-linux-musl/13.2.0/../../../../lib64/libidn2.a(decode.o): in function `idn2_to_unicode_4z4z.part.0':
(.text+0x271): undefined reference to `u32_strlen'
/usr/sbin/ld: (.text+0x284): undefined reference to `u32_to_u8'
/usr/sbin/ld: /usr/lib64/gcc/x86_64-linux-musl/13.2.0/../../../../lib64/libidn2.a(decode.o): in function `idn2_to_unicode_44i':
(.text+0x390): undefined reference to `u32_cpy'
/usr/sbin/ld: (.text+0x3c6): undefined reference to `u32_strlen'
/usr/sbin/ld: (.text+0x42a): undefined reference to `u32_cpy'
/usr/sbin/ld: /usr/lib64/gcc/x86_64-linux-musl/13.2.0/../../../../lib64/libidn2.a(decode.o): in function `idn2_to_unicode_8z8z':
(.text+0x49a): undefined reference to `u32_strlen'
/usr/sbin/ld: (.text+0x4ad): undefined reference to `u32_to_u8'
/usr/sbin/ld: /usr/lib64/gcc/x86_64-linux-musl/13.2.0/../../../../lib64/libidn2.a(decode.o): in function `idn2_to_unicode_8zlz':
(.text+0x563): undefined reference to `u8_strconv_to_encoding'
/usr/sbin/ld: /usr/lib64/gcc/x86_64-linux-musl/13.2.0/../../../../lib64/libidn2.a(decode.o): in function `idn2_to_unicode_lzlz':
(.text+0x5f0): undefined reference to `u8_strconv_from_encoding'
/usr/sbin/ld: /usr/lib64/gcc/x86_64-linux-musl/13.2.0/../../../../lib64/libidn2.a(libunistring_la-nfc.o):(.data.rel.ro+0x10): undefined reference to `uc_composition'
/usr/sbin/ld: /usr/lib64/gcc/x86_64-linux-musl/13.2.0/../../../../lib64/libidn2.a(libunistring_la-u32-normalize.o): in function `u32_normalize':
(.text+0x2f8): undefined reference to `u32_cpy'
/usr/sbin/ld: /usr/lib64/gcc/x86_64-linux-musl/13.2.0/../../../../lib64/libidn2.a(idna.o): in function `_idn2_u8_to_u32_nfc':
(.text+0x32): undefined reference to `u8_to_u32'
/usr/sbin/ld: /usr/lib64/gcc/x86_64-linux-musl/13.2.0/../../../../lib64/libidn2.a(idna.o): in function `_idn2_label_test':
(.text+0x3a0): undefined reference to `uc_is_general_category'
/usr/sbin/ld: /usr/lib64/gcc/x86_64-linux-musl/13.2.0/../../../../lib64/libidn2.a(libunistring_la-categ_of.o): in function `uc_general_category':
(.text+0x113): undefined reference to `_UC_CATEGORY_NONE'
collect2: error: ld returned 1 exit status

Add Missing -lunistring to Libs.private line in /usr/lib/pkgconfig/libcurl.pc

Libs.private: -lnghttp2 -lidn2 -lssh2 -lssh2 -lpsl -lssl -lcrypto -lssl -lcrypto -lzstd -lzstd -lz  -lunistring

Build and link statically again

% gcc -o t t.c --static `pkg-config --libs --static libcurl`

Success.

@MoSal MoSal added bug Something isn't working needs-testing Testing a PR or reproducing an issue needed labels Jun 25, 2024
@oreo639
Copy link
Member

oreo639 commented Jun 25, 2024

The issue here is that curl is missing Requires.private for libidn2.
This should be fixed upstream: curl/curl@f057de5

@MoSal
Copy link
Author

MoSal commented Jun 25, 2024

The issue here is that curl is missing Requires.private for libidn2. This should be fixed upstream: curl/curl@f057de5

Cool. The package dependency part remains.
libcurl-devel should pull libunistring-devel, directly or indirectly.

@oreo639
Copy link
Member

oreo639 commented Jun 25, 2024

Cool. The package dependency part remains.

libcurl-devel should not pull in libunistring-devel because libcurl does not depend on libunistring (static or not).
It is libidn2-devel that statically depends on libunistring-devel. (so the depends= would be added to libidn2-devel)

Also, in general we don't list static linking dependencies in packages with some exceptions (e.g. glib for qemu-user-static or incidentally because the dependencies headers are included in public headers). Not sure if curl is an exception though.

If so, the fix for that would be adding libunistring-devel to here: https://github.com/void-linux/void-packages/blob/master/srcpkgs/libidn2/template#L17

@MoSal
Copy link
Author

MoSal commented Jun 25, 2024

it is libidn2-devel that statically depends on libunistring-devel.

So it would be pulled indirectly, which is fine.

This is the first time I use void. So apologies for not understanding its ecosystem well.

@MoSal
Copy link
Author

MoSal commented Jun 25, 2024

libpsl.a uses symbols from libunistring too, just in case this gets missed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-testing Testing a PR or reproducing an issue needed
Projects
None yet
Development

No branches or pull requests

2 participants