バックナンバーはこちら。
https://www.simulationroom999.com/blog/model-based-of-minimum-2-backnumber/
はじめに
前回はFMILibraryのビルド準備を始めたところ。
cmakeのオプションがやや複雑ではあった。
実際にcmakeを実行して、コンフィグレーションやビルドを実行。
それで完了するはずだったのだが・・・。
登場人物
博識フクロウのフクさん

イラストACにて公開の「kino_k」さんのイラストを使用しています。
https://www.ac-illust.com/main/profile.php?id=iKciwKA9&area=1
エンジニア歴8年の太郎くん

イラストACにて公開の「しのみ」さんのイラストを使用しています。
https://www.ac-illust.com/main/profile.php?id=uCKphAW2&area=1
cmakeでコンフィグレーション

前回はcmakeのオプションを確認したところまでだったけど、
あとはどうすれば?

FMILibraryのフォルダに移動して、
build-fmiってフォルダを作っておこうか。
さらにそのbuild-fmiへ移動。

移動した。

そこで前回のcmakeのコマンドを実行。
> cmake -DFMILIB_INSTALL_PREFIX=c:\fmilib2 -DFMILIB_FMI_PLATFORM=win64 -G "Visual Studio 15 2017 Win64" <ソースディレクトリ>\FMILibrary-2.0.3\

こんな感じで実行されるはずだ。
C:\FMILibrary-2.0.3\build-fmi>cmake -DFMILIB_INSTALL_PREFIX=c:\fmilib2 -DFMILIB_FMI_PLATFORM=win64 -G "Visual Studio 15 2017 Win64" C:\FMILibrary-2.0.3\
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.19042.
-- The C compiler identification is MSVC 19.16.27043.0
-- The CXX compiler identification is MSVC 19.16.27043.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/WDExpress/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
/* 省略 */
CMakeLists.txt:207 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Generating done
-- Build files have been written to: C:/FMILibrary-2.0.3/build-fmi
FMILibraryのビルド

これでビルド完了?

いんや。
コンフィグレーションが終わったところで、これからがビルド。

また、なんかのコマンドを打てばよいのかな?

そうだね。
以下のコマンドでビルドとインストールが完了するはずだ。
cmake --build . --config MinSizeRel --target install

よし。実行だ。
・・・1分後
ビルドエラー

あれ?!
なんかエラーがでた!!
C:\FMILibrary-2.0.3\ThirdParty\Expat\expat-2.1.0\lib\xmlparse.c(6239): error C2275: 'BLOCK': この型
は演算子として使用できません [C:\FMILibrary-2.0.3\build-fmi\ExpatEx\expat.vcxproj] [C:\FMILibrary-2.0.3\build-fmi\expatex.vcxproj]
C:\FMILibrary-2.0.3\ThirdParty\Expat\expat-2.1.0\lib\xmlparse.c(221): note: 'BLOCK' の宣言を 確認して
ください
C:\FMILibrary-2.0.3\ThirdParty\Expat\expat-2.1.0\lib\xmlparse.c(6239): error C2065: 's': 定義されていな
い識別子です。 [C:\FMILibrary-2.0.3\build-fmi\ExpatEx\expat.vcxproj] [C:\FMILibrary-2.0.3\build-fmi\expatex.vcxproj]
C:\FMILibrary-2.0.3\ThirdParty\Expat\expat-2.1.0\lib\xmlparse.c(6239): error C2109: 配列または、 ポインターで
ない変数に添字が使われました。 [C:\FMILibrary-2.0.3\build-fmi\ExpatEx\expat.vcxproj] [C:\FMILibrary-2.0.3\build-fmi\expatex.vcxproj]
C:\FMILibrary-2.0.3\ThirdParty\Expat\expat-2.1.0\lib\xmlparse.c(6256): error C2275: 'BLOCK': この型
は演算子として使用できません [C:\FMILibrary-2.0.3\build-fmi\ExpatEx\expat.vcxproj] [C:\FMILibrary-2.0.3\build-fmi\expatex.vcxproj]
C:\FMILibrary-2.0.3\ThirdParty\Expat\expat-2.1.0\lib\xmlparse.c(221): note: 'BLOCK' の宣言を 確認して
ください
C:\FMILibrary-2.0.3\ThirdParty\Expat\expat-2.1.0\lib\xmlparse.c(6256): error C2065: 's': 定義されていな
い識別子です。 [C:\FMILibrary-2.0.3\build-fmi\ExpatEx\expat.vcxproj] [C:\FMILibr
ary-2.0.3\build-fmi\expatex.vcxproj]

うーん、どうやら、
xmlparse.cの中のBLOCKとsという構造体とメンバ変数の絡みでエラーが起きたようだが・・・。
これだけだとわからないな・・・。

えーー!!
どうするのーー!!!!

ちょっと次回までに調べておく。
まとめ

まとめだよ。
- cmakeの前回のコマンドを使ってコンフィグレーション開始。
- 問題無く完了。
- そのままcmakeでビルド開始。
- ビルドの途中でエラーが発生。
- xmlparse.cの中でBLOCKとsという構造体とメンバ変数の絡みでエラーが起きたようだが・・・。
- とりあえず、頑張って調べてみる。
バックナンバーはこちら。
コメント