folly
folly copied to clipboard
Failed to build main branch on Apple M1
Hello folks,
I'm having a build failure when trying to build the main branch on an Apple M1 computer, build fails with message:
ninja: build stopped: subcommand failed.
Command '['/opt/homebrew/opt/cmake/bin/cmake', '--build', '/private/var/folders/m0/t9vnf_6x66xgspg0gbjvwp700000gn/T/fbcode_builder_getdeps-ZUsersZsergiolemosZLibraryZMobile DocumentsZcom~apple~CloudDocsZstudiesZcppZfollyZbuildZfbcode_builder/build/folly', '--target', 'install', '--config', 'Release', '-j', '10']' returned non-zero exit status 1.
!! Failed
The actual error seems to be:
In file included from /Users/sergiolemos/Library/Mobile Documents/com~apple~CloudDocs/studies/cpp/folly/folly/experimental/test/EliasFanoCodingTest.cpp:25:
/Users/sergiolemos/Library/Mobile Documents/com~apple~CloudDocs/studies/cpp/folly/folly/experimental/EliasFanoCoding.h:43:2: error: EliasFanoCoding.h requires x86_64
#error EliasFanoCoding.h requires x86_64
^
2 warnings and 1 error generated.
Which comes from here: https://github.com/facebook/folly/blob/1f2e92bf1a36a020157a366d48e52c720c669606/folly/experimental/EliasFanoCoding.h#L42
Installing Folly from brew works correctly. My system is:
uname -a
Darwin New-MacBook-Pro.local 21.3.0 Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T6000 arm64
I've tried to search previous issues with this same message, but could not find any. Is it a known compatibility issue with Apple M1 architecture? Is there any known mitigation to allow building from source ?
Much appreciate the time.
I just ran into this issue on an M1 MacBook.
The reason that brew install folly works is because the pre-built package doesn't try to build the tests, whereas if you use the build.sh script provided by the code, it will build the library and the tests.
I opened a PR that should fix this issue, since the body of the EliasFanoCodingTest.cpp source should not be included if it's being built on a non-x64 platform.