PerlAlien / Alien-curl

Discover or download and install curl + libcurl
0 stars 2 forks source link

test failure macOS Ventura: ld: library not found for -lnghttp2 #18

Open shawnlaffan opened 1 year ago

shawnlaffan commented 1 year ago

Looks like some recent Macs do not have the nghttp2 library installed, or it is in a location the test is not checking. Test fail log is below.

This is for a share install, perl 5.36.0 via perlbrew. Let me know if you want the full perl -v and other details.

Installing nghttp2 via Homebrew does not change things but Homebrew also warns that it is keg only so is not in the path. (Curl is also keg only fwiw).

Tangential note, the system did not find curl on my system so it ran a share install.

t/alien_curl.t .. 2/? ld: warning: -undefined dynamic_lookup may not work with chained fixups

# Failed test 'xs'
# at t/alien_curl.t line 50.
#   ExtUtils::CBuilder->link failed
#     error building /Users/shawn/.cpanm/work/1668135943.74670/Alien-curl-0.10/_alien/tmp/test-alien-fuwQ9y/test.bundle from /Users/shawn/.cpanm/work/1668135943.74670/Alien-curl-0.10/_alien/tmp/test-alien-fuwQ9y/test.o at /Users/shawn/perl5/perlbrew/perls/perl-5.36.0/lib/5.36.0/ExtUtils/CBuilder/Base.pm line 332.
#     cc -L/Users/shawn/.cpanm/work/1668135943.74670/Alien-curl-0.10/blib/lib/auto/share/dist/Alien-curl/lib -mmacosx-version-min=13.0 -bundle -undefined dynamic_lookup -fstack-protector-strong -o /Users/shawn/.cpanm/work/1668135943.74670/Alien-curl-0.10/_alien/tmp/test-alien-fuwQ9y/test.bundle /Users/shawn/.cpanm/work/1668135943.74670/Alien-curl-0.10/_alien/tmp/test-alien-fuwQ9y/test.o -lcurl -lnghttp2 -lidn2 -lldap -lz -lnghttp2 -lidn2 -lldap -lz
#     ld: library not found for -lnghttp2
#     clang: error: linker command failed with exit code 1 (use -v to see invocation)
t/alien_curl.t .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/6 subtests 
plicease commented 1 year ago

We need better story with regard to Homebrew (meaning Alien-Build in general), and unfortunately it is harder for me to test this stuff now because I have switched to using Mac Ports for my newer macs as you don't have to deal with the keg only shenanigans.

Alien::OpenSSL does some custom detection for Homebrew: https://github.com/PerlAlien/Alien-OpenSSL/blob/5b753e3d0319e7fc7e7e95d22de8feefdf30f72f/alienfile#L28-L38

FWIW it works with my older Intel mac which is Homebrew based. I think that I have tested both share and system installs.

plicease commented 1 year ago

On Intel mac Homebrew installs into /usr/local instead of the new location (which I forget off the top of my head), not sure if that matters.

shawnlaffan commented 1 year ago

There should be an env var HOMEBREW_PREFIX to get to the install location. There should also be HOMEBREW_CELLAR and HOMEBREW_REPOSITORY.

Using those would simplify the probe logic, unless of course those dirs are in use by non-homebrew systems.

shawnlaffan commented 1 year ago

There is also brew query: https://docs.brew.sh/Querying-Brew

This can return a json string with info that can be parsed to extract the install location based on the OS version.