Skip to content

Commit f0ff254

Browse files
authored
Merge pull request ekxide#30 from elBoberido/rmw-iox2-29-fix-ubuntu-22-04-build
[ekxide#29] Fix Ubuntu 22.04 build with GCC 11 and clang 14
2 parents 8e56af1 + c13c6f0 commit f0ff254

File tree

9 files changed

+45
-19
lines changed

9 files changed

+45
-19
lines changed
Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
name: 'Install clang'
2+
inputs:
3+
version:
4+
description: 'The clang version, e.g. 18'
5+
required: false
6+
default: 18
27
runs:
38
using: "composite"
49
steps:
510
- name: Install clang
611
shell: bash
712
run: |
813
sudo wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
9-
sudo add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main"
14+
sudo add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-${{ inputs.version }} main"
1015
sudo apt-get update
11-
sudo apt-get install -y clang-format-18 clang-tidy-18 clang-tools-18 clang-18 lld
16+
sudo apt-get install -y clang-format-${{ inputs.version }} clang-tidy-${{ inputs.version }} clang-tools-${{ inputs.version }} clang-${{ inputs.version }} lld
1217
sudo rm -f /usr/bin/clang
1318
sudo rm -f /usr/bin/clang++
1419
sudo rm -f /usr/bin/clang-tidy
1520
sudo rm -f /usr/bin/clang-format
16-
sudo ln -s /usr/bin/clang-18 /usr/bin/clang
17-
sudo ln -s /usr/bin/clang++-18 /usr/bin/clang++
18-
sudo ln -s /usr/bin/clang-tidy-18 /usr/bin/clang-tidy
19-
sudo ln -s /usr/bin/clang-format-18 /usr/bin/clang-format
21+
sudo ln -s /usr/bin/clang-${{ inputs.version }} /usr/bin/clang
22+
sudo ln -s /usr/bin/clang++-${{ inputs.version }} /usr/bin/clang++
23+
sudo ln -s /usr/bin/clang-tidy-${{ inputs.version }} /usr/bin/clang-tidy
24+
sudo ln -s /usr/bin/clang-format-${{ inputs.version }} /usr/bin/clang-format

.github/actions/install-gcc/action.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
name: 'Install GCC'
2+
inputs:
3+
version:
4+
description: 'The gcc version, e.g. 13'
5+
required: false
6+
default: 13
27
runs:
38
using: "composite"
49
steps:
@@ -9,4 +14,8 @@ runs:
914
apt-get install -y software-properties-common
1015
add-apt-repository -y ppa:ubuntu-toolchain-r/test
1116
apt-get update
12-
apt-get install -y gcc-13 g++-13
17+
apt-get install -y gcc-${{ inputs.version }} g++-${{ inputs.version }}
18+
sudo rm -f /usr/bin/gcc
19+
sudo rm -f /usr/bin/g++
20+
sudo ln -s /usr/bin/gcc-${{ inputs.version }} /usr/bin/gcc
21+
sudo ln -s /usr/bin/g++-${{ inputs.version }} /usr/bin/g++

.github/workflows/build-test.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ jobs:
7676
strategy:
7777
fail-fast: false
7878
matrix:
79+
os: [ubuntu-22.04, ubuntu-24.04]
7980
compiler: [clang, gcc]
8081
include:
8182
- compiler: clang
@@ -84,7 +85,13 @@ jobs:
8485
- compiler: gcc
8586
cc: gcc
8687
cxx: g++
87-
runs-on: ubuntu-latest
88+
- os: ubuntu-22.04
89+
clang-version: 14
90+
gcc-version: 11
91+
- os: ubuntu-24.04
92+
clang-version: 18
93+
gcc-version: 13
94+
runs-on: ${{ matrix.os }}
8895
container:
8996
image: ros:rolling
9097
steps:
@@ -124,18 +131,19 @@ jobs:
124131
# this is also required for all builds as iceoryx2 depends on libclang
125132
- name: Install clang toolchain
126133
uses: ./src/rmw_iceoryx2/.github/actions/install-clang
134+
with:
135+
version: ${{ matrix.clang-version }}
127136

128137
- name: Install gcc toolchain
129138
if: matrix.compiler == 'gcc'
130139
uses: ./src/rmw_iceoryx2/.github/actions/install-gcc
140+
with:
141+
version: ${{ matrix.gcc-version }}
131142

132143
- name: Import iceoryx
133144
run: |
134145
cd $WORKSPACE_DIR
135-
136-
# need to switch to https in ci
137-
sed 's|git@github.com:|https://github.com/|g' src/rmw_iceoryx2/iceoryx.repos > _deps.repos
138-
vcs import src < _deps.repos
146+
vcs import src < src/rmw_iceoryx2/iceoryx.repos
139147
140148
- name: Check compiler versions
141149
run: |
@@ -182,7 +190,7 @@ jobs:
182190
if: always()
183191
uses: actions/upload-artifact@v4
184192
with:
185-
name: test-results-${{ matrix.compiler }}
193+
name: test-results-${{ matrix.os }}-${{ matrix.compiler }}
186194
path: |
187195
${{ env.WORKSPACE_DIR }}/build/*/test_results/*/*.xml
188196
${{ env.WORKSPACE_DIR }}/log/**/test*.log

doc/release-notes/unreleased.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
-->
2222

2323
* Fix failing `gcc` build [#15](https://github.com/ekxide/rmw_iceoryx2/issues/15)
24+
* Fix failing `gcc` and `clang` build on Ubuntu 22.04 [#29](https://github.com/ekxide/rmw_iceoryx2/issues/29)
2425

2526
### Refactoring
2627

rmw_iceoryx2_cxx/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ if(NOT CMAKE_C_STANDARD)
1515
endif()
1616

1717
set(CMAKE_CXX_STANDARD 17)
18+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1819

1920
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
2021
# NOTE: Remove -Wno-unused-parameter after implementation

rmw_iceoryx2_cxx/include/rmw_iceoryx2_cxx/impl/middleware/iceoryx2.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#ifndef RMW_IOX2_MIDDLEWARE_ICEORYX2_HPP_
1111
#define RMW_IOX2_MIDDLEWARE_ICEORYX2_HPP_
1212

13+
#include "iox/type_traits.hpp"
1314
#include "iox2/listener.hpp"
1415
#include "iox2/node.hpp"
1516
#include "iox2/notifier.hpp"
@@ -157,7 +158,7 @@ auto Iceoryx2::service_builder(const std::string& service_name) -> ::iox2::Servi
157158
} else if constexpr (S == ::iox2::ServiceType::Ipc) {
158159
return ipc().service_builder(name.value());
159160
} else {
160-
static_assert(std::false_type::value, "Attempted to build a service of unknown type");
161+
static_assert(iox::always_false_v<decltype(S)>, "Attempted to build a service of unknown type");
161162
}
162163
}
163164

rmw_iceoryx2_cxx/include/rmw_iceoryx2_cxx/impl/runtime/publisher.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class RMW_PUBLIC Publisher
5151
using IceoryxNotifier = Iceoryx2::InterProcess::Notifier;
5252
using IceoryxPublisher = Iceoryx2::InterProcess::Publisher<Payload>;
5353
using IceoryxSample = Iceoryx2::InterProcess::SampleMutUninit<Payload>;
54-
using SampleRegistry = SampleRegistry<IceoryxSample>;
54+
using IceoryxSampleRegistry = SampleRegistry<IceoryxSample>;
5555

5656
public:
5757
/// @brief Constructor for PublisherImpl
@@ -116,7 +116,7 @@ class RMW_PUBLIC Publisher
116116
iox::optional<IdType> m_iox_unique_id;
117117
iox::optional<IceoryxNotifier> m_iox2_notifier;
118118
iox::optional<IceoryxPublisher> m_iox2_publisher;
119-
SampleRegistry m_registry;
119+
IceoryxSampleRegistry m_registry;
120120
};
121121

