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

macOS build fix #1

Merged
merged 25 commits into from
Nov 12, 2024
Merged

macOS build fix #1

merged 25 commits into from
Nov 12, 2024

Conversation

farhangnaderi
Copy link
Collaborator

@farhangnaderi farhangnaderi commented Sep 12, 2024

This is initial sketch. Let me know if I am missing anything here!

@farhangnaderi farhangnaderi marked this pull request as ready for review September 13, 2024 16:07
@farhangnaderi farhangnaderi changed the title [WIP] macOS build fix macOS build fix Sep 13, 2024
@mrpollo
Copy link

mrpollo commented Sep 13, 2024

My issue still needs to be solved. Has anyone figured this one out? I'm on apple silicon.

cc @MaEtUgR

 cmake -S src/PlotJuggler -B build/PlotJuggler -DCMAKE_INSTALL_PREFIX=install 
-- The C compiler identification is AppleClang 15.0.0.15000309
-- The CXX compiler identification is AppleClang 15.0.0.15000309
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - broken
CMake Error at /opt/homebrew/Cellar/cmake/3.30.3/share/cmake/Modules/CMakeTestCCompiler.cmake:67 (message):
  The C compiler

    "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: '/Users/rroche/Work/Dronecode/PlotJuggler/plotjuggler_ws/build/PlotJuggler/CMakeFiles/CMakeScratch/TryCompile-8kItw2'

    Run Build Command(s): /opt/homebrew/Cellar/cmake/3.30.3/bin/cmake -E env VERBOSE=1 /usr/bin/make -f Makefile cmTC_b372c/fast
    /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/cmTC_b372c.dir/build.make CMakeFiles/cmTC_b372c.dir/build
    Building C object CMakeFiles/cmTC_b372c.dir/testCCompiler.c.o
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc   -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -MD -MT CMakeFiles/cmTC_b372c.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_b372c.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_b372c.dir/testCCompiler.c.o -c /Users/rroche/Work/Dronecode/PlotJuggler/plotjuggler_ws/build/PlotJuggler/CMakeFiles/CMakeScratch/TryCompile-8kItw2/testCCompiler.c
    Linking C executable cmTC_b372c
    /opt/homebrew/Cellar/cmake/3.30.3/bin/cmake -E cmake_link_script CMakeFiles/cmTC_b372c.dir/link.txt --verbose=1
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc  -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names /opt/homebrew/opt/qt@5/lib  CMakeFiles/cmTC_b372c.dir/testCCompiler.c.o -o cmTC_b372c
    ld: file cannot be mmap()ed, errno=22 path=/opt/homebrew/opt/qt@5/lib in '/opt/homebrew/opt/qt@5/lib'
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[1]: *** [cmTC_b372c] Error 1
    make: *** [cmTC_b372c/fast] Error 2





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:3 (PROJECT)


-- Configuring incomplete, errors occurred!

@farhangnaderi farhangnaderi self-assigned this Sep 13, 2024
@farhangnaderi farhangnaderi added the bug Something isn't working label Sep 13, 2024
@farhangnaderi
Copy link
Collaborator Author

@ryanjAA maybe able to test this as well?

@MaEtUgR
Copy link
Member

MaEtUgR commented Sep 15, 2024

I'm checking 🏃
For reference these are the minimal, hacky changes I did last time to build it:
facontidavide/PlotJuggler@main...PX4:PlotJuggler:maetugr/initial-macm1

@MaEtUgR
Copy link
Member

MaEtUgR commented Sep 16, 2024

I'm on apple silicon.

@mrpollo We're too, that's the main reason I'm using an Apple device at all.

My issue still needs to be solved.

I have a feeling this is your toolchain/dependency setup.

is not able to compile a simple test program.

Sounds pretty basic like the compiler not being available. Could it have to do with missing Apple Xcode developer tools? I did not manually install it, was part of the brew installation for me and came in automatically. I followed https://github.com/MaEtUgR/MaEtUgR/blob/master/scripts/mac/brew.sh and already had the PX4 toolchain working before attempting PlotJuggler.

@MaEtUgR
Copy link
Member

MaEtUgR commented Sep 16, 2024

For me the build mainly fails with the moc_datastream_zmq failing compilation because the include libraries are somehow wrong. Haven't figured out where yet, these seem to be autogenerated in some unsupported way. I had brew install zeromq already installed and the include folder in cmake seems to be correct so the dependencies are just not correctly represented for the build step.

[ 86%] Building CXX object plotjuggler_plugins/DataStreamZMQ/CMakeFiles/DataStreamZMQ.dir/DataStreamZMQ_autogen/mocs_compilation.cpp.o
In file included from /Users/maetugr/PlotJugglerTest/build/plotjuggler_plugins/DataStreamZMQ/DataStreamZMQ_autogen/mocs_compilation.cpp:2:
In file included from /Users/maetugr/PlotJugglerTest/build/plotjuggler_plugins/DataStreamZMQ/DataStreamZMQ_autogen/EWIEGA46WW/moc_datastream_zmq.cpp:10:
In file included from /Users/maetugr/PlotJugglerTest/build/plotjuggler_plugins/DataStreamZMQ/DataStreamZMQ_autogen/EWIEGA46WW/../../../../../plotjuggler_plugins/DataStreamZMQ/datastream_zmq.h:9:
/Users/maetugr/PlotJugglerTest/plotjuggler_plugins/DataStreamZMQ/zmq.hpp:36:10: fatal error: 'zmq.h' file not found
#include <zmq.h>
         ^~~~~~~
