dbdpg icon indicating copy to clipboard operation
dbdpg copied to clipboard

ld -rpath error when compiling on Mac (12.0.1)

Open mstratman opened this issue 5 months ago • 13 comments

Using perl-5.40.0 from perlbrew I get the following error (full build log attached):

LD_RUN_PATH="/Applications/Postgres.app/Contents/Versions/9.6/lib" env MACOSX_DEPLOYMENT_TARGET=10.3 cc -Wl,-rpath,"/Applications/Postgres.app/Contents/Versions/9.6/lib" -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector-strong  Pg.o dbdimp.o quote.o types.o  -o blib/arch/auto/DBD/Pg/Pg.bundle  \
	   -L/Applications/Postgres.app/Contents/Versions/9.6/lib -lpq -lm   \
	  
ld: -rpath can only be used when targeting Mac OS X 10.5 or later
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [blib/arch/auto/DBD/Pg/Pg.bundle] Error 1
-> FAIL Installing DBD::Pg failed. See /Users/mstratman/.cpanm/work/1725293641.93688/build.log for details. Retry with --force to force install it.
1 distribution installed

If I naively remove the "-rpath" argument, it builds but gives these warnings:

ld: warning: object file (Pg.o) was built for newer macOS version (12.0.1) than being linked (11.0)
ld: warning: object file (dbdimp.o) was built for newer macOS version (12.0.1) than being linked (11.0)
ld: warning: object file (quote.o) was built for newer macOS version (12.0.1) than being linked (11.0)
ld: warning: object file (types.o) was built for newer macOS version (12.0.1) than being linked (11.0)
ld: warning: ignoring file /Applications/Postgres.app/Contents/Versions/9.6/lib/libpq.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64

Which, if used, result in runtime errors: mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))

mstratman avatar Sep 02 '24 16:09 mstratman