C++20環境においてヘッダーファイルでエラーが発生する問題の修正#1222
Merged
Merged
Conversation
n-kawauchi
approved these changes
May 8, 2026
There was a problem hiding this comment.
この修正で、choreonoid-openrtmのビルド時にエラーは発生しないことを確認できました。確認手順は以下の通り。
- PPAリポジトリを利用してChoreonoidをaptでインストール
- CORBAプラグインのビルドとインストール
- choreonoidの依存パッケージをインストールする
https://choreonoid.org/ja/documents/latest/install/build-ubuntu.html#build-ubuntu-install-packages- ビルド環境がUbuntu24.04なので、下記スクリプトを実行
choreonoid-2.3.0/misc/script/install-requisites-ubuntu-24.04.sh
- ビルド環境がUbuntu24.04なので、下記スクリプトを実行
- OpenRTMをソースからインストール
- (1) 修正前動作確認として最新masterソースを使用する手順の抜粋
- インストール先:~/work/master-openrtm_install
$ mkdir -p ~/work/master-openrtm_install $ export OPENRTM_INSTALL_PATH=~/work/master-openrtm_install $ git clone https://github.com/OpenRTM/OpenRTM-aist $ cd OpenRTM-aist/build $ cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$OPENRTM_INSTALL_PATH $ cmake --build . --config Release $ sudo cmake --build . --config Release --target install - (2) 本PRソースを使用する手順の抜粋
- インストール先:~/work/PR1222-openrtm_install
$ mkdir -p ~/work/PR1222-openrtm_install $ export OPENRTM_INSTALL_PATH=~/work/PR1222-openrtm_install $ git clone https://github.com/OpenRTM/OpenRTM-aist $ cd OpenRTM-aist/ $ git fetch origin pull/1222/head:bugs/cdrstreamcopyconst $ git merge bugs/cdrstreamcopyconst $ cd build/ $ cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$OPENRTM_INSTALL_PATH $ cmake --build . --config Release $ sudo cmake --build . --config Release --target install
- (1) 修正前動作確認として最新masterソースを使用する手順の抜粋
- OpenRTMプラグインのビルド(choreonoid-openrtm)
- (1) OpenRTM-aist修正前の最新masterソース使用でエラーになることの確認
$ export OPENRTM_INSTALL_PATH=~/work/master-openrtm_install $ git clone https://github.com/OpenRTM/choreonoid-openrtm $ cd choreonoid-openrtm/build $ cmake .. -DOpenRTM_DIR=$OPENRTM_INSTALL_PATH/lib/cmake/openrtm-2.1/ $ cmake --build . --config Release : [ 10%] Building CXX object src/BodyIoRTC/CMakeFiles/CnoidBodyIoRTC.dir/BodyIoRTC.cpp.o : /home/vagrant/work/master-openrtm_install/include/openrtm-2.1/rtm/CORBA_CdrMemoryStream.h:578:39: error: expected unqualified-id before ‘const’ 578 | CORBA_CdrSerializer<DataType>(const CORBA_CdrSerializer<DataType> &rhs) | ^~~~~ /home/vagrant/work/master-openrtm_install/include/openrtm-2.1/rtm/CORBA_CdrMemoryStream.h:578:39: error: expected ‘)’ before ‘const’ 578 | CORBA_CdrSerializer<DataType>(const CORBA_CdrSerializer<DataType> &rhs) | ~^~~~~ | ) - (2) 本PRソースを使用してエラーが発生しないことの確認
$ export OPENRTM_INSTALL_PATH=~/work/PR1222-openrtm_install $ cd choreonoid-openrtm/build $ cmake .. -DOpenRTM_DIR=$OPENRTM_INSTALL_PATH/lib/cmake/openrtm-2.1/ $ cmake --build . --config Release ビルドOK
- (1) OpenRTM-aist修正前の最新masterソース使用でエラーになることの確認
n-ando
approved these changes
May 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Identify the Bug
Choreonoidはgccでのビルドにおいて、デフォルトの設定でC++20環境でコンパイルする。
Choreonoid-OpenRTMプラグインのビルドにおいてもC++20が設定されるが、OpenRTM-aistの
CORBA_CdrMemoryStream.hでエラーが発生する。Description of the Change
CORBA_CdrSerializerのコピーコンストラクタを修正してC++11、C++20でエラーが出ないことを確認した。
Verification