conda-forge / galsim-feedstock

A conda-smithy repository for galsim.
BSD 3-Clause "New" or "Revised" License
0 stars 7 forks source link

wrong rpath in builds #35

Closed beckermr closed 3 years ago

beckermr commented 3 years ago

The latest build has the wrong rpaths on osx:

(base) clarence:Downloads beckermr$ otool -L galsim-2.3.1*/lib/libgalsim.2.3.dylib 
galsim-2.3.1-py38h576f502_0/lib/libgalsim.2.3.dylib:
    @rpath/libgalsim.2.3.dylib (compatibility version 2.3.0, current version 2.3.1)
    @rpath/libfftw3.3.dylib (compatibility version 10.0.0, current version 10.9.0)
    @rpath/libc++.1.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
(base) clarence:Downloads beckermr$ otool -L galsim-2.3.2*/lib/libgalsim.2.3.dylib 
galsim-2.3.2-py38h576f502_0/lib/libgalsim.2.3.dylib:
    build/shared_clib/libgalsim.2.3.dylib (compatibility version 2.3.0, current version 2.3.2)
    @rpath/libfftw3.3.dylib (compatibility version 10.0.0, current version 10.9.0)
    @rpath/libomp.dylib (compatibility version 5.0.0, current version 5.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)

cc @rmjarvis @erykoff

rmjarvis commented 3 years ago

I reproduced this locally, and I think to fix this upstream, I need to add -install_name to the compile command. However, I'm getting some very strange behavior that I don't understand. When setup.py runs the command, that still doesn't change the library's install_name. But if I run the exact same gcc command from the command line, it works.

(py3.8) Mike@Fife:~/GalSim[releases/2.3*] $ python setup.py build_shared_clib 
Using setuptools version 53.0.0
Python version =  3.8.6 | packaged by conda-forge | (default, Jan 25 2021, 23:22:12) 
[Clang 11.0.1 ]
Looking for Eigen:
   /opt/anaconda3/envs/py3.8/include
   /opt/anaconda3/envs/py3.8/include/eigen3   (yes)
GalSim version is 2.3.2
running build_shared_clib
Looking for  libfftw3.dylib
   /opt/anaconda3/envs/py3.8/lib  (yes)
Include directory for fftw3 is  /opt/anaconda3/envs/py3.8/include
Looking for Eigen:
   /opt/anaconda3/envs/py3.8/include
   /opt/anaconda3/envs/py3.8/include/eigen3   (yes)
PyBind11 is version  2.6.2
Looking for pybind11 header files: 
   /opt/anaconda3/envs/py3.8/lib/python3.8/site-packages/pybind11/include  (yes)
