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

New cctools still broken on osx-arm64 #50

Closed
1 task
erykoff opened this issue Feb 11, 2022 · 10 comments · Fixed by #52
Closed
1 task

New cctools still broken on osx-arm64 #50

erykoff opened this issue Feb 11, 2022 · 10 comments · Fixed by #52

Comments

@erykoff
Copy link
Contributor

erykoff commented Feb 11, 2022

Issue:

this issue conda-forge/admin-requests#324 is still a problem. New builds came out and lead to unsigned binaries on osx-arm64. I don’t know the underlying cause or how to keep us from releasing updates on this.
@isuruf
@beckermr


Environment (conda list):
$ conda list


Details about conda and system ( conda info ):
$ conda info

@isuruf
Copy link
Member

isuruf commented Feb 11, 2022

Can you give a MWE?

@rgommers
Copy link

Here is a reproducer (from rgommers/scipy#134) on an arm64 machine:

# clone https://github.com/scipy/scipy and cd to root of repo
% conda env create -f environment_meson.yml
% conda activate scipy-meson
% python dev.py --build-only
...
meson.build:41:0: ERROR: Executables created by Fortran compiler /Users/sayantikabanik/miniforge3/envs/scipy-dev/bin/arm64-apple-darwin20.0.0-gfortran are not runnable.

Downgrading ld64 from build number 609 to 530 fixes the problem.

Given that it's in the configure stage of the build, there's nothing scipy-specific going on there - it looks like any use of gfortran will have that issue.

@isuruf
Copy link
Member

isuruf commented Feb 21, 2022

Would you be able to reduce this down to a small Fortran/C only example so we can report it upstream?

@rgommers
Copy link

Yes I think so, hopefully later today (first a bunch of meetings to go to).

@rgommers
Copy link

The problem seemed to be an absolute path given to -o. With a test file sanitycheckf.f90:

program main; print *, "Fortran compilation is working."; end program

Adding some debug prints shows what arguments are used when trying to configure the SciPy build:

['/Users/rgommers/mambaforge/envs/scipy-meson-arm64/bin/arm64-apple-darwin20.0.0-gfortran', '-Wno-conversion', '-Wl,-pie', '-Wl,-headerpad_max_install_names', '-Wl,-dead_strip_dylibs', '-Wl,-rpath,/Users/rgommers/mambaforge/envs/scipy-meson-arm64/lib', '-L/Users/rgommers/mambaforge/envs/scipy-meson-arm64/lib', '/Users/rgommers/code/scipy/build/meson-private/sanitycheckf.f90', '-o', '/Users/rgommers/code/scipy/build/meson-private/sanitycheckf']

['/Users/rgommers/code/scipy/build/meson-private/sanitycheckf']
-9

meson.build:41:0: ERROR: Executables created by Fortran compiler /Users/rgommers/mambaforge/envs/scipy-meson-arm64/bin/arm64-apple-darwin20.0.0-gfortran are not runnable.

So running that manually, putting the test binary in the root of the repo, with a relative path (-o sanitycheck):

% /Users/rgommers/mambaforge/envs/scipy-meson-arm64/bin/arm64-apple-darwin20.0.0-gfortran -Wno-conversion -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/Users/rgommers/mambaforge/envs/scipy-meson-arm64/lib -L/Users/rgommers/mambaforge/envs/scipy-meson-arm64/lib /Users/rgommers/code/scipy/build/meson-private/sanitycheckf.f90 -o sanitycheckf
% ./sanitycheckf 
 Fortran compilation is working.

Now with an absolute path:

% /Users/rgommers/mambaforge/envs/scipy-meson-arm64/bin/arm64-apple-darwin20.0.0-gfortran -Wno-conversion -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/Users/rgommers/mambaforge/envs/scipy-meson-arm64/lib -L/Users/rgommers/mambaforge/envs/scipy-meson-arm64/lib /Users/rgommers/code/scipy/build/meson-private/sanitycheckf.f90 -o /Users/rgommers/code/scipy/sanitycheckf
% ./sanitycheckf 
zsh: killed     ./sanitycheckf

Stripping that further down:

% rm sanitycheckf
% gfortran build/meson-private/sanitycheckf.f90 -o /Users/rgommers/code/scipy/sanitycheckf       
% ./sanitycheckf 
zsh: killed     ./sanitycheckf
% rm sanitycheckf
% gfortran build/meson-private/sanitycheckf.f90 -o sanitycheckf 
% ./sanitycheckf                                              
 Fortran compilation is working.

Showing that a simple absolute path is enough even with no other compiler arguments.

@beckermr
Copy link
Member

Wow. That is a great bug report! Thank you!

@isuruf
Copy link
Member

isuruf commented Feb 21, 2022

Thanks. Can you open it at https://github.com/tpoechtrager/cctools-port ?

@isuruf
Copy link
Member

isuruf commented Feb 21, 2022

I assume following works for you as well right?

gfortran build/meson-private/sanitycheckf.f90 -o /Users/rgommers/code/scipy/sanitycheckf       
cp ./sanitycheckf sanitycheckf2
cp sanitycheckf2 sanitycheckf
./sanitycheckf

@erykoff
Copy link
Contributor Author

erykoff commented Feb 22, 2022

FYI, I just checked and it's not just gfortran, it's clang (no surprise). Great find on the abs path issue, @rgommers !

And strangely, @isuruf is correct that copying fixes it ... so presumably you know what's going wrong?

$ clang /Users/erykoff/src/hello_world/hello_world.c -o /Users/erykoff/src/hello_world/hello_world
$ ./hello_world 
zsh: killed     ./hello_world
$ cp hello_world hello_world2
$ cp hello_world2 hello_world
$ ./hello_world
Hello, world!

@rgommers
Copy link

Thanks. Can you open it at https://github.com/tpoechtrager/cctools-port ?

Done in tpoechtrager/cctools-port#117

@isuruf isuruf closed this as completed in #52 Mar 2, 2022
cticenhour added a commit to cticenhour/moose that referenced this issue Jul 28, 2022
- This involves updating the PETSc submodule to 3.16.6 with a patch submitted by @fdkong
  See https://gitlab.com/petsc/petsc/-/merge_requests/5447 for more information

- After the above update and patch, conda build fails at codesigning PETSc dylibs on Apple Silicon. There appears to have been a bug with
  cctools/ld64 on this platform (see conda-forge/cctools-and-ld64-feedstock#50) that might have been patched
  but is still experienced with the ld64 609 package used by moose-mpich 4.0.2 build_0. Downgrading to ld64 530 seems to fix this for now.

- This commit also reconfigures configure_petsc.sh so that all Apple Silicon-related adjustments occur in one location.

- conda/petsc/run_tests.sh was also removed since it was not used in the petsc meta.yaml testing procedure (and was superseded by a current
  pkg-config test)
cticenhour added a commit to cticenhour/moose that referenced this issue Jul 29, 2022
- This involves updating the PETSc submodule to 3.16.6 with a patch submitted by @fdkong
  See https://gitlab.com/petsc/petsc/-/merge_requests/5447 for more information

- After the above update and patch, conda build fails at codesigning PETSc dylibs on Apple Silicon. There appears to have been a bug with
  cctools/ld64 on this platform (see conda-forge/cctools-and-ld64-feedstock#50) that might have been patched
  but is still experienced with the ld64 609 package used by moose-mpich 4.0.2 build_0. Downgrading to ld64 530 seems to fix this for now.

- This commit also reconfigures configure_petsc.sh so that all Apple Silicon-related adjustments occur in one location.

- conda/petsc/run_tests.sh was also removed since it was not used in the petsc meta.yaml testing procedure (and was superseded by a current
  pkg-config test)
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

Successfully merging a pull request may close this issue.

4 participants