1 error generated.
make[2]: *** [plotjuggler_plugins/DataStreamZMQ/CMakeFiles/DataStreamZMQ.dir/DataStreamZMQ_autogen/mocs_compilation.cpp.o] Error 1
make[1]: *** [plotjuggler_plugins/DataStreamZMQ/CMakeFiles/DataStreamZMQ.dir/all] Error 2
make: *** [all] Error 2

My hacky solution was to just remove all ZMQ support because I don't use it but that's not something contributable and the fix from @farhangnaderi in this pr also doesn't work for me.
591cb1d#diff-285967ff03f5fb94705efb5bebd763944b7591d7b23062885f4a4823ed10d1bfR12-R33

@MaEtUgR
Copy link
Member

MaEtUgR commented Sep 16, 2024

ok my initial hacks branch actually requires a patch to protobuf which is not workable at all. Here's the new one I just tested:
facontidavide/PlotJuggler@main...PX4:PlotJuggler:maetugr/macm1-new
It's based on PlotJuggler upstream main, builds fine on 14.6.1 with brew all upgraded. Now we can solve things properly. I think @farhangnaderi already did some things correctly in this pr but the ZMQ fix doesn't work for me...

@farhangnaderi
Copy link
Collaborator Author

farhangnaderi commented Sep 20, 2024

ok my initial hacks branch actually requires a patch to protobuf which is not workable at all. Here's the new one I just tested: facontidavide/[email protected]:PlotJuggler:maetugr/macm1-new It's based on PlotJuggler upstream main, builds fine on 14.6.1 with brew all upgraded. Now we can solve things properly. I think @farhangnaderi already did some things correctly in this pr but the ZMQ fix doesn't work for me...

Thanks @MaEtUgR ,
Your solution leads to another protobuf error (am on SDK 15.0 now):

/Users/farhang/plotjuggler_ws/src/PlotJuggler/plotjuggler_plugins/ParserProtobuf/protobuf_factory.cpp:65:22: error: variable type 'FileErrorCollector' is an abstract class
   65 |   FileErrorCollector error_collector;
      |                      ^
/opt/homebrew/include/google/protobuf/compiler/importer.h:183:16: note: unimplemented pure virtual method 'RecordError' in 'FileErrorCollector'
  183 |   virtual void RecordError(absl::string_view filename, int line, int column,
      |                ^
1 warning and 1 error generated.
gmake[2]: *** [plotjuggler_plugins/ParserProtobuf/CMakeFiles/ProtobufParser.dir/build.make:129: plotjuggler_plugins/ParserProtobuf/CMakeFiles/ProtobufParser.dir/protobuf_factory.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:2791: plotjuggler_plugins/ParserProtobuf/CMakeFiles/ProtobufParser.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2

I corrected them on this pull but your solution passed the classic zmq.h error.

@DronecodeBot
Copy link

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/px4-sync-q-a-sep-25-2024/40853/1

COMPILE.md Outdated Show resolved Hide resolved
COMPILE.md Outdated Show resolved Hide resolved
@@ -16,23 +16,35 @@ jobs:
- name: Sync repository
uses: actions/checkout@v2

- name: Update PATH
run: echo "PATH=$PATH:/opt/homebrew/bin:/opt/homebrew/sbin" >> $GITHUB_ENV
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You no longer need this step

.github/workflows/macos.yaml Outdated Show resolved Hide resolved
.github/workflows/macos.yaml Outdated Show resolved Hide resolved
.github/workflows/macos.yaml Outdated Show resolved Hide resolved
.github/workflows/macos.yaml Outdated Show resolved Hide resolved
.github/workflows/macos.yaml Show resolved Hide resolved
.github/workflows/macos.yaml Show resolved Hide resolved
.github/workflows/macos.yaml Outdated Show resolved Hide resolved
.github/workflows/macos.yaml Outdated Show resolved Hide resolved
@mrpollo mrpollo removed the request for review from MaEtUgR November 12, 2024 17:48
@mrpollo mrpollo merged commit 5f77b1a into main Nov 12, 2024
3 of 19 checks passed
@mrpollo mrpollo deleted the pr-macos-build-rev1 branch November 12, 2024 18:55
farhangnaderi added a commit that referenced this pull request Dec 19, 2024
 ci: Fixes macOS builds (#1)

adds runners for both Intel and Apple silicon macs

---------

Co-authored-by: Daniel Agar <[email protected]>
Co-authored-by: Ramon Roche <[email protected]>
farhangnaderi added a commit that referenced this pull request Jan 13, 2025
Pr fix ci (#3)

 ci: Fixes macOS builds (#1)

adds runners for both Intel and Apple silicon macs

---------

Co-authored-by: Daniel Agar <[email protected]>
Co-authored-by: Ramon Roche <[email protected]>
farhangnaderi added a commit that referenced this pull request Jan 14, 2025
ci: Fixes macOS builds (#1)

adds runners for both Intel and Apple silicon macs

---------

Co-authored-by: Daniel Agar <[email protected]>
Co-authored-by: Ramon Roche <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants