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

macOS Big Sur: failed test : array should contain one result or more: libc => () at t/DynaLoader.t #18406

Closed
hakonhagland opened this issue Dec 17, 2020 · 10 comments

Comments

@hakonhagland
Copy link
Contributor

When trying to install perl version 5.32.0 on macOS Big Sur I get a failed test:

perlbrew install perl-5.32.0
[...]
./ext/B/t/sv_stash.t .............................................. ok
../ext/B/t/terse.t ................................................. ok
../ext/B/t/walkoptree.t ............................................ ok
../ext/B/t/xref.t .................................................. ok
../ext/Devel-Peek/t/Peek.t ......................................... ok
# Failed test 20 - array should contain one result or more: libc => () at t/DynaLoader.t line 127
#      got "0"
# expected >= "1"
../ext/DynaLoader/t/DynaLoader.t ...................................
Failed 1/44 subtests
	(less 6 skipped subtests: 37 okay)
../ext/Errno/t/Errno.t ............................................. ok
../ext/Fcntl/t/autoload.t .......................................... ok

The issue was first reported here. The issue seems to be that Dynaloader::dl_findfile("c") cannot find the path to libc, see https://github.com/Perl/perl5/blob/blead/ext/DynaLoader/t/DynaLoader.t#L114. This is because the file does not exist, see https://developer.apple.com/documentation/macos-release-notes/macos-big-sur-11_0_1-release-notes :

New in macOS Big Sur 11.0.1, the system ships with a built-in dynamic linker cache of all system-provided libraries. As part of this change, copies of dynamic libraries are no longer present on the filesystem. Code that attempts to check for dynamic library presence by looking for a file at a path or enumerating a directory will fail. Instead, check for library presence by attempting to dlopen() the path, which will correctly check for the library in the cache.

Copy link
Contributor

I have an experimental branch (#18407) to fix this, but given I'm not a mac user I can't easily verify if it works or not (though I might get the CI working on Big Sur)

Copy link
Contributor

This has been fixed in d296ead :-)

@dseddah
Copy link

dseddah commented May 25, 2021

Hi,
on what Perl version is this fixed ? Do I need to install a special branch or something?

Copy link
Contributor

Hi,
on what Perl version is this fixed ? Do I need to install a special branch or something?

5.32.1/5.34.0 fixed this

@aero
Copy link

aero commented Oct 12, 2021

Hi,
I tried to install perl 5.32.1 on MacOS BigSur 11.6

$ perlbrew install perl-5.32.1 --as perl-5.32 --thread --noman
.
.
.
Result: FAIL
make: *** [test_harness] Error 1
##### Brew Failed #####

5.32.1 really fixed ?

@sdondley
Copy link

sdondley commented Jan 6, 2022

Broken for me on monterey:

Test Summary Report
-------------------
op/fork.t                                                          (Wstat: 0 Tests: 28 Failed: 1)
  Failed test:  13
op/incfilter.t                                                     (Wstat: 0 Tests: 151 Failed: 0)
  Parse errors: Bad plan.  You planned 153 tests but ran 151.
../cpan/IPC-Cmd/t/03_run-forked.t                                  (Wstat: 256 Tests: 114 Failed: 1)
  Failed test:  5
  Non-zero exit status: 1
../dist/IO/t/io_pipe.t                                             (Wstat: 0 Tests: 9 Failed: 0)
  Parse errors: Tests out of sequence.  Found (9) but expected (8)
                Tests out of sequence.  Found (10) but expected (9)
                Bad plan.  You planned 10 tests but ran 9.
../ext/DynaLoader/t/DynaLoader.t                                   (Wstat: 0 Tests: 44 Failed: 1)
  Failed test:  20
Files=2668, Tests=1185036, 802 wallclock secs (61.89 usr 19.50 sys + 440.93 cusr 94.78 csys = 617.10 CPU)
Result: FAIL
make: *** [test_harness] Error 3
##### Brew Failed #####

And looking at the etc/DynaLoader/DynaLoader.pm file, it has the the d296ead patch.

@hakonhagland
Copy link
Contributor Author

@sdondley Did you run perlbrew install-patchperl first? See this answer on stackoverflow

@sdondley
Copy link

sdondley commented Jan 6, 2022

@hakonhagland yes. updated perlbrew and patchperl.

@sdondley
Copy link

sdondley commented Jan 7, 2022

OK, the problem was due to my total idiocy having a script named echo in ~/bin. Disregard.

ELundby45 added a commit to AnacondaRecipes/perl-feedstock that referenced this issue Oct 27, 2022
@zetalog
Copy link

zetalog commented Jun 2, 2023

This still fails even when the patch is there.
Also I can see that the following code succeeds in a standalone script:

#!/usr/bin/perl -wT

use strict;
use Config;
use Test::More;

    my @files = ();
    eval { @files = DynaLoader::dl_findfile("c") };
    is( $@, '', "calling dl_findfile()" );
    # Some platforms are known to not have a "libc"
    # (not at least by that name) that the dl_findfile()
    # could find.
    skip "dl_findfile test not appropriate on $^O", 1
        if $^O =~ /(win32|vms|openbsd|cygwin)/i;
    # Play safe and only try this test if this system
    # looks pretty much Unix-like.
    skip "dl_findfile test not appropriate on $^O", 1
        unless -d '/usr' && -f '/bin/ls';
    cmp_ok( scalar @files, '>=', 1, "array should contain one result result or more: libc => (@files)" );

So this bug doesn't look root caused.
I encountered the problem in Windows WSL2.

Linux SurfaceBook2-B 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

This failure may be due to a wrongly detection of the unix system type.
And I can notice that this file is wrongly built during the build process:

NetWare/testnlm/echo/echo.c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants