Skip to content

Let it build on arm64 Mac#1379

Merged
slipher merged 3 commits intoDaemonEngine:masterfrom
slipher:arm64
Oct 27, 2024
Merged

Let it build on arm64 Mac#1379
slipher merged 3 commits intoDaemonEngine:masterfrom
slipher:arm64

Conversation

@slipher
Copy link
Copy Markdown
Member

@slipher slipher commented Oct 21, 2024

You can get it going with arm64 engine + amd64 NaCl like this

brew install <bunch of stuff>
cmake <dir> -DCMAKE_OSX_ARCHITECTURES=arm64 -DOpenAL_ROOT=$(brew --prefix openal-soft)
cp <daemon>/external_deps/macos-amd64-default_10/{nacl_loader,irt_core-amd64.nexe} .

Since OpenAL conflicts with a system library, it's not added to the
default search path so you have to pass
-DOpenAL_ROOT=$(brew --prefix openal-soft) to cmake.
@illwieckz
Copy link
Copy Markdown
Member

cp <daemon>/external_deps/macos-amd64-default_10/{nacl_loader,irt_core-amd64.nexe} .

Maybe there is a way for it to be done by CMake? Unless I'm wrong FreeBSD does it right by picking Linux stuff.

@illwieckz
Copy link
Copy Markdown
Member

Maybe that (untested):

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bcc10cb6b..473d94ae4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -250,12 +250,14 @@ if (USE_EXTERNAL_DEPS AND NOT NACL)
     set(EXTERNAL_DEPS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external_deps" CACHE STRING "Directory in which to store the downloaded dependencies.")
 
     set(DEPS_EXT ".tar.xz")
+    set(DEPS_ARCH ${ARCH})
 
     if (WIN32)
         set(DEPS_SYSTEM windows)
         set(SUPPORTED_${DEPS_SYSTEM}_ARCH amd64 i686)
     elseif (APPLE)
         set(DEPS_SYSTEM macos)
+        set(DEPS_ARCH amd64)
         set(SUPPORTED_${DEPS_SYSTEM}_ARCH amd64)
     elseif (LINUX OR FREEBSD)
         set(DEPS_SYSTEM linux)
@@ -270,7 +272,7 @@ if (USE_EXTERNAL_DEPS AND NOT NACL)
         set(DEPS_COMPILER default)
     endif()
 
-    if (DEPS_SYSTEM AND ARCH IN_LIST SUPPORTED_${DEPS_SYSTEM}_ARCH)
+    if (DEPS_SYSTEM AND DEPS_ARCH IN_LIST SUPPORTED_${DEPS_SYSTEM}_ARCH)
         set(DEPS_DIR ${EXTERNAL_DEPS_DIR}/${DEPS_SYSTEM}-${ARCH}-${DEPS_COMPILER}_${DEPS_VERSION})
 
         if (DAEMON_PARENT_SCOPE_DIR)

I also notice that SUPPORTED_${DEPS_SYSTEM}_ARCH may be modified to become SUPPORTED_ARCH to simplify things.

@illwieckz
Copy link
Copy Markdown
Member

Hmmm, maybe, unlike Linux that only provides NaCl in the deps package, the macos deps package will mess with building by providing amd64 libraries…

@slipher
Copy link
Copy Markdown
Member Author

slipher commented Oct 21, 2024

Hmmm, maybe, unlike Linux that only provides NaCl in the deps package, the macos deps package will mess with building by providing amd64 libraries…

Yep, just tried and that's what happens.

Don't activate the workaround, which is supposed to be Linux-specific,
for disabling Native Client platform qualification. The Rosetta
emulation is too good: platform qualification can't tell it isn't amd64.
Copy link
Copy Markdown
Member

@illwieckz illwieckz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

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 this pull request may close these issues.

2 participants