The cmake generate step fails on my fresh install of BlueOS on a RPi4 doing the following:
sudo apt install build-essential cmake git
git clone https://github.com/mavlink/MAVSDK.git
cd MAVSDK
git submodule update --init --recursive
cmake -DCMAKE_BUILD_TYPE=Debug -Bbuild/default -H.
I also tried the following:
git checkout v2.12
gcc --version (result is g++ (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110)
sudo apt upgrade
sudo apt install googletest
In all cases, I get the following error messages ( I never even got to compilation step:
cmake --build build/default
[100%] Built target gtest
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found curl via config file: /home/pi/libtest/MAVSDK/build/default/third_party/install/lib/cmake/CURL
-- Looking for lzma_auto_decoder in /home/pi/libtest/MAVSDK/build/default/third_party/install/lib/liblzmad.a
-- Looking for lzma_auto_decoder in /home/pi/libtest/MAVSDK/build/default/third_party/install/lib/liblzmad.a - found
-- Looking for lzma_easy_encoder in /home/pi/libtest/MAVSDK/build/default/third_party/install/lib/liblzmad.a
-- Looking for lzma_easy_encoder in /home/pi/libtest/MAVSDK/build/default/third_party/install/lib/liblzmad.a - found
-- Looking for lzma_lzma_preset in /home/pi/libtest/MAVSDK/build/default/third_party/install/lib/liblzmad.a
-- Looking for lzma_lzma_preset in /home/pi/libtest/MAVSDK/build/default/third_party/install/lib/liblzmad.a - found
-- Found LibLZMA: /home/pi/libtest/MAVSDK/build/default/third_party/install/lib/liblzmad.a (found version "5.4.5")
-- All plugins enabled
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found GTest: /home/pi/libtest/MAVSDK/build/default/third_party/install/lib/libgtest.a
-- BUILD_MAVSDK_SERVER not set: not building grpc mavsdk_server
-- Configuring done
CMake Error at src/integration_tests/CMakeLists.txt:5 (add_executable):
Target "integration_tests_runner" links to target "GTest::gmock" but the
target was not found. Perhaps a find_package() call is missing for an
IMPORTED target, or an ALIAS target is missing?
CMake Error at src/unit_tests/CMakeLists.txt:3 (add_executable):
Target "unit_tests_runner" links to target "GTest::gmock" but the target
was not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
CMake Error at src/system_tests/CMakeLists.txt:1 (add_executable):
Target "system_tests_runner" links to target "GTest::gmock" but the target
was not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.
actually, the compilation step did run, but also errored out:
[ 86%] Linking CXX executable system_tests_runner
/usr/bin/ld: cannot find -lGTest::gmock
collect2: error: ld returned 1 exit status
gmake[2]: *** [src/system_tests/CMakeFiles/system_tests_runner.dir/build.make:376: src/system_tests/system_tests_runner] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1097: src/system_tests/CMakeFiles/system_tests_runner.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
[ 86%] Building CXX object src/unit_tests/CMakeFiles/unit_tests_runner.dir/__/mavsdk/plugins/mission_raw/mission_import_test.cpp.o
[ 87%] Building CXX object src/integration_tests/CMakeFiles/integration_tests_runner.dir/info.cpp.o
[ 87%] Building CXX object src/integration_tests/CMakeFiles/integration_tests_runner.dir/offboard_attitude.cpp.o
[ 87%] Building CXX object src/integration_tests/CMakeFiles/integration_tests_runner.dir/log_files.cpp.o
[ 88%] Building CXX object src/integration_tests/CMakeFiles/integration_tests_runner.dir/mission_cancellation.cpp.o
[ 88%] Building CXX object src/integration_tests/CMakeFiles/integration_tests_runner.dir/mission_change_speed.cpp.o
[ 89%] Building CXX object src/integration_tests/CMakeFiles/integration_tests_runner.dir/mission.cpp.o
[ 89%] Building CXX object src/integration_tests/CMakeFiles/integration_tests_runner.dir/mission_rtl.cpp.o
[ 90%] Building CXX object src/integration_tests/CMakeFiles/integration_tests_runner.dir/mission_raw_mission_changed.cpp.o
[ 90%] Building CXX object src/integration_tests/CMakeFiles/integration_tests_runner.dir/mission_raw_import_and_fly.cpp.o
[ 91%] Building CXX object src/integration_tests/CMakeFiles/integration_tests_runner.dir/mission_set_current.cpp.o
[ 92%] Linking CXX executable unit_tests_runner
/usr/bin/ld: cannot find -lGTest::gmock
collect2: error: ld returned 1 exit status
gmake[2]: *** [src/unit_tests/CMakeFiles/unit_tests_runner.dir/build.make:453: src/unit_tests/unit_tests_runner] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1070: src/unit_tests/CMakeFiles/unit_tests_runner.dir/all] Error 2
[ 92%] Building CXX object src/integration_tests/CMakeFiles/integration_tests_runner.dir/mission_transition.cpp.o
[ 93%] Building CXX object src/integration_tests/CMakeFiles/integration_tests_runner.dir/mission_takeoff_land.cpp.o
[ 93%] Building CXX object src/integration_tests/CMakeFiles/integration_tests_runner.dir/offboard_acceleration.cpp.o
[ 93%] Building CXX object src/integration_tests/CMakeFiles/integration_tests_runner.dir/offboard_velocity.cpp.o
[ 94%] Building CXX object src/integration_tests/CMakeFiles/integration_tests_runner.dir/offboard_position.cpp.o
[ 94%] Building CXX object src/integration_tests/CMakeFiles/integration_tests_runner.dir/param.cpp.o
[ 95%] Building CXX object src/integration_tests/CMakeFiles/integration_tests_runner.dir/path_checker.cpp.o
[ 95%] Building CXX object src/integration_tests/CMakeFiles/integration_tests_runner.dir/system_connection_async.cpp.o
[ 96%] Building CXX object src/integration_tests/CMakeFiles/integration_tests_runner.dir/system_multi_components.cpp.o
[ 96%] Building CXX object src/integration_tests/CMakeFiles/integration_tests_runner.dir/statustext.cpp.o
[ 97%] Building CXX object src/integration_tests/CMakeFiles/integration_tests_runner.dir/telemetry_async.cpp.o
[ 97%] Building CXX object src/integration_tests/CMakeFiles/integration_tests_runner.dir/telemetry_gps_origin.cpp.o
[ 98%] Building CXX object src/integration_tests/CMakeFiles/integration_tests_runner.dir/telemetry_health.cpp.o
[ 98%] Building CXX object src/integration_tests/CMakeFiles/integration_tests_runner.dir/telemetry_modes.cpp.o
[ 99%] Building CXX object src/integration_tests/CMakeFiles/integration_tests_runner.dir/telemetry_sync.cpp.o
[ 99%] Building CXX object src/integration_tests/CMakeFiles/integration_tests_runner.dir/mavlink_passthrough.cpp.o
[ 99%] Building CXX object src/integration_tests/CMakeFiles/integration_tests_runner.dir/mission_transfer_lossy.cpp.o
[100%] Linking CXX executable integration_tests_runner
/usr/bin/ld: cannot find -lGTest::gmock
collect2: error: ld returned 1 exit status
gmake[2]: *** [src/integration_tests/CMakeFiles/integration_tests_runner.dir/build.make:811: src/integration_tests/integration_tests_runner] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1016: src/integration_tests/CMakeFiles/integration_tests_runner.dir/all] Error 2
gmake: *** [Makefile:149: all] Error 2
I thought we fixed this here: Fix absl CI by JonasVautherin · Pull Request #2350 · mavlink/MAVSDK · GitHub
Also, any reason you don’t just want to install the release?
BlueOs is on 32 bit, so I blindly assumed that the binary wouldnt work.
32bit? probably won’t then, yes.
If you need a quick-fix, just disable all test targets in cmake: integration_tests, system_tests, unit_tests. Then there is a test it will just link.
Thanks for the discussion, its helpful. It caused me to double check my assumption, and as usual I was wrong. The BlueOS image I am using (v1.2.6 here Release 1.2.6 · bluerobotics/BlueOS · GitHub) is clearly aarch64. Sorry for the mixup, I will install the libmavsdk-dev binary and will hopefully be off and running.
1 Like
Turns out that I was wrong when I thought I was wrong. I was actually right, that BlueOS is 32 bit. Their uname -a command is misleading. But evidence from commands like lshw, file, and dpkg shows that it is 32 bit, armhf to be precise.
So I am back to square one, in which I have to fully build mavsdk in order to link the mavsdk/example code as well as build my own proxy in order to interface with the autopilot.
Hi Mike,
I was having this exact same issue. I did two things and I honestly am not sure which one made it work
This is my updated cmake call
cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=OFF -Bbuild/default -H.
And I removed my apt installation of googletest and libgtest-dev