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

Can't build on OS X (arm) #14

Open
isaacl opened this issue Oct 9, 2023 · 3 comments
Open

Can't build on OS X (arm) #14

isaacl opened this issue Oct 9, 2023 · 3 comments
Assignees

Comments

@isaacl
Copy link

isaacl commented Oct 9, 2023

Not sure if this requires homebrew berkeley-db. In any case, I do have that package installed, but this doesn't help

export LDFLAGS="-L/opt/homebrew/opt/berkeley-db/lib"
export CPPFLAGS="-I/opt/homebrew/opt/berkeley-db/include"

cpan output

cpanm (App::cpanminus) 1.7047 on perl 5.038000 built for darwin-thread-multi-2level
Work directory is /Users/ilevy/.cpanm/work/1696859796.27435
You have make /usr/bin/make
You have /opt/homebrew/bin/wget
You have /usr/bin/tar: bsdtar 3.5.3 - libarchive 3.5.3 zlib/1.2.12 liblzma/5.0.5 bz2lib/1.0.8 
You have /usr/bin/unzip
Searching DB_File () on cpanmetadb ...
--> Working on DB_File
Fetching http://www.cpan.org/authors/id/P/PM/PMQS/DB_File-1.859.tar.gz
-> OK
Unpacking DB_File-1.859.tar.gz
Entering DB_File-1.859
Checking configure dependencies from META.json
Checking if you have ExtUtils::MakeMaker 6.58 ... Yes (7.70)
Configuring DB_File-1.859
Running Makefile.PL
Parsing config.in...
Looks Good.
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for DB_File
Writing MYMETA.yml and MYMETA.json
-> OK
Checking dependencies from MYMETA.json ...
Checking if you have ExtUtils::MakeMaker 0 ... Yes (7.70)
Building and testing DB_File-1.859
cp DB_File.pm blib/lib/DB_File.pm
Running Mkbootstrap for DB_File ()
chmod 644 "DB_File.bs"
"/opt/homebrew/Cellar/perl/5.38.0/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- DB_File.bs blib/arch/auto/DB_File/DB_File.bs 644
cc -c  -I/usr/local/BerkeleyDB/include -fno-common -DPERL_DARWIN -mmacosx-version-min=14.0 -DNO_POSIX_2008_LOCALE -fno-strict-aliasing -pipe -fstack-protector-strong -Wno-error=implicit-function-declaration -O3   -DVERSION=\"1.859\" -DXS_VERSION=\"1.859\"  "-I/opt/homebrew/opt/perl/lib/perl5/5.38/darwin-thread-multi-2level/CORE"  -D_NOT_CORE  -DmDB_Prefix_t=size_t -DmDB_Hash_t=u_int32_t   version.c
"/opt/homebrew/Cellar/perl/5.38.0/bin/perl" "/opt/homebrew/opt/perl/lib/perl5/5.38/ExtUtils/xsubpp" -noprototypes -typemap '/opt/homebrew/opt/perl/lib/perl5/5.38/ExtUtils/typemap' -typemap '/Users/ilevy/.cpanm/work/1696859796.27435/DB_File-1.859/typemap'  DB_File.xs > DB_File.xsc
mv DB_File.xsc DB_File.c
cc -c  -I/usr/local/BerkeleyDB/include -fno-common -DPERL_DARWIN -mmacosx-version-min=14.0 -DNO_POSIX_2008_LOCALE -fno-strict-aliasing -pipe -fstack-protector-strong -Wno-error=implicit-function-declaration -O3   -DVERSION=\"1.859\" -DXS_VERSION=\"1.859\"  "-I/opt/homebrew/opt/perl/lib/perl5/5.38/darwin-thread-multi-2level/CORE"  -D_NOT_CORE  -DmDB_Prefix_t=size_t -DmDB_Hash_t=u_int32_t   DB_File.c
rm -f blib/arch/auto/DB_File/DB_File.bundle
LD_RUN_PATH="/opt/homebrew/Cellar/berkeley-db/18.1.40_2/lib" cc -Wl,-rpath,"/opt/homebrew/Cellar/berkeley-db/18.1.40_2/lib" -mmacosx-version-min=14.0 -bundle -undefined dynamic_lookup -fstack-protector-strong  version.o DB_File.o  -o blib/arch/auto/DB_File/DB_File.bundle  \
	   -ldb   \
	  
ld: library 'db' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [blib/arch/auto/DB_File/DB_File.bundle] Error 1
-> FAIL Installing DB_File failed. See /Users/ilevy/.cpanm/work/1696859796.27435/build.log for details. Retry with --force to force install it.
$ env | grep -i perl
PATH=/Users/ilevy/.rbenv/shims:/Users/ilevy/.pyenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/ilevy/bin:/Users/ilevy/.local/bin:/Library/Ruby/Gems/2.6.0:/usr/local/sbin:/Users/ilevy/perl5/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin
PERL5LIB=/Users/ilevy/perl5/lib/perl5
PERL_LOCAL_LIB_ROOT=/Users/ilevy/perl5
PERL_MB_OPT=--install_base "/Users/ilevy/perl5"
PERL_MM_OPT=INSTALL_BASE=/Users/ilevy/perl5
@isaacl isaacl changed the title Can't build on OS X Can't build on OS X (arm) Oct 9, 2023
@pmqs pmqs self-assigned this Oct 9, 2023
@pmqs
Copy link
Owner

pmqs commented Oct 9, 2023

You do indeed need either homebrew or some other way of getting a copy of the Berkeley DB library onto your setup. If you look at my MacOS GitHub workflow for this module, here, you will see that I use homebrew to get berkeley db.

Apart from that it just works for me - no need to set any environment variables at all

Looking at your build it looks line the code has found the db.h include file. So you are part of the way there.

Try exporting the environment variable DB_FILE_LIB with value /opt/homebrew/opt/berkeley-db/lib

If that doesn't work can you check what the name of the berkeley db library was installed as

@isaacl
Copy link
Author

isaacl commented Oct 9, 2023

Setting DB_FILE_LIB worked!

(I did see that var in the build file, but I thought you'd want to know the build is potentially broken for others)

@pmqs
Copy link
Owner

pmqs commented Oct 9, 2023

Setting DB_FILE_LIB worked!

Brilliant

(I did see that var in the build file, but I thought you'd want to know the build is potentially broken for others)

Yep. The install documentation needs a bit of an overhaul.

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

No branches or pull requests

2 participants