Using 4 cpus for compiling
To override, you may do python setup.py install -jN
compiler version information: 
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin17.5.0
Thread model: posix
Compiler is Clang.  Checking if it is a version that supports OpenMP.
Yay! This version of clang supports OpenMP!
Using compiler gcc, which is clang w/ OpenMP
Using ccache
Found link:  4 -L/opt/anaconda3/envs/py3.8/lib
Using extra flags  ['-O2', '-msse2', '-std=c++11', '-fopenmp', '-Wno-shorten-64-to-32', '-fvisibility=hidden', '-stdlib=libc++']
compiler version information: 
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin17.5.0
Thread model: posix
Compiler is Clang.  Checking if it is a version that supports OpenMP.
Yay! This version of clang supports OpenMP!
Using compiler gcc, which is clang w/ OpenMP
Found link:  4 -L/opt/anaconda3/envs/py3.8/lib
Using extra flags  ['-O2', '-msse2', '-std=c++11', '-fopenmp', '-Wno-shorten-64-to-32', '-fvisibility=hidden', '-stdlib=libc++']
building 'galsim' library
initial libraries =  []
initial library_dirs =  []
gcc -dynamiclib -undefined dynamic_lookup -L/opt/anaconda3/envs/py3.8/lib -arch x86_64 -
L/opt/anaconda3/envs/py3.8/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.9-x86_64-3.8/src/SBDeconvolve.o 
build/temp.macosx-10.9-x86_64-3.8/src/WCS.o build/temp.macosx-10.9-x86_64-3.8/src/RealGalaxy.o build/temp.macosx-
10.9-x86_64-3.8/src/Image.o build/temp.macosx-10.9-x86_64-3.8/src/SBBox.o build/temp.macosx-10.9-x86_64-
3.8/src/Table.o build/temp.macosx-10.9-x86_64-3.8/src/SBProfile.o build/temp.macosx-10.9-x86_64-3.8/src/Silicon.o 
build/temp.macosx-10.9-x86_64-3.8/src/Version.o build/temp.macosx-10.9-x86_64-3.8/src/SBSersic.o build/temp.macosx-
10.9-x86_64-3.8/src/Random.o build/temp.macosx-10.9-x86_64-3.8/src/SBVonKarman.o build/temp.macosx-10.9-x86_64-
3.8/src/SBShapelet.o build/temp.macosx-10.9-x86_64-3.8/src/Interpolant.o build/temp.macosx-10.9-x86_64-
3.8/src/SBMoffat.o build/temp.macosx-10.9-x86_64-3.8/src/SBInclinedExponential.o build/temp.macosx-10.9-x86_64-
3.8/src/SBConvolve.o build/temp.macosx-10.9-x86_64-3.8/src/RealSpaceConvolve.o build/temp.macosx-10.9-x86_64-
3.8/src/SBAiry.o build/temp.macosx-10.9-x86_64-3.8/src/SBInterpolatedImage.o build/temp.macosx-10.9-x86_64-
3.8/src/CDModel.o build/temp.macosx-10.9-x86_64-3.8/src/SBSpergel.o build/temp.macosx-10.9-x86_64-
3.8/src/SBKolmogorov.o build/temp.macosx-10.9-x86_64-3.8/src/Polygon.o build/temp.macosx-10.9-x86_64-
3.8/src/OneDimensionalDeviate.o build/temp.macosx-10.9-x86_64-3.8/src/SBExponential.o build/temp.macosx-10.9-
x86_64-3.8/src/SBAdd.o build/temp.macosx-10.9-x86_64-3.8/src/BinomFact.o build/temp.macosx-10.9-x86_64-
3.8/src/CorrelatedNoise.o build/temp.macosx-10.9-x86_64-3.8/src/SBDeltaFunction.o build/temp.macosx-10.9-x86_64-
3.8/src/SBGaussian.o build/temp.macosx-10.9-x86_64-3.8/src/GSParams.o build/temp.macosx-10.9-x86_64-
3.8/src/PhotonArray.o build/temp.macosx-10.9-x86_64-3.8/src/SBInclinedSersic.o build/temp.macosx-10.9-x86_64-
3.8/src/SBTransform.o build/temp.macosx-10.9-x86_64-3.8/src/SBSecondKick.o build/temp.macosx-10.9-x86_64-
3.8/src/SBFourierSqrt.o build/temp.macosx-10.9-x86_64-3.8/src/sizeof_SIFD.o build/temp.macosx-10.9-x86_64-
3.8/src/Laguerre.o build/temp.macosx-10.9-x86_64-3.8/src/hsm/PSFCorr.o build/temp.macosx-10.9-x86_64-
3.8/src/math/BesselK.o build/temp.macosx-10.9-x86_64-3.8/src/math/BesselJ.o build/temp.macosx-10.9-x86_64-
3.8/src/math/BesselI.o build/temp.macosx-10.9-x86_64-3.8/src/math/Nan.o build/temp.macosx-10.9-x86_64-
3.8/src/math/Horner.o build/temp.macosx-10.9-x86_64-3.8/src/math/Gamma.o build/temp.macosx-10.9-x86_64-
3.8/src/math/Bessel.o build/temp.macosx-10.9-x86_64-3.8/src/math/BesselY.o build/temp.macosx-10.9-x86_64-
3.8/src/math/Hankel.o build/temp.macosx-10.9-x86_64-3.8/src/math/BesselRoots.o build/temp.macosx-10.9-x86_64-
3.8/src/math/Sinc.o build/temp.macosx-10.9-x86_64-3.8/src/math/Angle.o -L/opt/anaconda3/envs/py3.8/lib -
L/opt/anaconda3/envs/py3.8/lib -lfftw3 -o build/shared_clib/libgalsim.2.3.dylib -stdlib=libc++ -fopenmp -Wl,-
compatibility_version,2.3 -Wl,-current_version,2.3.2 -Wl,-rpath,/opt/anaconda3/envs/py3.8/lib -install_name 
@rpath/libgalsim.2.3.dylib
Versioned library:  build/shared_clib/libgalsim.2.3.dylib
Un-versioned library:  build/shared_clib/libgalsim.dylib
(py3.8) Mike@Fife:~/GalSim[releases/2.3*] $ otool -L build/shared_clib/libgalsim.2.3.dylib 
build/shared_clib/libgalsim.2.3.dylib:
    build/shared_clib/libgalsim.2.3.dylib (compatibility version 2.3.0, current version 2.3.2)
    @rpath/libomp.dylib (compatibility version 5.0.0, current version 5.0.0)
    @rpath/libfftw3.3.dylib (compatibility version 10.0.0, current version 10.9.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
(py3.8) Mike@Fife:~/GalSim[releases/2.3*] $ gcc -dynamiclib -undefined dynamic_lookup -L/opt/anaconda3/envs/py3.8/lib 
-arch x86_64 -L/opt/anaconda3/envs/py3.8/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.9-x86_64-
3.8/src/SBDeconvolve.o build/temp.macosx-10.9-x86_64-3.8/src/WCS.o build/temp.macosx-10.9-x86_64-
3.8/src/RealGalaxy.o build/temp.macosx-10.9-x86_64-3.8/src/Image.o build/temp.macosx-10.9-x86_64-3.8/src/SBBox.o 
build/temp.macosx-10.9-x86_64-3.8/src/Table.o build/temp.macosx-10.9-x86_64-3.8/src/SBProfile.o build/temp.macosx-
10.9-x86_64-3.8/src/Silicon.o build/temp.macosx-10.9-x86_64-3.8/src/Version.o build/temp.macosx-10.9-x86_64-
3.8/src/SBSersic.o build/temp.macosx-10.9-x86_64-3.8/src/Random.o build/temp.macosx-10.9-x86_64-
3.8/src/SBVonKarman.o build/temp.macosx-10.9-x86_64-3.8/src/SBShapelet.o build/temp.macosx-10.9-x86_64-
3.8/src/Interpolant.o build/temp.macosx-10.9-x86_64-3.8/src/SBMoffat.o build/temp.macosx-10.9-x86_64-
3.8/src/SBInclinedExponential.o build/temp.macosx-10.9-x86_64-3.8/src/SBConvolve.o build/temp.macosx-10.9-x86_64-
3.8/src/RealSpaceConvolve.o build/temp.macosx-10.9-x86_64-3.8/src/SBAiry.o build/temp.macosx-10.9-x86_64-
3.8/src/SBInterpolatedImage.o build/temp.macosx-10.9-x86_64-3.8/src/CDModel.o build/temp.macosx-10.9-x86_64-
3.8/src/SBSpergel.o build/temp.macosx-10.9-x86_64-3.8/src/SBKolmogorov.o build/temp.macosx-10.9-x86_64-
3.8/src/Polygon.o build/temp.macosx-10.9-x86_64-3.8/src/OneDimensionalDeviate.o build/temp.macosx-10.9-x86_64-
3.8/src/SBExponential.o build/temp.macosx-10.9-x86_64-3.8/src/SBAdd.o build/temp.macosx-10.9-x86_64-
3.8/src/BinomFact.o build/temp.macosx-10.9-x86_64-3.8/src/CorrelatedNoise.o build/temp.macosx-10.9-x86_64-
3.8/src/SBDeltaFunction.o build/temp.macosx-10.9-x86_64-3.8/src/SBGaussian.o build/temp.macosx-10.9-x86_64-
3.8/src/GSParams.o build/temp.macosx-10.9-x86_64-3.8/src/PhotonArray.o build/temp.macosx-10.9-x86_64-
3.8/src/SBInclinedSersic.o build/temp.macosx-10.9-x86_64-3.8/src/SBTransform.o build/temp.macosx-10.9-x86_64-
3.8/src/SBSecondKick.o build/temp.macosx-10.9-x86_64-3.8/src/SBFourierSqrt.o build/temp.macosx-10.9-x86_64-
3.8/src/sizeof_SIFD.o build/temp.macosx-10.9-x86_64-3.8/src/Laguerre.o build/temp.macosx-10.9-x86_64-
3.8/src/hsm/PSFCorr.o build/temp.macosx-10.9-x86_64-3.8/src/math/BesselK.o build/temp.macosx-10.9-x86_64-
3.8/src/math/BesselJ.o build/temp.macosx-10.9-x86_64-3.8/src/math/BesselI.o build/temp.macosx-10.9-x86_64-
3.8/src/math/Nan.o build/temp.macosx-10.9-x86_64-3.8/src/math/Horner.o build/temp.macosx-10.9-x86_64-
3.8/src/math/Gamma.o build/temp.macosx-10.9-x86_64-3.8/src/math/Bessel.o build/temp.macosx-10.9-x86_64-
3.8/src/math/BesselY.o build/temp.macosx-10.9-x86_64-3.8/src/math/Hankel.o build/temp.macosx-10.9-x86_64-
3.8/src/math/BesselRoots.o build/temp.macosx-10.9-x86_64-3.8/src/math/Sinc.o build/temp.macosx-10.9-x86_64-
3.8/src/math/Angle.o -L/opt/anaconda3/envs/py3.8/lib -L/opt/anaconda3/envs/py3.8/lib -lfftw3 -o 
build/shared_clib/libgalsim.2.3.dylib -stdlib=libc++ -fopenmp -Wl,-compatibility_version,2.3 -Wl,-current_version,2.3.2 -Wl,-
rpath,/opt/anaconda3/envs/py3.8/lib -install_name @rpath/libgalsim.2.3.dylib
(py3.8) Mike@Fife:~/GalSim[releases/2.3*] $ otool -L build/shared_clib/libgalsim.2.3.dylib 
build/shared_clib/libgalsim.2.3.dylib:
    @rpath/libgalsim.2.3.dylib (compatibility version 2.3.0, current version 2.3.2)
    @rpath/libomp.dylib (compatibility version 5.0.0, current version 5.0.0)
    @rpath/libfftw3.3.dylib (compatibility version 10.0.0, current version 10.9.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)

That last gcc from the command line is a direct copy/paste from the output of the setup.py build_shared_clib run's link command. WTF?

rmjarvis commented 3 years ago

I'm also not sure why it worked in 2.3.1. If I go back to the v2.3.1 tag in GalSim and run the same command it also fails to get the install_name right. What was different in the conda build for 2.3.1 that made it work? Didn't that one also use the setup.py method?

beckermr commented 3 years ago

I have no idea what changed in the build on conda's end. here are relevant log sections

2.3.1

2021-07-08T11:27:13.2163490Z      active environment : base
2021-07-08T11:27:13.2266700Z     active env location : /Users/runner/miniforge3
2021-07-08T11:27:13.2369340Z             shell level : 1
2021-07-08T11:27:13.2426550Z        user config file : /Users/runner/.condarc
2021-07-08T11:27:13.2440380Z  populated config files : /Users/runner/miniforge3/.condarc
2021-07-08T11:27:13.2464600Z                           /Users/runner/.condarc
2021-07-08T11:27:13.2470050Z           conda version : 4.10.3
2021-07-08T11:27:13.2493980Z     conda-build version : 3.21.4
2021-07-08T11:27:13.2510260Z          python version : 3.9.5.final.0
2021-07-08T11:27:13.2524060Z        virtual packages : __osx=10.15.7=0
2021-07-08T11:27:13.2554980Z                           __unix=0=0
2021-07-08T11:27:13.2562850Z                           __archspec=1=x86_64
2021-07-08T11:27:13.2664580Z        base environment : /Users/runner/miniforge3  (writable)
2021-07-08T11:27:13.2773100Z       conda av data dir : /Users/runner/miniforge3/etc/conda
2021-07-08T11:27:13.2875250Z   conda av metadata url : None
2021-07-08T11:27:13.2978180Z            channel URLs : https://conda.anaconda.org/conda-forge/osx-64
2021-07-08T11:27:13.3081140Z                           https://conda.anaconda.org/conda-forge/noarch
2021-07-08T11:27:13.3183790Z                           https://repo.anaconda.com/pkgs/main/osx-64
2021-07-08T11:27:13.3255650Z                           https://repo.anaconda.com/pkgs/main/noarch
2021-07-08T11:27:13.3260460Z                           https://repo.anaconda.com/pkgs/r/osx-64
2021-07-08T11:27:13.3273390Z                           https://repo.anaconda.com/pkgs/r/noarch
2021-07-08T11:27:13.3286240Z           package cache : /Users/runner/miniforge3/pkgs
2021-07-08T11:27:13.3293560Z                           /Users/runner/.conda/pkgs
2021-07-08T11:27:13.3297100Z        envs directories : /Users/runner/miniforge3/envs
2021-07-08T11:27:13.3309870Z                           /Users/runner/.conda/envs
2021-07-08T11:27:13.3412050Z                platform : osx-64
2021-07-08T11:27:13.3517810Z              user-agent : conda/4.10.3 requests/2.25.1 CPython/3.9.5 Darwin/19.6.0 OSX/10.15.7
2021-07-08T11:27:13.3620550Z                 UID:GID : 501:20
2021-07-08T11:27:13.3628740Z              netrc file : None
2021-07-08T11:27:13.3630720Z            offline mode : False
2021-07-08T11:27:13.3647030Z 

2021-07-08T11:30:07.5719490Z BUILD START: ['galsim-2.3.1-py38h576f502_0.tar.bz2']
2021-07-08T11:30:17.9069080Z Collecting package metadata (repodata.json): ...working... done
2021-07-08T11:30:31.4503110Z Solving environment: ...working... done
2021-07-08T11:30:31.6449880Z 
2021-07-08T11:30:31.6451150Z ## Package Plan ##
2021-07-08T11:30:31.6451570Z 
2021-07-08T11:30:31.6453620Z   environment location: /Users/runner/miniforge3/conda-bld/galsim_1625743637366/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl
2021-07-08T11:30:31.6454460Z 
2021-07-08T11:30:31.6455240Z 
2021-07-08T11:30:31.6456390Z The following NEW packages will be INSTALLED:
2021-07-08T11:30:31.6457260Z 
2021-07-08T11:30:31.6458600Z     ca-certificates: 2021.5.30-h033912b_0      conda-forge
2021-07-08T11:30:31.6459750Z     certifi:         2021.5.30-py38h50d1736_0  conda-forge
2021-07-08T11:30:31.6460820Z     eigen:           3.3.9-h926bf3e_1          conda-forge
2021-07-08T11:30:31.6461890Z     fftw:            3.3.9-nompi_h02cd531_101  conda-forge
2021-07-08T11:30:31.6462950Z     libblas:         3.9.0-9_openblas          conda-forge
2021-07-08T11:30:31.6464890Z     libcblas:        3.9.0-9_openblas          conda-forge
2021-07-08T11:30:31.6466000Z     libcxx:          11.1.0-habf9029_0         conda-forge
2021-07-08T11:30:31.6467110Z     libffi:          3.3-h046ec9c_2            conda-forge
2021-07-08T11:30:31.6468220Z     libgfortran:     5.0.0-9_3_0_h6c81a4c_22   conda-forge
2021-07-08T11:30:31.6469890Z     libgfortran5:    9.3.0-h6c81a4c_22         conda-forge
2021-07-08T11:30:31.6471150Z     liblapack:       3.9.0-9_openblas          conda-forge
2021-07-08T11:30:31.6472310Z     libopenblas:     0.3.15-openmp_h5e1b9a4_1  conda-forge
2021-07-08T11:30:31.6473550Z     llvm-openmp:     11.1.0-hda6cdc1_1         conda-forge
2021-07-08T11:30:31.6474660Z     ncurses:         6.2-h2e338ed_4            conda-forge
2021-07-08T11:30:31.6475770Z     numpy:           1.17.5-py38h6ced74f_1     conda-forge
2021-07-08T11:30:31.6476870Z     openssl:         1.1.1k-h0d85af4_0         conda-forge
2021-07-08T11:30:31.6477970Z     pip:             21.1.3-pyhd8ed1ab_0       conda-forge
2021-07-08T11:30:31.6479070Z     pybind11:        2.6.2-py38h12bbefe_0      conda-forge
2021-07-08T11:30:31.6480190Z     pybind11-global: 2.6.2-py38h12bbefe_0      conda-forge
2021-07-08T11:30:31.6481470Z     python:          3.8.10-h0e5c897_0_cpython conda-forge
2021-07-08T11:30:31.6482610Z     python_abi:      3.8-2_cp38                conda-forge
2021-07-08T11:30:31.6483860Z     readline:        8.1-h05e3726_0            conda-forge
2021-07-08T11:30:31.6484940Z     setuptools:      49.6.0-py38h50d1736_3     conda-forge
2021-07-08T11:30:31.6486040Z     sqlite:          3.36.0-h23a322b_0         conda-forge
2021-07-08T11:30:31.6487140Z     tk:              8.6.10-h0419947_1         conda-forge
2021-07-08T11:30:31.6488240Z     wheel:           0.36.2-pyhd3deb0d_0       conda-forge
2021-07-08T11:30:31.6489320Z     xz:              5.2.5-haf1e3a3_1          conda-forge
2021-07-08T11:30:31.6490410Z     zlib:            1.2.11-h7795811_1010      conda-forge
2021-07-08T11:30:31.6490990Z 
2021-07-08T11:30:35.1968350Z Preparing transaction: ...working... done
2021-07-08T11:30:38.9464360Z Verifying transaction: ...working... done
2021-07-08T11:30:45.3579580Z Executing transaction: ...working... done
2021-07-08T11:30:59.0325000Z Collecting package metadata (repodata.json): ...working... done
2021-07-08T11:31:08.7711550Z Solving environment: ...working... done
2021-07-08T11:31:18.9841660Z Collecting package metadata (repodata.json): ...working... done
2021-07-08T11:31:33.1685320Z Solving environment: ...working... done
2021-07-08T11:31:33.3628060Z 
2021-07-08T11:31:33.3630870Z ## Package Plan ##
2021-07-08T11:31:33.3632620Z 
2021-07-08T11:31:33.3634960Z   environment location: /Users/runner/miniforge3/conda-bld/galsim_1625743637366/_build_env
2021-07-08T11:31:33.3635480Z 
2021-07-08T11:31:33.3635710Z 
2021-07-08T11:31:33.3636210Z The following NEW packages will be INSTALLED:
2021-07-08T11:31:33.3636570Z 
2021-07-08T11:31:33.3637650Z     cctools_osx-64:     949.0.1-h6407bdd_22       conda-forge
2021-07-08T11:31:33.3638800Z     clang:              11.1.0-h694c41f_1         conda-forge
2021-07-08T11:31:33.3640000Z     clang-11:           11.1.0-default_he082bbe_1 conda-forge
2021-07-08T11:31:33.3641170Z     clang_osx-64:       11.1.0-hb91bd55_2         conda-forge
2021-07-08T11:31:33.3642280Z     clangxx:            11.1.0-default_he082bbe_1 conda-forge
2021-07-08T11:31:33.3643370Z     clangxx_osx-64:     11.1.0-h7e1b574_2         conda-forge
2021-07-08T11:31:33.3644510Z     compiler-rt:        11.1.0-h654b07c_0         conda-forge
2021-07-08T11:31:33.3645660Z     compiler-rt_osx-64: 11.1.0-h8c5fa43_0         conda-forge
2021-07-08T11:31:33.3646960Z     ld64_osx-64:        530-he8994da_21           conda-forge
2021-07-08T11:31:33.3648140Z     ldid:               2.1.2-h7660a38_2          conda-forge
2021-07-08T11:31:33.3649310Z     libclang-cpp11.1:   11.1.0-default_he082bbe_1 conda-forge
2021-07-08T11:31:33.3650470Z     libcxx:             11.1.0-habf9029_0         conda-forge
2021-07-08T11:31:33.3652580Z     libllvm11:          11.1.0-hd011deb_2         conda-forge
2021-07-08T11:31:33.3653730Z     libllvm12:          12.0.0-hd011deb_1         conda-forge
2021-07-08T11:31:33.3654860Z     llvm-openmp:        11.1.0-hda6cdc1_1         conda-forge
2021-07-08T11:31:33.3656000Z     llvm-tools:         11.1.0-hd011deb_2         conda-forge
2021-07-08T11:31:33.3657690Z     tapi:               1100.0.11-h9ce4665_0      conda-forge
2021-07-08T11:31:33.3658810Z     zlib:               1.2.11-h7795811_1010      conda-forge
2021-07-08T11:31:33.3659270Z 

2.3.2

2021-07-20T04:33:21.9964450Z ++ export PATH
2021-07-20T04:33:22.0039310Z ++ /Users/runner/miniforge3/bin/conda info
2021-07-20T04:33:22.0066940Z 
2021-07-20T04:33:22.0167940Z      active environment : base
2021-07-20T04:33:22.0269830Z     active env location : /Users/runner/miniforge3
2021-07-20T04:33:22.0370080Z             shell level : 1
2021-07-20T04:33:22.0471330Z        user config file : /Users/runner/.condarc
2021-07-20T04:33:22.0542420Z  populated config files : /Users/runner/miniforge3/.condarc
2021-07-20T04:33:22.0572960Z                           /Users/runner/.condarc
2021-07-20T04:33:22.0600950Z           conda version : 4.10.3
2021-07-20T04:33:22.0627980Z     conda-build version : 3.21.4
2021-07-20T04:33:22.0644990Z          python version : 3.9.6.final.0
2021-07-20T04:33:22.0655290Z        virtual packages : __osx=10.15.7=0
2021-07-20T04:33:22.0669480Z                           __unix=0=0
2021-07-20T04:33:22.0770770Z                           __archspec=1=x86_64
2021-07-20T04:33:22.0872210Z        base environment : /Users/runner/miniforge3  (writable)
2021-07-20T04:33:22.0910840Z       conda av data dir : /Users/runner/miniforge3/etc/conda
2021-07-20T04:33:22.0938650Z   conda av metadata url : None
2021-07-20T04:33:22.0967100Z            channel URLs : https://conda.anaconda.org/conda-forge/osx-64
2021-07-20T04:33:22.0995220Z                           https://conda.anaconda.org/conda-forge/noarch
2021-07-20T04:33:22.1023930Z                           https://repo.anaconda.com/pkgs/main/osx-64
2021-07-20T04:33:22.1046220Z                           https://repo.anaconda.com/pkgs/main/noarch
2021-07-20T04:33:22.1052300Z                           https://repo.anaconda.com/pkgs/r/osx-64
2021-07-20T04:33:22.1153600Z                           https://repo.anaconda.com/pkgs/r/noarch
2021-07-20T04:33:22.1255240Z           package cache : /Users/runner/miniforge3/pkgs
2021-07-20T04:33:22.1287700Z                           /Users/runner/.conda/pkgs
2021-07-20T04:33:22.1340380Z        envs directories : /Users/runner/miniforge3/envs
2021-07-20T04:33:22.1363360Z                           /Users/runner/.conda/envs
2021-07-20T04:33:22.1368790Z                platform : osx-64
2021-07-20T04:33:22.1483330Z              user-agent : conda/4.10.3 requests/2.26.0 CPython/3.9.6 Darwin/19.6.0 OSX/10.15.7
2021-07-20T04:33:22.1584800Z                 UID:GID : 501:20
2021-07-20T04:33:22.1621050Z              netrc file : None
2021-07-20T04:33:22.1632720Z            offline mode : False

2021-07-20T04:36:08.0819390Z BUILD START: ['galsim-2.3.2-py38h576f502_0.tar.bz2']
2021-07-20T04:36:18.4218290Z Collecting package metadata (repodata.json): ...working... done
2021-07-20T04:36:31.3167770Z Solving environment: ...working... done
2021-07-20T04:36:31.4711870Z 
2021-07-20T04:36:31.4714310Z ## Package Plan ##
2021-07-20T04:36:31.4714630Z 
2021-07-20T04:36:31.4716600Z   environment location: /Users/runner/miniforge3/conda-bld/galsim_1626755605385/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl
2021-07-20T04:36:31.4717660Z 
2021-07-20T04:36:31.4718330Z 
2021-07-20T04:36:31.4719350Z The following NEW packages will be INSTALLED:
2021-07-20T04:36:31.4719690Z 
2021-07-20T04:36:31.4721050Z     ca-certificates: 2021.5.30-h033912b_0      conda-forge
2021-07-20T04:36:31.4722850Z     certifi:         2021.5.30-py38h50d1736_0  conda-forge
2021-07-20T04:36:31.4723950Z     eigen:           3.3.9-h926bf3e_1          conda-forge
2021-07-20T04:36:31.4724970Z     fftw:            3.3.9-nompi_h02cd531_101  conda-forge
2021-07-20T04:36:31.4725990Z     libblas:         3.9.0-9_openblas          conda-forge
2021-07-20T04:36:31.4727110Z     libcblas:        3.9.0-9_openblas          conda-forge
2021-07-20T04:36:31.4728170Z     libcxx:          12.0.1-habf9029_0         conda-forge
2021-07-20T04:36:31.4729220Z     libffi:          3.3-h046ec9c_2            conda-forge
2021-07-20T04:36:31.4730280Z     libgfortran:     5.0.0-9_3_0_h6c81a4c_22   conda-forge
2021-07-20T04:36:31.4731320Z     libgfortran5:    9.3.0-h6c81a4c_22         conda-forge
2021-07-20T04:36:31.4732360Z     liblapack:       3.9.0-9_openblas          conda-forge
2021-07-20T04:36:31.4733410Z     libopenblas:     0.3.15-openmp_h5e1b9a4_1  conda-forge
2021-07-20T04:36:31.4734480Z     llvm-openmp:     12.0.1-hda6cdc1_0         conda-forge
2021-07-20T04:36:31.4735520Z     ncurses:         6.2-h2e338ed_4            conda-forge
2021-07-20T04:36:31.4736570Z     numpy:           1.17.5-py38h6ced74f_1     conda-forge
2021-07-20T04:36:31.4737640Z     openssl:         1.1.1k-h0d85af4_0         conda-forge
2021-07-20T04:36:31.4738680Z     pip:             21.1.3-pyhd8ed1ab_0       conda-forge
2021-07-20T04:36:31.4739730Z     pybind11:        2.7.0-py38h12bbefe_0      conda-forge
2021-07-20T04:36:31.4740780Z     pybind11-global: 2.7.0-py38h12bbefe_0      conda-forge
2021-07-20T04:36:31.4741830Z     python:          3.8.10-h0e5c897_0_cpython conda-forge
2021-07-20T04:36:31.4742880Z     python_abi:      3.8-2_cp38                conda-forge
2021-07-20T04:36:31.4743900Z     readline:        8.1-h05e3726_0            conda-forge
2021-07-20T04:36:31.4744950Z     setuptools:      49.6.0-py38h50d1736_3     conda-forge
2021-07-20T04:36:31.4746000Z     sqlite:          3.36.0-h23a322b_0         conda-forge
2021-07-20T04:36:31.4747200Z     tk:              8.6.10-h0419947_1         conda-forge
2021-07-20T04:36:31.4748270Z     wheel:           0.36.2-pyhd3deb0d_0       conda-forge
2021-07-20T04:36:31.4749330Z     xz:              5.2.5-haf1e3a3_1          conda-forge
2021-07-20T04:36:31.4750500Z     zlib:            1.2.11-h7795811_1010      conda-forge
2021-07-20T04:36:31.4750920Z 
2021-07-20T04:36:34.6732970Z Preparing transaction: ...working... done
2021-07-20T04:36:37.9001890Z Verifying transaction: ...working... done
2021-07-20T04:36:43.7383620Z Executing transaction: ...working... done
2021-07-20T04:36:56.0429150Z Collecting package metadata (repodata.json): ...working... done
2021-07-20T04:37:06.2489130Z Solving environment: ...working... done
2021-07-20T04:37:17.3512910Z Collecting package metadata (repodata.json): ...working... done
2021-07-20T04:37:30.1785040Z Solving environment: ...working... done
2021-07-20T04:37:30.3340040Z 
2021-07-20T04:37:30.3340940Z ## Package Plan ##
2021-07-20T04:37:30.3341210Z 
2021-07-20T04:37:30.3342700Z   environment location: /Users/runner/miniforge3/conda-bld/galsim_1626755605385/_build_env
2021-07-20T04:37:30.3343220Z 
2021-07-20T04:37:30.3344780Z 
2021-07-20T04:37:30.3346280Z The following NEW packages will be INSTALLED:
2021-07-20T04:37:30.3347370Z 
2021-07-20T04:37:30.3348370Z     cctools_osx-64:     949.0.1-h6407bdd_22       conda-forge
2021-07-20T04:37:30.3349460Z     clang:              11.1.0-h694c41f_1         conda-forge
2021-07-20T04:37:30.3350510Z     clang-11:           11.1.0-default_he082bbe_1 conda-forge
2021-07-20T04:37:30.3351560Z     clang_osx-64:       11.1.0-hb91bd55_2         conda-forge
2021-07-20T04:37:30.3352600Z     clangxx:            11.1.0-default_he082bbe_1 conda-forge
2021-07-20T04:37:30.3353630Z     clangxx_osx-64:     11.1.0-h7e1b574_2         conda-forge
2021-07-20T04:37:30.3354650Z     compiler-rt:        11.1.0-h654b07c_0         conda-forge
2021-07-20T04:37:30.3355690Z     compiler-rt_osx-64: 11.1.0-h8c5fa43_0         conda-forge
2021-07-20T04:37:30.3357300Z     ld64_osx-64:        530-he8994da_21           conda-forge
2021-07-20T04:37:30.3358440Z     ldid:               2.1.2-h7660a38_2          conda-forge
2021-07-20T04:37:30.3359650Z     libclang-cpp11.1:   11.1.0-default_he082bbe_1 conda-forge
2021-07-20T04:37:30.3360730Z     libcxx:             12.0.1-habf9029_0         conda-forge
2021-07-20T04:37:30.3361820Z     libllvm11:          11.1.0-hd011deb_2         conda-forge
2021-07-20T04:37:30.3362890Z     libllvm12:          12.0.1-hd011deb_0         conda-forge
2021-07-20T04:37:30.3363970Z     llvm-openmp:        12.0.1-hda6cdc1_0         conda-forge
2021-07-20T04:37:30.3365040Z     llvm-tools:         11.1.0-hd011deb_2         conda-forge
2021-07-20T04:37:30.3366120Z     tapi:               1100.0.11-h9ce4665_0      conda-forge
2021-07-20T04:37:30.3367170Z     zlib:               1.2.11-h7795811_1010      conda-forge
beckermr commented 3 years ago

This should be fixed on the conda end for now. If you can solve this on the upstream end, we can adjust the build scripts on the next release.

rmjarvis commented 3 years ago

I guess libllvm12 and llvm-openmp are different version. Seems crazy that they would have changed something about how they do something related to this. And I tried regressing to libllvm12 to version 11.1, and it didn't change anything for me, so I don't think that could be it. Can you point me to the logs where the actual gcc command is executed? I find the conda build logs insanely confusing. I'd like to see if there is anything different in the actual gcc command that gets executed when running python setup.py build_shared_clib in each case.

beckermr commented 3 years ago

here it is:


clang-11: warning: -Wl,-export_dynamic: 'linker' input unused [-Wunused-command-line-argument]
initial libraries =  []
initial library_dirs =  []
creating build/shared_clib
x86_64-apple-darwin13.4.0-clang -dynamiclib -undefined dynamic_lookup -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,$PREFIX/lib -L$PREFIX/lib -flto -Wl,-export_dynamic -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,$PREFIX/lib -L$PREFIX/lib -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,$PREFIX/lib -L$PREFIX/lib -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem $PREFIX/include -fdebug-prefix-map=$SRC_DIR=/usr/local/src/conda/galsim-2.3.2 -fdebug-prefix-map=$PREFIX=/usr/local/src/conda-prefix -D_FORTIFY_SOURCE=2 -isystem $PREFIX/include -mmacosx-version-min=10.9 -arch x86_64 build/temp.macosx-10.9-x86_64-3.7/src/SBDeconvolve.o build/temp.macosx-10.9-x86_64-3.7/src/WCS.o build/temp.macosx-10.9-x86_64-3.7/src/RealGalaxy.o build/temp.macosx-10.9-x86_64-3.7/src/Image.o build/temp.macosx-10.9-x86_64-3.7/src/SBBox.o build/temp.macosx-10.9-x86_64-3.7/src/Table.o build/temp.macosx-10.9-x86_64-3.7/src/SBProfile.o build/temp.macosx-10.9-x86_64-3.7/src/Silicon.o build/temp.macosx-10.9-x86_64-3.7/src/Version.o build/temp.macosx-10.9-x86_64-3.7/src/SBSersic.o build/temp.macosx-10.9-x86_64-3.7/src/Random.o build/temp.macosx-10.9-x86_64-3.7/src/SBVonKarman.o build/temp.macosx-10.9-x86_64-3.7/src/SBShapelet.o build/temp.macosx-10.9-x86_64-3.7/src/Interpolant.o build/temp.macosx-10.9-x86_64-3.7/src/SBMoffat.o build/temp.macosx-10.9-x86_64-3.7/src/SBInclinedExponential.o build/temp.macosx-10.9-x86_64-3.7/src/SBConvolve.o build/temp.macosx-10.9-x86_64-3.7/src/RealSpaceConvolve.o build/temp.macosx-10.9-x86_64-3.7/src/SBAiry.o build/temp.macosx-10.9-x86_64-3.7/src/SBInterpolatedImage.o build/temp.macosx-10.9-x86_64-3.7/src/CDModel.o build/temp.macosx-10.9-x86_64-3.7/src/SBSpergel.o build/temp.macosx-10.9-x86_64-3.7/src/SBKolmogorov.o build/temp.macosx-10.9-x86_64-3.7/src/Polygon.o build/temp.macosx-10.9-x86_64-3.7/src/OneDimensionalDeviate.o build/temp.macosx-10.9-x86_64-3.7/src/SBExponential.o build/temp.macosx-10.9-x86_64-3.7/src/SBAdd.o build/temp.macosx-10.9-x86_64-3.7/src/BinomFact.o build/temp.macosx-10.9-x86_64-3.7/src/CorrelatedNoise.o build/temp.macosx-10.9-x86_64-3.7/src/SBDeltaFunction.o build/temp.macosx-10.9-x86_64-3.7/src/SBGaussian.o build/temp.macosx-10.9-x86_64-3.7/src/GSParams.o build/temp.macosx-10.9-x86_64-3.7/src/PhotonArray.o build/temp.macosx-10.9-x86_64-3.7/src/SBInclinedSersic.o build/temp.macosx-10.9-x86_64-3.7/src/SBTransform.o build/temp.macosx-10.9-x86_64-3.7/src/SBSecondKick.o build/temp.macosx-10.9-x86_64-3.7/src/SBFourierSqrt.o build/temp.macosx-10.9-x86_64-3.7/src/sizeof_SIFD.o build/temp.macosx-10.9-x86_64-3.7/src/Laguerre.o build/temp.macosx-10.9-x86_64-3.7/src/hsm/PSFCorr.o build/temp.macosx-10.9-x86_64-3.7/src/math/BesselK.o build/temp.macosx-10.9-x86_64-3.7/src/math/BesselJ.o build/temp.macosx-10.9-x86_64-3.7/src/math/BesselI.o build/temp.macosx-10.9-x86_64-3.7/src/math/Nan.o build/temp.macosx-10.9-x86_64-3.7/src/math/Horner.o build/temp.macosx-10.9-x86_64-3.7/src/math/Gamma.o build/temp.macosx-10.9-x86_64-3.7/src/math/Bessel.o build/temp.macosx-10.9-x86_64-3.7/src/math/BesselY.o build/temp.macosx-10.9-x86_64-3.7/src/math/Hankel.o build/temp.macosx-10.9-x86_64-3.7/src/math/BesselRoots.o build/temp.macosx-10.9-x86_64-3.7/src/math/Sinc.o build/temp.macosx-10.9-x86_64-3.7/src/math/Angle.o -L$PREFIX/lib -L$BUILD_PREFIX/lib -lfftw3 -o build/shared_clib/libgalsim.2.3.dylib -stdlib=libc++ -fopenmp -Wl,-compatibility_version,2.3 -Wl,-current_version,2.3.2 -Wl,-rpath,$PREFIX/lib
ld: warning: -pie being ignored. It is only used when linking a main executable
Versioned library:  build/shared_clib/libgalsim.2.3.dylib
Un-versioned library:  build/shared_clib/libgalsim.dylib
+ cp include/GalSim.h /Users/runner/miniforge3/conda-bld/galsim_1626755603386/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/include
+ cp -r include/galsim /Users/runner/miniforge3/conda-bld/galsim_1626755603386/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/include
+ cp -PR build/shared_clib/libgalsim.2.3.dylib build/shared_clib/libgalsim.dylib /Users/runner/miniforge3/conda-bld/galsim_1626755603386/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib
rmjarvis commented 3 years ago

OK, I'm still deeply confused by this. Both about how it could possible have worked correctly in 2.3.1, and why -install_name isn't working when it runs from inside setup.py. It seems plausible that both of my confusions stem from a common misunderstanding about something, but I'm giving up trying to figure it out.

However, I did add the install_name_tool command to the upstream setup.py function, so it should be fixed natively for next time.

commit 458b9c107002b8aee63dd3d007d4f1dc420d90ba (HEAD -> releases/2.3)
Author: Mike Jarvis <michael@jarvis.net>
Date:   Sat Jul 24 14:25:55 2021 -0400

    Fix the install_name of the shared library to use @rpath.

diff --git a/setup.py b/setup.py
index 37db3fc52..15ddde219 100644
--- a/setup.py
+++ b/setup.py
@@ -1021,6 +1021,9 @@ class my_build_shared_clib(my_build_clib):
                 # Also add rpath specification for fftw
                 if fftw_libpath != '':
                     lflags.append('-Wl,-rpath,' + fftw_libpath)
+                # This should work, but for some reason it doesn't.
+                # So I'm leaving it here, but we'll fix it below with install_name_tool anyway.
+                lflags.append('-install_name @rpath/%s'%full_lib_name)

             output_dir = os.path.join('build','shared_clib')
             self.compiler.link(CCompiler.SHARED_OBJECT, expected_objects, full_lib_name,
@@ -1030,10 +1033,20 @@ class my_build_shared_clib(my_build_clib):
                                extra_postargs=ext.extra_link_args + lflags,
                                output_dir=output_dir, debug=self.debug)

-            # Also make the non-versionful one
             full_lib_name_with_dir = os.path.join(output_dir, full_lib_name)
-            lib_name_with_dir = os.path.join(output_dir, lib_name)
             print('Versioned library: ',full_lib_name_with_dir)
+
+            if sys.platform == 'darwin':
+                # As mentioned above, for some reason the -install_name flag doesn't work when
+                # running from within setup.py, even though the exact same gcc command works for
+                # me when run on the command line.  I can't figure it out.  So just use the
+                # install_name_tool program to fix it now.
+                cmd = ['install_name_tool', '-id', '@rpath/'+full_lib_name, full_lib_name_with_dir]
+                p = subprocess.Popen(cmd)
+                p.communicate()
+
+            # Also make the non-versionful one
+            lib_name_with_dir = os.path.join(output_dir, lib_name)
             print('Un-versioned library: ',lib_name_with_dir)
             if not os.path.exists(lib_name_with_dir):
                 # This is slightly confusing.
beckermr commented 3 years ago

You need to use the version at the path in the environment in conda build. See the build script in the recipe.

rmjarvis commented 3 years ago

I don't understand your last comment. What needs to change specifically? When I run this version of setup.py, it looks right to me:

$ otool -L build/shared_clib/libgalsim.2.3.dylib 
build/shared_clib/libgalsim.2.3.dylib:
    @rpath/libgalsim.2.3.dylib (compatibility version 2.3.0, current version 2.3.2)
    @rpath/libomp.dylib (compatibility version 5.0.0, current version 5.0.0)
    @rpath/libfftw3.3.dylib (compatibility version 10.0.0, current version 10.9.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
beckermr commented 3 years ago

When building the library inside of conda build, you need to use the version of install_name_tool contained in the environment variable INSTALL_NAME_TOOL.

You are currently using the system one which is fine for people using this from pypi but not in conda forge. Conda forge ships its own version of this program and that one may eventually differ from the one contained in operating system of the CI worked.

See this line https://github.com/conda-forge/galsim-feedstock/blob/7d4377943943be407c9c8226500689a4d3fec342/recipe/build.sh#L18

The fact that the system one works inside of conda build is besides the point. The correct interface to the conda compilers and tools is through these env vars.

rmjarvis commented 3 years ago

Hm. That seems much too conda-specific to put in the upstream code base. If you want to keep that line in the conda recipe, feel free. Although I'm hard pressed to imagine how the system one would ever do the wrong thing for this simple use case.

erykoff commented 3 years ago

When cross compiling you have to be very careful.

erykoff commented 3 years ago

But it is not a problem for conda forge recipes to have conda forge specific commands in the build.

beckermr commented 3 years ago

Exactly @erykoff. Conda build scripts are a mess of patches and should be. There is no reason to upstream stuff in them since it is subject to change.

We've already made changes to our tools for handling binaries that make sure they are signed properly for apple silicon builds. So this case where the conda ones differ from the system ones is not theoretical @rmjarvis.

beckermr commented 3 years ago

I'm going to close this issue since it is fixed.