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

Failure to build on M1 Mac #370

Closed
danwallach opened this issue May 19, 2021 · 6 comments
Closed

Failure to build on M1 Mac #370

danwallach opened this issue May 19, 2021 · 6 comments

Comments

@danwallach
Copy link
Collaborator

Bug Report

I'm on a fresh new M1 MacBook Air, trying to get ElectionGuard-Python installed and running. Here's how that's going:

  • Had to change pip to pip3 and python to python3 in the Makefile
  • Had to brew install poetry (the built-in installer didn't work for some reason)
  • The install of the cryptography package failed because it couldn't find an OpenSSL dependency, even though OpenSSL is already installed.
build/temp.macosx-10.14.6-arm64-3.8/_openssl.c:575:10: fatal error: 'openssl/opensslv.h' file not found
#include <openssl/opensslv.h>

According to Homebrew:

% brew link openssl
Warning: Refusing to link macOS provided/shadowed software: openssl@1.1
If you need to have openssl@1.1 first in your PATH, run:
  echo 'setenv PATH /opt/homebrew/opt/openssl@1.1/bin:$PATH' >> ~/.tcshrc

For compilers to find openssl@1.1 you may need to set:
  setenv LDFLAGS -L/opt/homebrew/opt/openssl@1.1/lib;
  setenv CPPFLAGS -I/opt/homebrew/opt/openssl@1.1/include;

You can apparently omit the @1.1 part, and it still works. I don't know how you can set these flags usefully in the Makefile in a way that will work across many different environments. Maybe you need some sort of autoconf script that runs, figures out the local paths, and writes them into the Makefile.

Numpy doesn't work either, spitting out errors relating to "altivec" flags. Some details:
numpy/numpy#17807
https://stackoverflow.com/questions/65336789/numpy-build-fail-in-m1-big-sur-11-1

Looks like there are some workarounds that use Rosetta, and other workarounds that use an "unstable" version of numpy.

Anyway, the high-bit here is that M1 Macs don't "just work". At least, not yet.

@danwallach
Copy link
Collaborator Author

Of possible relevance: there's an Apple release of Tensorflow which includes packages like numpy. Here's a complicated sequence of instructions that might be adaptable to our needs.

https://github.com/rybodiddly/Poetry-Pyenv-Homebrew-Numpy-TensorFlow-on-Apple-Silicon-M1

@rc-ms
Copy link
Contributor

rc-ms commented Jun 4, 2021

dr dapper @danwallach can you check @AddressXception 's lastest checkin and see it the cause has been improved? Numpy has left the building

@danwallach
Copy link
Collaborator Author

I can confirm that on the bug/binary-serialization branch, on my M1 Mac, I can run make and it seems to work. It's using Python 3.9.5 rather than Python 3.8, for whatever reason. Does this matter?

This would be a good time to nudge for issue #76, which would make the unit tests run a lot faster, and would then be really helpful when all you really want to do is make sure your machine configuration actually works.

@AddressXception
Copy link
Collaborator

@danwallach yes we updated to 3.9.5 because it is what is used in the github action runner. We were running into this bug fix made in python where the test runner was trying to inherit from a frozen data class and causing the CI to fail.

@keithrfung
Copy link
Collaborator

@danwallach Has this ticket been resolved with using 3.9.5? Or is this still open?

@danwallach
Copy link
Collaborator Author

Seems to be working now.

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

No branches or pull requests

4 participants