Skip to content

Make GoogleTest version compatible with C++11 / resolve errors running C++11 test on Ubuntu 24.04 - #1260

Open
garcia556 wants to merge 1 commit into
ArduPilot:masterfrom
garcia556:make-gtest-portable-to-support-cpp11
Open

Make GoogleTest version compatible with C++11 / resolve errors running C++11 test on Ubuntu 24.04#1260
garcia556 wants to merge 1 commit into
ArduPilot:masterfrom
garcia556:make-gtest-portable-to-support-cpp11

Conversation

@garcia556

Copy link
Copy Markdown

Problem Statement

While running test suites of generated C++11 code on recent OS versions of Ubuntu 24 or MacOS they fail with error like "googletest library requires at least C++14 standard".

I could not find any relevant issue so decided to go staright with the PR to fix that.

Root Cause

It does not fail in CI because Ubuntu 22.04 runners are used:
.github/workflows/test.yml line 12

runs-on: ubuntu-22.04

GoogleTest library is installed as libgtest-dev APT package:
.github/workflows/test.yml line 31

sudo apt install -y libgtest-dev g++ tshark

Its Ubuntu 22.04 version is 1.11.0 and it supports C++11 standard.

Latest GoogleTest version to support C++11 is 1.12.1.

This will be the last release to support C++11. Future releases will require at least C++14.

However running the same on Ubuntu 24.04 installs GoogleTest version 1.14.0 which explicitly requires C++14.
Same is happening on MacOS, brew googletest version is 1.18.0.

Solution Design

C++ standard change seems too radical to me so I would suggest to decouple GoogleTest version from environment and download its sources (v1.12.1) during test suites runs.
This solution also works for MacOS (causing other issues with ARM compability but that's another topic).

The change also opens path to update CI runners to Ubuntu 24.04 (or even 26.04) as eventually 22.04 will reach EOL.

Testing

Tested on clean Ubuntu 24.04 VM without libgtest-dev installed:

sudo apt install --yes build-essential
git clone https://github.com/ArduPilot/mavlink.git
ln -sf ./mavlink/message_definitions message_definitions
git clone https://github.com/garcia556/pymavlink.git
cd pymavlink
git switch make-gtest-portable-to-support-cpp11
git pull
./test_generator.sh

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.

1 participant