Closed nackjicholson closed 5 years ago
I'm trying to work around it by installing with cpan
. But I'm honestly having a lot of trouble with that as well. I've never used perl before, so it's very difficult to troubleshoot.
Edit:
brew install gpg
cpan App::Sqitch DBD::Pg
Then I had to edit my $PATH
export PATH = "$PATH:/usr/local/Cellar/perl/5.28.0/bin"
🎉
Did that work?
I ran into this exact issue today while testing v0.9998 with the new formula (#38). When I dug into it, it was an error about not finding EXTERN.h
:
fatal error: 'EXTERN.h' file not found
#include "EXTERN.h"
^~~~~~~~~~
I'm pretty sure it's related to this issue with Homebrew on Mojave, and I can replicate it by simply trying to build the version module manually:
$ curl -O https://cpan.metacpan.org/authors/id/J/JP/JPEACOCK/version-0.9924.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 95064 100 95064 0 0 53800 0 0:00:01 0:00:01 --:--:-- 53830
$ tar zxf version-0.9924.tar.gz
$ cd version-0.9924
$ /usr/bin/perl Makefile.PL
Testing if you have a C compiler
Checking if your kit is complete...
Looks good
Writing Makefile for version::vxs
Writing MYMETA.yml and MYMETA.json
Writing Makefile for version
Writing MYMETA.yml and MYMETA.json
$ make
cp vperl/vpp.pm blib/lib/version/vpp.pm
cp lib/version/regex.pm blib/lib/version/regex.pm
cp lib/version.pm blib/lib/version.pm
cp lib/version.pod blib/lib/version.pod
cp lib/version/Internals.pod blib/lib/version/Internals.pod
cp lib/version/vxs.pm ../blib/lib/version/vxs.pm
/usr/bin/perl /System/Library/Perl/5.18/ExtUtils/xsubpp -typemap /System/Library/Perl/5.18/ExtUtils/typemap vxs.xs > vxs.xsc && mv vxs.xsc vxs.c
cc -c -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -Os -DVERSION=\"0.9924\" -DXS_VERSION=\"0.9924\" -iwithsysroot "/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE" vxs.c
vxs.xs:2:10: fatal error: 'EXTERN.h' file not found
#include "EXTERN.h"
^~~~~~~~~~
1 error generated.
make[1]: *** [vxs.o] Error 1
make: *** [subdirs] Error 2
EXTERN.h
does exist, but not in /System/Library/Perl/5.18/darwin-thread-multi-2level/CORE
. Instead, it's in /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE
. I spend some time trying to find the right environment variable to set (CPPFLAGS
, CCFLAGS
), to no avail before I had to go home.
Curiously, on my home computer now, also running Mohave, it's not a problem:
$ curl -O https://cpan.metacpan.org/authors/id/J/JP/JPEACOCK/version-0.9924.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 95064 100 95064 0 0 662k 0 --:--:-- --:--:-- --:--:-- 667k
$ tar zxf version-0.9924.tar.gz
$ cd version-0.9924
# /usr/bin/perl Makefile.PL
Testing if you have a C compiler
Writing Makefile for version::vxs
Writing MYMETA.yml and MYMETA.json
Writing Makefile for version
Writing MYMETA.yml and MYMETA.json
$ make
cp lib/version.pm blib/lib/version.pm
cp lib/version/Internals.pod blib/lib/version/Internals.pod
cp lib/version.pod blib/lib/version.pod
cp vperl/vpp.pm blib/lib/version/vpp.pm
cp lib/version/regex.pm blib/lib/version/regex.pm
cp lib/version/vxs.pm ../blib/lib/version/vxs.pm
/usr/bin/perl /System/Library/Perl/5.18/ExtUtils/xsubpp -typemap /System/Library/Perl/5.18/ExtUtils/typemap vxs.xs > vxs.xsc && mv vxs.xsc vxs.c
cc -c -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -Os -DVERSION=\"0.9924\" -DXS_VERSION=\"0.9924\" -iwithsysroot "/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE" vxs.c
In file included from vxs.xs:15:
./vutil.c:635:29: warning: expression result unused [-Wunused-value]
LC_NUMERIC_LOCK(0); /* Start critical section */
^
1 warning generated.
Running Mkbootstrap for version::vxs ()
chmod 644 vxs.bs
rm -f ../blib/arch/auto/version/vxs/vxs.bundle
cc -bundle -undefined dynamic_lookup -fstack-protector vxs.o -o ../blib/arch/auto/version/vxs/vxs.bundle \
\
chmod 755 ../blib/arch/auto/version/vxs/vxs.bundle
cp vxs.bs ../blib/arch/auto/version/vxs/vxs.bs
chmod 644 ../blib/arch/auto/version/vxs/vxs.bs
Manifying blib/man3/version::Internals.3pm
Manifying blib/man3/version.3pm
So now I'm completely mystified. I'll likely open a Radar with Apple tomorrow.
I think it's time to drop support for the system Perl. Look what PostgreSQL had to do to address the problem. Might be the Perl community can release updates to ExtUtils::MakeMaker and Module::Build to address the issue, but sheesh, Apple is not making this easy. By requiring the perl formula, we get the latest version of Perl, avoid this include issue, and it doesn't take long to install, since it's bottled. Testing now with the new formula.
Guess I'll have to add patches to pgenv, though. Annoying.
@theory Yeah, my workaround described above by installing with cpan
did ultimatel work. I had to install gpg
because one of the dependencies needed it. I had to fiddle with it a bit, and rerun the cpan install. I also installed cpanminus
in order to let myself clear everything and start over. But eventually I succeeded and am able to run sqitch
on my macbook osx mojave. 🍾 🏜
I really wish I knew more about perl and could help you, but I'm a mere python programmer. We have enough of our own problems :)
On a side note, I basically did the same thing on my Arch Linux personal computer. I installed with cpan
. I think if I hadn't done that prior, I would've been pretty lost on my work macbook.
Requiring the perl formula seems to do the trick. I suggest installing Perl before Sqitch until the new formula comes out in a couple days.
brew install perl
brew install sqitch_pg
@theory Can you please explain how you finally solved this issue? I also found that EXTERN.h is not in the location that the build system was looking for it. How did this problem come up in the first place?
Is there a way to remove all Perls installed on my system and do a completely clean install of Perl? Would that even help?
I simply stopped using the OS-provided Perl. I use plenv or brew install perl
.
For anyone still trying to troubleshoot this issue, I found the additional headers in this Library package on Mac Mojave 10.14.2
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
More details in this bug report
lioumens: thanks for the commands to get the additional headers for Mac Mojave. Once I ran the installer command, I was able to run cpan and "install Tk". I had already installed Xcode and the Xcode Command line tools and set the environment. All I need for success was sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
Great to know, thank you. I've mentioned this fix in 0ca0204.
I had the “Fatal error: 'EXTERN.h' file not found” while installing Perl modules for a locally installed bugzilla instance.
Installing brew and then brew install perl seemd to much for me. Then I looked further:
After reading https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes#3035624
and installing the additional headers from the package
I successfully compiled new mysql drivers and more XS code without the "missing 'EXTERN.h'"" error when using the command:
/usr/bin/perl install-module.pl Your::Module
I hope this will help you resolve your probelms as well.
For anyone still trying to troubleshoot this issue, I found the additional headers in this Library package on Mac Mojave 10.14.2
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
More details in this bug report
It works! Thank you!!!
Hey guys,
i have exactly the same problem on catalina now. But there is no more .pkg package under /Library/Developer/... anymore. Do you know a solution to this?
For anybody who's still struggling with this, my workaround was:
module="Sub::Util" # For example...
cpanm --configure-args="INC=-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE" "$module"