sqitchers / homebrew-sqitch

Homebrew Formulas for Sqitch
22 stars 10 forks source link

Failed to install on OSX Mojave Mac::SystemDirectory is not installed. #39

Closed nackjicholson closed 5 years ago

nackjicholson commented 5 years ago
[1] nackjicholson@Williams-MacBook-Pro-2> brew install sqitch_pg                                                                     ~/repos
==> Installing sqitch_pg from sqitchers/sqitch
==> Installing dependencies for sqitchers/sqitch/sqitch_pg: sqitch_dependencies, sqitch
==> Installing sqitchers/sqitch/sqitch_pg dependency: sqitch_dependencies
==> Downloading https://fastapi.metacpan.org/v1/source/DWHEELER/App-Sqitch-0.9997/META.json
Already downloaded: /Users/nackjicholson/Library/Caches/Homebrew/downloads/f6fb89ad96680355bc547e78703a15ce5c3cb09be98459b86ad95a6eeadf8ea2--META.json
==> cpanm --local-lib '/usr/local/Cellar/sqitch_dependencies/0.9997' --notest Module::Build
==> cpanm --local-lib '/usr/local/Cellar/sqitch_dependencies/0.9997' --notest Module::Build
==> cpanm --local-lib '/usr/local/Cellar/sqitch_dependencies/0.9997' --notest Class::XSAccessor
==> cpanm --local-lib '/usr/local/Cellar/sqitch_dependencies/0.9997' --notest Pod::Simple
==> cpanm --local-lib '/usr/local/Cellar/sqitch_dependencies/0.9997' --notest Type::Tiny::XS
==> cpanm --local-lib '/usr/local/Cellar/sqitch_dependencies/0.9997' --notest Clone
==> cpanm --local-lib '/usr/local/Cellar/sqitch_dependencies/0.9997' --notest Config::GitLike
==> cpanm --local-lib '/usr/local/Cellar/sqitch_dependencies/0.9997' --notest DBI
==> cpanm --local-lib '/usr/local/Cellar/sqitch_dependencies/0.9997' --notest DateTime
==> cpanm --local-lib '/usr/local/Cellar/sqitch_dependencies/0.9997' --notest DateTime::TimeZone
==> cpanm --local-lib '/usr/local/Cellar/sqitch_dependencies/0.9997' --notest Devel::StackTrace
==> cpanm --local-lib '/usr/local/Cellar/sqitch_dependencies/0.9997' --notest Digest::SHA
==> cpanm --local-lib '/usr/local/Cellar/sqitch_dependencies/0.9997' --notest Encode
==> cpanm --local-lib '/usr/local/Cellar/sqitch_dependencies/0.9997' --notest Encode::Locale
==> cpanm --local-lib '/usr/local/Cellar/sqitch_dependencies/0.9997' --notest File::Basename
==> cpanm --local-lib '/usr/local/Cellar/sqitch_dependencies/0.9997' --notest File::Copy
==> cpanm --local-lib '/usr/local/Cellar/sqitch_dependencies/0.9997' --notest File::HomeDir
Last 15 lines from /Users/nackjicholson/Library/Logs/Homebrew/sqitch_dependencies/17.0.9997':
2018-10-02 09:11:17 -0700

cpanm --local-lib '/usr/local/Cellar/sqitch_dependencies/0.9997' --notest File::HomeDir

--> Working on File::HomeDir
Fetching http://www.cpan.org/authors/id/R/RE/REHSACK/File-HomeDir-1.004.tar.gz ... OK
Configuring File-HomeDir-1.004 ... OK
==> Found dependencies: Mac::SystemDirectory
--> Working on Mac::SystemDirectory
Fetching http://www.cpan.org/authors/id/E/ET/ETHER/Mac-SystemDirectory-0.10.tar.gz ... OK
Configuring Mac-SystemDirectory-0.10 ... ! Configure failed for Mac-SystemDirectory-0.10. See /private/tmp/sqitch_dependencies-20181002-154-1lh65sb/.brew_home/.cpanm/work/1538496677.10282/build.log for details.
! Installing the dependencies failed: Module 'Mac::SystemDirectory' is not installed
! Bailing out the installation for File-HomeDir-1.004.
N/A

If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
https://github.com/sqitchers/homebrew-sqitch/issues
nackjicholson commented 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"

🎉

theory commented 5 years ago

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.

theory commented 5 years ago

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.

nackjicholson commented 5 years ago

@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.

theory commented 5 years ago

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
balajirama commented 5 years ago

@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?

theory commented 5 years ago

I simply stopped using the OS-provided Perl. I use plenv or brew install perl.

lioumens commented 5 years ago

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

SuperStevePrice commented 5 years ago

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 /

theory commented 5 years ago

Great to know, thank you. I've mentioned this fix in 0ca0204.

mjmeijer commented 5 years ago

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 /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

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.

markwwen commented 5 years ago

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!!!

maxbec commented 4 years ago

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?

DabeDotCom commented 3 years ago

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"