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

openmpi: build fails on aarch64-darwin #127608

Closed
purcell opened this issue Jun 21, 2021 · 6 comments · Fixed by #127694, #188344, #188346 or #188352
Closed

openmpi: build fails on aarch64-darwin #127608

purcell opened this issue Jun 21, 2021 · 6 comments · Fixed by #127694, #188344, #188346 or #188352
Labels
0.kind: bug 6.topic: darwin Running or building packages on Darwin

Comments

@purcell
Copy link
Member

purcell commented Jun 21, 2021

Describe the bug

I'm on a mission to get gdal (and thence postgis) compiling on M1 Macs, and having fixed hdf4, the next stumbling block is openmpi 4.1.1. Sadly, the build fails with checking size of Fortran CHARACTER... configure: WARNING: Could not determine size of CHARACTER, presumably related to gfortran.

To Reproduce
Steps to reproduce the behavior:

  1. nix-build --argstr localSystem aarch64-darwin -A openmpi

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots

checking to see if Fortran compilers need additional linker flags... none
checking  external symbol convention... single underscore
checking if C and Fortran are link compatible... yes
checking to see if Fortran compiler likes the C++ exception flags... skipped (no C++ exceptions flags)
checking to see if mpifort compiler needs additional linker flags... -Wl,-commons,use_dylibs
checking if Fortran compiler supports CHARACTER... yes
checking size of Fortran CHARACTER... configure: WARNING: Could not determine size of CHARACTER
configure: WARNING: See config.log for details
configure: error: Cannot continue
builder for '/nix/store/rnm0zh3klzh8i5n7llppncpa2rr0ifwp-openmpi-4.1.1.drv' failed with exit code 1
cannot build derivation '/nix/store/94l8ii0kr5pl9l9ahirwwvz2szq2m20p-netcdf-4.7.4.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/kn1kaph2gkqd6rc1769mqv1i49r3kk67-gdal-3.2.2.drv': 1 dependencies couldn't be built
error: build of '/nix/store/kn1kaph2gkqd6rc1769mqv1i49r3kk67-gdal-3.2.2.drv' failed

Additional context

This works fine when built for x86_64 on the same machine.

Notify maintainers

@markuskowa

Metadata

  • system: "x86_64-darwin"
  • host os: Darwin 20.5.0, macOS 10.16
  • multi-user?: yes
  • sandbox: no
  • version: nix-env (Nix) 2.3.10
  • channels(steve): "darwin, nixpkgs-21.11pre295944.0747387223e"
  • nixpkgs: /Users/steve/.nix-defexpr/channels/nixpkgs

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
  - openmpi
# a list of nixos modules affected by the problem
module:
@prusnak
Copy link
Member

prusnak commented Jun 21, 2021

Submitted PR #127694 which disables Fortran support for OpenMPI on aarch64-darwin. Would that fix the issue for you or do you require Fortran?

@prusnak
Copy link
Member

prusnak commented Jun 21, 2021

This seems to be the build failure:

10775 /private/tmp/nix-build-openmpi-4.1.1.drv-0/ccg7QqR8.s:13:15: error: index must be an integer in range [-256, 255].
10776         ldr     x2, [x2, ___stack_chk_guard];momd
10777                          ^
10778 /private/tmp/nix-build-openmpi-4.1.1.drv-0/ccg7QqR8.s:28:15: error: index must be an integer in range [-256, 255].
10779         ldr     x0, [x0, ___stack_chk_guard];momd

@purcell
Copy link
Member Author

purcell commented Jun 22, 2021

Would that fix the issue for you or do you require Fortran?

I actually have no idea if I require Fortran. I mean, presumably it's enabled for some reason, so I'm a little wary of disabling it on only one platform/arch combination: that feels like an atypical workaround.

@purcell
Copy link
Member Author

purcell commented Jun 22, 2021

To reproduce:

nix-shell -p gfortran
cat <<EOF > foo.f90
program fsize
   external size
   CHARACTER :: x(2)
   call size(x(1),x(2))
end program
EOF
gfortran   foo.f90 foo.o -o foo

I wonder if the gcc maintainers can offer any insight? @Synthetica, @vcunat, @Ericson2314

@veprbl veprbl added the 6.topic: darwin Running or building packages on Darwin label Jun 22, 2021
@vcunat
Copy link
Member

vcunat commented Jun 29, 2021

___stack_chk_guard seems to hint at the stack-protector hardening, so perhaps something like

hardeningDisable = lib.optionals (stdenv.isAarch64 && stdenv.isDarwin) [ "stackprotector" ];

could work around that? (no idea what's the real cause though, and I have no Darwin machine at hand)

@prusnak
Copy link
Member

prusnak commented Jun 29, 2021

could work around that?

You were right! Sent a PR in #128606

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment