versatica / libmediasoupclient

mediasoup client side C++ library

Home Page:https://mediasoup.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mac M1 fails to build while building tests

MarekChleb opened this issue · comments

Steps to reproduce

OSX_VERSION: 12.1 Monterey

Via tutorial first install depot tools and then:

cd /home/foo/src
mkdir webrtc-checkout
cd webrtc-checkout
fetch --nohooks webrtc
gclient sync
cd src
git checkout -b m94 refs/remotes/branch-heads/4606
gclient sync
gn gen out/m94 --args='is_debug=false is_component_build=false is_clang=true rtc_include_tests=false rtc_use_h264=true use_rtti=true mac_deployment_target="10.11" use_custom_libcxx=false'

ninja -C out/m94

cd /home/foo/src/libmediasoupclient

cmake . -Bbuild \
  -DLIBWEBRTC_INCLUDE_PATH:PATH=/home/foo/src/webrtc-checkout/src \
  -DLIBWEBRTC_BINARY_PATH:PATH=/home/foo/src/webrtc-checkout/src/out/m94/obj

make -C build/

Where is the bug

While doing make -C build/ we get:

[ 84%] Building CXX object libsdptransform/test/CMakeFiles/test_sdptransform.dir/tests.cpp.o
In file included from /Users/marekwawreniuk/Desktop/repos/c/libmediasoupclient/deps/libsdptransform/test/tests.cpp:4:
/Users/marekwawreniuk/Desktop/repos/c/libmediasoupclient/deps/libsdptransform/test/include/catch.hpp:8165:13: error: unrecognized instruction mnemonic, did you mean: bit, cnt, hint, ins, not?
            CATCH_BREAK_INTO_DEBUGGER();
            ^
/Users/marekwawreniuk/Desktop/repos/c/libmediasoupclient/deps/libsdptransform/test/include/catch.hpp:7877:79: note: expanded from macro 'CATCH_BREAK_INTO_DEBUGGER'
    #define CATCH_BREAK_INTO_DEBUGGER() []{ if( Catch::isDebuggerActive() ) { CATCH_TRAP(); } }()
                                                                              ^
/Users/marekwawreniuk/Desktop/repos/c/libmediasoupclient/deps/libsdptransform/test/include/catch.hpp:7855: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]: *** [libsdptransform/test/CMakeFiles/test_sdptransform.dir/tests.cpp.o] Error 1
make[1]: *** [libsdptransform/test/CMakeFiles/test_sdptransform.dir/all] Error 2
make: *** [all] Error 2

What worked

Based on different issue replacing #define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */ with #define CATCH_TRAP() asm(".inst 0xd4200000") in libmediasoupclient/deps/libsdptransform/test/include/catch.hpp:7855 worked!

Solution

I have no idea, I don't really know C++, but this might help someone smarter create a sufficient solution.

@ibc, @jmillan : This was actually fixed in catch a couple years ago. Just need to update the version of catch checked into the repo:

catchorg/Catch2@a25c1a2

Will try to do it today.

@dlmanning Ive updated libsdptransform with latest Catch and latest jsoncpp. Trying to do the same here.

But will do another day because Gellert decided that today was a good day to create yet another menubar related PR.