Skip to content

Add support for Apple Silicon#201

Merged
bombela merged 1 commit into
bombela:masterfrom
Philanatidae:feature/apple-silicon
Jan 4, 2021
Merged

Add support for Apple Silicon#201
bombela merged 1 commit into
bombela:masterfrom
Philanatidae:feature/apple-silicon

Conversation

@Philanatidae

@Philanatidae Philanatidae commented Jan 3, 2021

Copy link
Copy Markdown
Contributor

Fixes #200.

When compiling on Apple Silicon at commit 27a8900, the following build error is produced:

In file included from ../backward-cpp/backward.cpp:36:
../backward-cpp/backward.hpp:4160:60: error: member reference type 'struct __darwin_mcontext64 *' is a pointer; did you mean to use '->'?
    error_addr = reinterpret_cast<void *>(uctx->uc_mcontext.pc);
                                          ~~~~~~~~~~~~~~~~~^
                                                           ->
../backward-cpp/backward.hpp:4160:61: error: no member named 'pc' in '__darwin_mcontext64'
    error_addr = reinterpret_cast<void *>(uctx->uc_mcontext.pc);
                                          ~~~~~~~~~~~~~~~~~ ^

This is caused by __aarch64__ being defined on Apple Silicon, however is incorrect for assigning the error address.

A conditional to check for __APPLE__ was added to the __aarch64__ #ifdef case with the appropriate error address cast.

All tests pass when compiling for ARM64 and Universal 2, ran on an M1 Mac (both ARM64 and Universal 2 binaries) and an Intel Mac.

@eboasson

eboasson commented Jan 4, 2021

Copy link
Copy Markdown

Works for me for doing native builds in ROS 2, and this one is a bit cleaner than my quick fix at osrf/osrf_testing_tools_cpp#62

Any chance of it getting merged quickly so we can merge it into the ROS 2 one?

@bombela bombela merged commit ed97fa0 into bombela:master Jan 4, 2021
@bombela

bombela commented Jan 4, 2021

Copy link
Copy Markdown
Owner

Thanks!

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.

Compilation fails on macOS

3 participants