122122
} // namespace rmw::iox2

rmw_iceoryx2_cxx/include/rmw_iceoryx2_cxx/impl/runtime/subscriber.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class RMW_PUBLIC Subscriber
5353
using IdType = ::iox2::UniqueSubscriberId;
5454
using IceoryxSubscriber = Iceoryx2::InterProcess::Subscriber<Payload>;
5555
using IceoryxSample = Iceoryx2::InterProcess::Sample<Payload>;
56-
using SampleRegistry = SampleRegistry<IceoryxSample>;
56+
using IceoryxSampleRegistry = SampleRegistry<IceoryxSample>;
5757

5858
public:
5959
/// @brief Constructor for SubscriberImpl
@@ -105,7 +105,7 @@ class RMW_PUBLIC Subscriber
105105

106106
iox::optional<IdType> m_iox2_unique_id;
107107
iox::optional<IceoryxSubscriber> m_iox2_subscriber;
108-
SampleRegistry m_registry;
108+
IceoryxSampleRegistry m_registry;
109109
};
110110

111111
} // namespace rmw::iox2

rmw_iceoryx2_cxx/include/rmw_iceoryx2_cxx/impl/runtime/waitset.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "iox/duration.hpp"
1414
#include "iox/optional.hpp"
15+
#include "iox/type_traits.hpp"
1516
#include "rmw/visibility_control.h"
1617
#include "rmw_iceoryx2_cxx/impl/common/creation_lock.hpp"
1718
#include "rmw_iceoryx2_cxx/impl/common/error.hpp"
@@ -68,7 +69,7 @@ class RMW_PUBLIC WaitSet
6869
} else if constexpr (std::is_same_v<ListenerType, SubscriberListener>) {
6970
return Iceoryx2::ServiceType::Ipc;
7071
} else {
71-
static_assert(std::false_type::value, "Unsupported listener type");
72+
static_assert(iox::always_false_v<ListenerType>, "Unsupported listener type");
7273
}
7374
}();
7475

0 commit comments

Comments
 (0)