LoginSignup
7
3

More than 1 year has passed since last update.

TOPPERSカーネルのコンフィギュレータをHomebrew最新版のBoostでビルドする

Last updated at Posted at 2023-01-28

TOPPERSカーネルをビルドするときに必要なコンフィギュレータ(バージョン1.9.6)をApple Silicon Macでビルドしたときに,つまづいてしまい,@mitsu48さんに助けていただきました.

コンフィギュレータのビルドにはBoostを必要とするのですが,今回私はHomebrewでインストール済みのBoostを使おうとしたところ,Boost 1.67.0 以降ではboost/utility.hppboost::nextboost::priorが含まれておらず,boost/next_prior.hppをインクルードする必要があるというのが原因でした.

他にも,C++11でコンパイルするというオプションをつける必要があります.

というわけで,手順をまとめてみました.

  1. cfg-1.9.6.tar.gz (2023年1月現在最新版)を https://www.toppers.jp/cfg.html からダウンロード
  2. tar xvfz cfg-1.9.6.tar.gz
  3. cd cfg
  4. ./configureの改行コードをCR/LFからLFに変更
    1. ファイルの文字コードがISO-8859-1である点に注意
  5. ./configureの31行目と48行目をconfigurediffのように変更
  6. ./configureを実行
  7. Makefile.configの末尾のOPTIONS=の部分をOPTIONS="-std=c++11"に変更
  8. toppers/cpp.hppの47行目に#include <boost/next_prior.hpp>を追記(toppers/cpp.hppを参考にしてください)
  9. toppers/text.hppの57行目に#include <boost/next_prior.hpp>を追記(toppers/text.hppを参考にしてください)
  10. make -j$(nproc)

これでビルドできると思います.

configure
@@ -28,7 +28,7 @@
 done
 
 # Boost C++ Libraries?Υإå??ե????뤬????ǥ??쥯?ȥ?򥵡???
-for dir in $include_path "/usr/local/include" "/opt/local/include" "/opt/include" "/usr/include" "/mingw/include"
+for dir in $include_path "/usr/local/include" "/opt/local/include" "/opt/include" "/usr/include" "/mingw/include" "`brew --prefix boost`/include"
 do
 	ls $dir/boost* 2> /dev/null > /dev/null
 	if test $? -eq 0
@@ -45,7 +45,7 @@
 done
 
 # Boost C++ Libraries?Υ饤?֥??ե????뤬????ǥ??쥯?ȥ?򥵡???
-for dir in $library_path "/usr/local/lib" "/opt/local/lib" "/opt/lib" "/usr/lib" "/lib" "/mingw/lib"
+for dir in $library_path "/usr/local/lib" "/opt/local/lib" "/opt/lib" "/usr/lib" "/lib" "/mingw/lib" "`brew --prefix boost`/lib"
 do
 	ls $dir/libboost* 2> /dev/null > /dev/null
 	if test $? -eq 0
toppers/cpp.hpp
@@ -44,6 +44,7 @@
 #include "toppers/codeset.hpp"
 #include "toppers/diagnostics.hpp"
 #include <boost/utility.hpp>
+#include <boost/next_prior.hpp>
 #include <boost/filesystem/path.hpp>
 #include <boost/filesystem/operations.hpp>
 #include <boost/filesystem/exception.hpp>
toppers/text.hpp
@@ -54,6 +54,7 @@
 #include "toppers/text_line.hpp"
 #include "toppers/misc.hpp"
 #include <boost/utility.hpp>
+#include <boost/next_prior.hpp>
 #include <boost/iterator/iterator_facade.hpp>
 #include <boost/format.hpp>
7
3
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
3