Snaipe / Mimick

A KISS, cross-platform C mocking library
MIT License
152 stars 43 forks source link

Problem with m1 Mac #20

Open Fricodelco opened 3 years ago

Fricodelco commented 3 years ago

I tried to compile ros2 on apple silicon Mac, and get several errors with mimics. --- stderr: mimick_vendor
Cloning into 'mimick-ext'... Note: switching to '99a35f3d2067708931945c64ac9caee80a0ef50e'.

You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command. Example:

git switch -c

Or undo this operation with:

git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 99a35f3 Update cmake minimum version to 2.8.12 (#15) Undefined symbols for architecture arm64: "_mmk_trampoline", referenced from: _create_trampoline in libmimick.a(trampoline.c.o) "_mmk_trampoline_end", referenced from: _create_trampoline in libmimick.a(trampoline.c.o) ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[5]: [sample/strdup/strdup_test] Error 1 make[4]: [sample/strdup/CMakeFiles/strdup_test.dir/all] Error 2 make[3]: [all] Error 2 make[2]: [mimick-ext-prefix/src/mimick-ext-stamp/mimick-ext-build] Error 2 make[1]: [CMakeFiles/mimick-ext.dir/all] Error 2 make: [all] Error 2 make: INTERNAL: Exiting with 9 jobserver tokens available; should be 8!

Failed <<< mimick_vendor [6.73s, exited with code 2] Aborted <<< console_bridge_vendor [2.48s] Aborted <<< qt_gui [1.40s]
Aborted <<< resource_retriever [2.64s]
Aborted <<< rosidl_runtime_cpp [5.30s]
Aborted <<< zstd_vendor [41.8s]
Aborted <<< foonathan_memory_vendor [48.2s]
Aborted <<< rviz_ogre_vendor [50.5s]

Summary: 103 packages finished [1min 1s] 1 package failed: mimick_vendor 7 packages aborted: console_bridge_vendor foonathan_memory_vendor qt_gui resource_retriever rosidl_runtime_cpp rviz_ogre_vendor zstd_vendor 15 packages had stderr output: ament_index_cpp fastcdr foonathan_memory_vendor mimick_vendor orocos_kdl resource_retriever rosidl_runtime_cpp rosidl_typesupport_interface rviz_ogre_vendor shared_queues_vendor test_osrf_testing_tools_cpp tlsf uncrustify_vendor yaml_cpp_vendor zstd_vendor 198 packages not processed

I think issue in the mimick_vendor/mimick-ext-prefix/src/mimick-ext/src/asm/trampoline-aarch64.S

YVbakker commented 3 years ago

Same issue here, in libmimick.a there is a trampoline-aarch64.S.o object, however the code calls "_mmk_trampoline", referenced from: _create_trampoline in libmimick.a(trampoline.c.o) "_mmk_trampoline_end", referenced from: _create_trampoline in libmimick.a(trampoline.c.o) from trampoline.c.o instead of the the correct aarch64 one? Not sure how to fix this though, I don't know enough about assembly, but I'm not sure whether this is an assembly issue or not. To me it looks like a non-updated static reference somewhere, most likely due to the new architecture on mac.

Another thing I noticed is that Undefined symbols for architecture arm64:

Says arm64, while the architecture is usually identified by aarch64. Not sure if this is correct behaviour and just a way for the linker to reference to the architecture internally. It's a linker issue for sure, regardless of the exact cause.

YVbakker commented 3 years ago

Nevermind, this issue is not related to mimick at all, as downloading the sources directly from github and just compiling mimick (using the supplied cmake configuration) on an m1 mac works just fine. It must be a configuration error within the build process for ros2, or software using mimick as a dependency. I believe this issue can be closed.

homalozoa commented 3 years ago

Hey, @YVbakker . Check this commit, please. Hope it helps.

YVbakker commented 3 years ago

Hey, @YVbakker . Check this commit, please. Hope it helps.

Thanks @homalozoa - which commit?

homalozoa commented 3 years ago

Sorry for missed copied message… here is the link : https://github.com/ros2/mimick_vendor/commit/8c738197e8d3511dd4344eb871e5c48392b7c673 @YVbakker