Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Apple Silicon support #1185

Open
jviotti opened this issue Jun 10, 2021 · 3 comments
Open

Apple Silicon support #1185

jviotti opened this issue Jun 10, 2021 · 3 comments

Comments

@jviotti
Copy link

jviotti commented Jun 10, 2021

Hey there! Are there plans to provide Apple Silicon Sourcetrail builds at any point soon?

@jviotti
Copy link
Author

jviotti commented Jun 10, 2021

The tip of master fails at this inline assembly point:

In file included from /Users/jviotti/Projects/playground/Sourcetrail/src/test/test_main.cpp:3:
/Users/jviotti/Projects/playground/Sourcetrail/src/external/catch/catch.hpp:5767:13: error: unrecognized instruction mnemonic, did you mean: bit, cnt, hint, ins, not?
            CATCH_BREAK_INTO_DEBUGGER();
            ^
/Users/jviotti/Projects/playground/Sourcetrail/src/external/catch/catch.hpp:5485:75: note: expanded from macro 'CATCH_BREAK_INTO_DEBUGGER'
    #define CATCH_BREAK_INTO_DEBUGGER() if( Catch::isDebuggerActive() ) { CATCH_TRAP(); }
                                                                          ^
/Users/jviotti/Projects/playground/Sourcetrail/src/external/catch/catch.hpp:5464:34: note: expanded from macro 'CATCH_TRAP'
    #define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */
                                 ^
<inline asm>:1:2: note: instantiated into assembly here
        int $3
        ^
1 error generated.
make[2]: *** [CMakeFiles/Sourcetrail_test.dir/src/test/test_main.cpp.o] Error 1
make[1]: *** [CMakeFiles/Sourcetrail_test.dir/all] Error 2
make: *** [all] Error 2

@jviotti
Copy link
Author

jviotti commented Jun 10, 2021

Looks like this was already fixed by Catch2 upstream: catchorg/Catch2@a25c1a2

@jviotti
Copy link
Author

jviotti commented Jun 10, 2021

Not sure how the project is managing its vendored dependencies, but the build works with this patch:

diff --git a/src/external/catch/catch.hpp b/src/external/catch/catch.hpp
index 099119d4..7eece27d 100644
--- a/src/external/catch/catch.hpp
+++ b/src/external/catch/catch.hpp
@@ -5461,7 +5461,11 @@ namespace Catch {

 #ifdef CATCH_PLATFORM_MAC

-    #define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */
+    #if defined(__i386__) || defined(__x86_64__)
+        #define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */
+    #elif defined(__aarch64__)
+        #define CATCH_TRAP()  __asm__(".inst 0xd4200000")
+    #endif

 #elif defined(CATCH_PLATFORM_LINUX)
     // If we can use inline assembler, do it because this allows us to break

The app then opens up fine, but it looks like there is something weird with the colors and the UI?

Screen Shot 2021-06-10 at 17 43 26

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant