sagemath / binary-pkg

Tools for creating binary tarballs
Other
13 stars 11 forks source link

gfortran in binary package depends on hardcoded location of XCode #19

Open mkoeppe opened 5 years ago

mkoeppe commented 5 years ago

The gfortran shipped with the macOS binaries depends on the specific location of the macOS SDK (specifically, libSystem). Even within the same macOS version, this location varies depending on whether the full XCode or only the XCode command line tools are installed.

Concretely, in the macOS binary sage-8.8-OSX_10.14.5-x86_64, local/bin/gfortran -v reports that it was configured with --with-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk. My target system, however, only has the command line tools:

$ xcode-select -p
/Library/Developer/CommandLineTools

As a consequence, gfortran, for recompiling packages openblas or scipy, fails on this system with this error message:

[scipy-1.2.0]     /Users/mkoeppe/s/sage/sage-8.8-OSX_10.14.5-x86_64/local/bin/gfortran -Wall -g -bundle -undefined dynamic_lookup -L/Users/mkoeppe/s/sage/sage-8.8-OSX_10.14.5-x86_64/local/lib -Wl,-rpath,/Users/mkoeppe/s/sage/sage-8.8-OSX_10.14.5-x86_64/local/lib build/temp.macosx-10.9-x86_64-2.7/build/src.macosx-10.9-x86_64-2.7/scipy/fftpack/_fftpackmodule.o build/temp.macosx-10.9-x86_64-2.7/scipy/fftpack/src/zfft.o build/temp.macosx-10.9-x86_64-2.7/scipy/fftpack/src/drfft.o build/temp.macosx-10.9-x86_64-2.7/scipy/fftpack/src/zrfft.o build/temp.macosx-10.9-x86_64-2.7/scipy/fftpack/src/zfftnd.o build/temp.macosx-10.9-x86_64-2.7/build/src.macosx-10.9-x86_64-2.7/scipy/fftpack/src/dct.o build/temp.macosx-10.9-x86_64-2.7/build/src.macosx-10.9-x86_64-2.7/scipy/fftpack/src/dst.o build/temp.macosx-10.9-x86_64-2.7/build/src.macosx-10.9-x86_64-2.7/build/src.macosx-10.9-x86_64-2.7/scipy/fftpack/fortranobject.o -L/Users/mkoeppe/s/sage/sage-8.8-OSX_10.14.5-x86_64/local/lib/gcc/x86_64-apple-darwin18.6.0/7.2.0 -L/Users/mkoeppe/s/sage/sage-8.8-OSX_10.14.5-x86_64/local/lib -L/Users/mkoeppe/s/sage/sage-8.8-OSX_10.14.5-x86_64/local/lib -L/Users/mkoeppe/s/sage/sage-8.8-OSX_10.14.5-x86_64/local/lib -Lbuild/temp.macosx-10.9-x86_64-2.7 -ldfftpack -lfftpack -lgfortran -o build/lib.macosx-10.9-x86_64-2.7/scipy/fftpack/_fftpack.so
[scipy-1.2.0]     ld: library not found for -lSystem
[scipy-1.2.0]     collect2: error: ld returned 1 exit status

(The scipy recompilation is triggered, for example, if one reinstalls python2 following standard recipes such as http://sageregina.unhyperbolic.org/mac_os_and_ssl.html to enable SSL.)

Perhaps the binary package should supply --sysroot to gfortran at runtime.