Closed dxdc closed 4 years ago
Here's the problem:
ld: library not found for -lgcc_s.10.4 clang: error: linker command failed with exit code 1 (use -v to see invocation) No compiler found, won't generate 'script/parl!
These were produced by calling
my $have_cc = ExtUtils::CBuilder->new->have_compiler;
which relies on the information from perl's Config
.
Please post the output of type perl
and perl -V
.
You're right @rschupp !
I dug into this and found some relevant information. The problem is related to perlbrew. I tried on a system install (/usr/bin/cpan) and that worked just fine.
I'm not sure if there's more work to be done at this point to support perlbrew installations, but I appreciate you helping me to at least figure out the root cause ExtUtils::CBuilder
. I tried updating ExtUtils::CBuilder with CPAN but that doesn't change the result.
One point that could be relevant, is that I compiled perlbrew to get versions that would be compatible on older platforms like this:
perlbrew install 5.18.4 -Accflags="-mmacosx-version-min=10.7" -Aldflags="-mmacosx-version-min=10.7" -Alddlflags="-mmacosx-version-min=10.7" --notest
#!/usr/bin/perl
use ExtUtils::CBuilder;
my $have_cc = ExtUtils::CBuilder->new->have_compiler;
Which returns:
ld: warning: directory not found for option '-L/usr/local/opt/lib'
ld: library not found for -lgcc_s.10.4
clang: error: linker command failed with exit code 1 (use -v to see invocation)
(Perlbrew install) : /usr/local/bin/perl -V
Summary of my perl5 (revision 5 version 18 subversion 2) configuration:
Platform:
osname=darwin, osvers=13.1.0, archname=darwin-2level
uname='darwin dcaspi.local 13.1.0 darwin kernel version 13.1.0: thu jan 16 19:40:37 pst 2014; root:xnu-2422.90.20~2release_x86_64 x86_64 '
config_args=''
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include',
optimize='-O3',
cppflags='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include'
ccversion='', gccversion='4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.38)', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -fstack-protector -L/usr/local/lib -L/opt/local/lib'
libpth=/usr/local/lib /opt/local/lib /usr/lib
libs=-ldbm -ldl -lm -lutil -lc
perllibs=-ldl -lm -lutil -lc
libc=, so=dylib, useshrplib=false, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -L/opt/local/lib -fstack-protector'
Characteristics of this binary (from libperl):
Compile-time options: HAS_TIMES PERLIO_LAYERS PERL_DONT_CREATE_GVSV
PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP
PERL_PRESERVE_IVUV PERL_SAWAMPERSAND USE_64_BIT_ALL
USE_64_BIT_INT USE_LARGE_FILES USE_LOCALE
USE_LOCALE_COLLATE USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
Built under darwin
Compiled at Apr 9 2014 22:20:07
@INC:
/usr/local/lib/perl5/site_perl/5.18.2/darwin-2level
/usr/local/lib/perl5/site_perl/5.18.2
/usr/local/lib/perl5/5.18.2/darwin-2level
/usr/local/lib/perl5/5.18.2
/usr/local/lib/perl5/site_perl
.
(System Install) : /usr/bin/perl -V
Summary of my perl5 (revision 5 version 18 subversion 4) configuration:
Platform:
osname=darwin, osvers=18.0, archname=darwin-thread-multi-2level
uname='darwin osx316.apple.com 18.0 darwin kernel version 17.0.0: fri may 4 10:33:38 pdt 2018; root:xnu-4570.1.46.100.2~1development_x86_64 x86_64 '
config_args='-ds -e -Dprefix=/usr -Dccflags=-g -pipe -Dldflags= -Dman3ext=3pm -Duseithreads -Duseshrplib -Dinc_version_list=none -Dcc=cc'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags =' -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector',
optimize='-Os',
cppflags='-g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector'
ccversion='', gccversion='4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -fstack-protector'
libpth=/usr/lib /usr/local/lib
libs=
perllibs=
libc=, so=dylib, useshrplib=true, libperl=libperl.dylib
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -fstack-protector'
Characteristics of this binary (from libperl):
Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
PERL_DONT_CREATE_GVSV
PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
PERL_PRESERVE_IVUV PERL_SAWAMPERSAND USE_64_BIT_ALL
USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
USE_REENTRANT_API
Locally applied patches:
/Library/Perl/Updates/<version> comes before system perl directories
installprivlib and installarchlib points to the Updates directory
Built under darwin
Compiled at Apr 1 2019 13:12:58
@INC:
/Library/Perl/5.18/darwin-thread-multi-2level
/Library/Perl/5.18
/Network/Library/Perl/5.18/darwin-thread-multi-2level
/Network/Library/Perl/5.18
/Library/Perl/Updates/5.18.4
/System/Library/Perl/5.18/darwin-thread-multi-2level
/System/Library/Perl/5.18
/System/Library/Perl/Extras/5.18/darwin-thread-multi-2level
/System/Library/Perl/Extras/5.18
.
Hmm, your perlbrew perl seems to have been built with another version of clang than
the system version (or maybe env MACOSX_DEPLOYMENT_TARGET=10.3 cc
selects a different version).
Comment out the line (~215)
local $self->{quiet} = 1;
in .../ExtUtils/CBuilder/Base.pm and run (try both with the system and perlbrew perl)
perl -MExtUtils::CBuilder 'say ExtUtils::CBuilder->new->have_compiler'
then you should see the exact commands that ExtUtils::CBuilder
executes.
I think it should have been:
perl -MExtUtils::CBuilder -E 'CORE::say ExtUtils::CBuilder->new->have_compiler'
cc -I/usr/local/lib/perl5/5.18.2/darwin-2level/CORE -c -fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include -O3 -o compilet-5Q0ps.o compilet-5Q0ps.c
env MACOSX_DEPLOYMENT_TARGET=10.3 cc -bundle -undefined dynamic_lookup -L/usr/local/lib -L/opt/local/lib -fstack-protector -o compilet-5Q0ps.bundle compilet-5Q0ps.o
ld: library not found for -lgcc_s.10.4
clang: error: linker command failed with exit code 1 (use -v to see invocation)
0
cc -I/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -c -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -Os -o compilet-vZUeS.o compilet-vZUeS.c
env LD_RUN_PATH=/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE cc -bundle -undefined dynamic_lookup -fstack-protector -o compilet-vZUeS.bundle compilet-vZUeS.o
1
Interesting - where does
env LD_RUN_PATH=/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE cc ...
come from, it doesn't show in perl -V
?
Likely here:
CBuilder/Base.pm: warn "PERL_CORE is set but I can't find your perl source!\n";
CBuilder/Base.pm: return ''; # return empty string if $ENV{PERL_CORE} but can't find dir ???
CBuilder/Base.pm: $self->perl_src() || File::Spec->catdir($self->{config}{archlibexp},"CORE");
More likely in ...ExtUtils/CBuilder/Platform/Unix.pm
(look for 'env').
There's also .../ExtUtils/CBuilder/Platform/darwin.pm
.
Just confirmed it comes from that line in Base.pm
. I tried replacing CORE
with CORE_TEST
and sure enough, it changed the output.
Running macOS 10.14.6. I feel like I've compiled this previously, but upgrading to the newest PAR failed. Sharing some other debugging messages.
I think these articles may be related to the problem?
I see plenty of files here, like this one:
/usr/local/lib/gcc/9/libgcc_ext.10.4.dylib
Some other output, which may be useful:
(installed with -f)