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

Graphite fails to build on Darwin with M1 processor #70

Closed
topherocity opened this issue Dec 10, 2021 · 3 comments
Closed

Graphite fails to build on Darwin with M1 processor #70

topherocity opened this issue Dec 10, 2021 · 3 comments

Comments

@topherocity
Copy link

Hello!

I was unable to install Graphite on an ARM-based Mac, with the following error:

     137    cd /private/var/folders/q2/1vrny6hx1j3f4z0745zjrqwc0000gp/T/choward36/spack-stage/spack-stag
            e-graphite2-1.3.13-7uo4coik2xuzwerltu6ndvnauzncc7gv/spack-build-7uo4coi/tests/json && /Users
            /choward36/git/spack/lib/spack/env/clang/clang++  -I/var/folders/q2/1vrny6hx1j3f4z0745zjrqwc
            0000gp/T/choward36/spack-stage/spack-stage-graphite2-1.3.13-7uo4coik2xuzwerltu6ndvnauzncc7gv
            /spack-src/include -I/var/folders/q2/1vrny6hx1j3f4z0745zjrqwc0000gp/T/choward36/spack-stage/
            spack-stage-graphite2-1.3.13-7uo4coik2xuzwerltu6ndvnauzncc7gv/spack-src/src -O2 -g -DNDEBUG
            -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/D
            eveloper/SDKs/MacOSX.sdk -std=gnu++11 -MD -MT tests/json/CMakeFiles/jsontest.dir/jsontest.cp
            p.o -MF CMakeFiles/jsontest.dir/jsontest.cpp.o.d -o CMakeFiles/jsontest.dir/jsontest.cpp.o -
            c /var/folders/q2/1vrny6hx1j3f4z0745zjrqwc0000gp/T/choward36/spack-stage/spack-stage-graphit
            e2-1.3.13-7uo4coik2xuzwerltu6ndvnauzncc7gv/spack-src/tests/json/jsontest.cpp
     138    clang: warning: argument unused during compilation: '-msse2' [-Wunused-command-line-argument
            ]
     139    clang: warning: argument unused during compilation: '-msse2' [-Wunused-command-line-argument
            ]
  >> 140    error: unknown FP unit 'sse'
  >> 141    make[2]: *** [src/CMakeFiles/graphite2.dir/direct_machine.cpp.o] Error 1

This is because the aarch64 architecture does not understand SSE extensions. The following patch fixes the problem:

--- a/src/CMakeLists.txt        2018-12-20 01:28:50.000000000 -0500
+++ b/src/CMakeLists.txt        2021-12-10 15:08:59.000000000 -0500
@@ -136,9 +136,12 @@

 if  (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
     set_target_properties(graphite2 PROPERTIES
-        COMPILE_FLAGS   "-Wall -Wextra -Wno-unknown-pragmas -Wimplicit-fallthrough -Wendif-labels -Wshadow -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -fno-rtti -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden -mfpmath=sse -msse2"
+        COMPILE_FLAGS   "-Wall -Wextra -Wno-unknown-pragmas -Wimplicit-fallthrough -Wendif-labels -Wshadow -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -fno-rtti -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden"
         LINK_FLAGS      "-nodefaultlibs"
         LINKER_LANGUAGE C)
+    if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86|i.86")
+        add_definitions(-mfpmath=sse -msse2)
+    endif()
     target_link_libraries(graphite2 c)
     include(Graphite)
     nolib_test(stdc++ $<TARGET_SONAME_FILE:graphite2>)
@adamjstewart
Copy link

Just encountered this same issue on macOS 12.4 (Apple M1 Pro)

@tim-eves
Copy link
Contributor

Fixed in 4f78a29

It's odd you should be encountering it now as that commit was from 2019, are you building from master or an earlier release?

@adamjstewart
Copy link

I was just able to successfully install the 1.3.14 release, not sure what version I was having problems with back in June. Anyway, thanks for the fix! (even if it was 3 years ago lol)

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

3 participants