Closed RolandMacDoland closed 1 year ago
We would appreciate knowing the status of this issue. Every new apple m1 user in our company encounters this issue. @bettinaheim @idavis
I would also be grateful to have wheels for M1 having noticed their absence today.
After initial spike:
Configuring the build to create a universal build of LLVM demonstrates the issue.
diff --git a/eng/psakefile.ps1 b/eng/psakefile.ps1
index 69ce69c..d539814 100644
--- a/eng/psakefile.ps1
+++ b/eng/psakefile.ps1
@@ -264,6 +264,13 @@ task check-environment {
}
# ensure that we are now in a virtual environment
Assert ((Test-InVirtualEnvironment) -eq $true) "$($env_message -join ' ')"
+
+ if ($IsMacOS) {
+ $env:ARCHFLAGS = "-arch x86_64 -arch arm64"
+ $env:DEVELOPER_DIR = '/Applications/Xcode.app/Contents/Developer'
+ $env:SDKROOT = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk'
+ $env:MACOSX_DEPLOYMENT_TARGET = '10.9'
+ }
}
task init -depends check-environment {
diff --git a/qirlib/config.cmake b/qirlib/config.cmake
index 5ff442f..c1982db 100644
--- a/qirlib/config.cmake
+++ b/qirlib/config.cmake
@@ -38,8 +38,12 @@ endif()
set(CMAKE_BUILD_TYPE MinSizeRel CACHE STRING "")
-set(LLVM_TARGETS_TO_BUILD "Native;X86" CACHE STRING "")
-
+if(APPLE)
+ set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "")
+ set(LLVM_TARGETS_TO_BUILD "X86;ARM;AArch64" CACHE STRING "")
+else()
+ set(LLVM_TARGETS_TO_BUILD "Native;X86" CACHE STRING "")
+endif()
set(PACKAGE_VENDOR LLVM.org CACHE STRING "")
# Turn off
@@ -79,5 +83,14 @@ else()
set(CPACK_BINARY_TGZ ON CACHE BOOL "")
endif()
+# Apple specific changes to match their toolchain
+if(APPLE)
+ #set(COMPILER_RT_ENABLE_IOS OFF CACHE BOOL "")
+ #set(COMPILER_RT_ENABLE_WATCHOS OFF CACHE BOOL "")
+ #set(COMPILER_RT_ENABLE_TVOS OFF CACHE BOOL "")
-
+ set(CMAKE_MACOSX_RPATH ON CACHE BOOL "")
+ set(CLANG_SPAWN_CC1 ON CACHE BOOL "")
+ set(CMAKE_C_FLAGS "-fno-stack-protector -fno-common -Wno-profile-instr-unprofiled" CACHE STRING "")
+ set(CMAKE_CXX_FLAGS "-fno-stack-protector -fno-common -Wno-profile-instr-unprofiled" CACHE STRING "")
+endif()
Running build.ps1
it will eventually fail with:
error: failed to add native library /<...>/pyqir/target/llvm13-0/lib/libLLVMWindowsManifest.a:
file too small to be an archive
error: could not compile `llvm-sys` due to previous error
If we want to support intel and apple silicon, we'll need to create two packages for now.
GitHub Actions self-hosted runners now support Apple M1 hardware. So we have to stand up our own self-hosted runner as the GitHub-hosted macOS runners for Apple M1 silicon options #528 is still open.
0.7.0 released with a macOS arm64 wheel.
Is your feature request related to a problem? Please describe. It would be useful for our CI to use wheels for M1. Since we're running tests for that platform.