目次
Installation on Ubuntu MATE 22.04.02 LTS
環境
- 本体: ThinkCenter M70q
- CPU: Intel(R) Core(TM) i5-10400T CPU @ 2.00GHz
- メモリ: 32 GB
- OS: Ubuntu MATE 22.04.02 LTS
OS の準備
- アカウント名は nestdaq にする。
- 以下のコマンドで作った。
$ sudo adduser nestdaq ... <Input information >... $ sudo usermod -aG sudo nestdaq
nestdaq アカウントも sudo できるようにしておく(NestDAQ を動かすには root 権限はいらなかったと思うが、ネットワークの設定を見たりするときに必要)。
- その後、nestdaq でログインし直し。
- Emacs インストール(もともと入っていた)。
$ sudo apt install emacs
- RedisTimeSeries をmake する際、python3 が必要になる。自身の環境にはもともと入っていた。
- Boost をインストールする前に FileSink で使用する zstd と libzstd-devを入れておく。さらに python3-dev を入れておきたいところだが、すでに入っていた。
$ sudo apt install zstd libzstd-dev
- ZeroMQ を build する際、cmake が必要なので cmake をインストール(もともと入っていた)
$ sudo apt install cmake $ cmake --version cmake version ?.??.? ...
- FairMQデバイスを複数立ち上げるため、tmux をインストールしておくとよい。
$ sudo apt install tmux
インストール
- 2023年10月1日(月)現在、NestDAQのインストール方法に関するドキュメントはいくつかある。本家の GitHub のリポジトリの以下のインストール方法が公式と思われるが、CMAKE_PREFIX_PATHの指定が不要なところもあり、新しめのインストール方法のメモを見るのが良さそう。
- 新しいインストール方法のメモとしては、e50server01 のインストールログを見るのが良い。
- このページは、Raspberry Pi OS のインストールのページ(Installation on Raspberry Pi 4)をベースにした。Raspberry Pi OS は Debian 系の OS のため、Ubuntu と近い環境である。
- SELinux は大抵問題を引き起こすので、切っておく。VNCServer などで問題が起きる。Ubuntu ではデフォルトで切れているようだ?
- さらに、一般に、DAQの開発段階ではfirewall は切っておく。デフォルトでは切れているようだ?以下のように ufw をインストールして disable しても良いかもしれないが、そもそも ufw をインストールしなければ、firewall は有効にならないかも。
$ sudo apt install ufw $ sudo ufw disable
参考: Step-by-Step Guide: Configuring a Firewall on Raspberry Pi https://raspberrytips.com/configure-firewall-raspberry-pi/
redis のインストール
- git でソースをダウンロードしてコンパイル
$ mkdir -p /home/nestdaq/nestdaq/src $ cd /home/nestdaq/nestdaq/src $ git clone https://github.com/redis/redis.git $ cd redis $ git checkout -b 6.0.16 6.0.16 $ time make -j10 PREFIX=$HOME/nestdaq real 0m22.050s user 1m41.892s sys 0m6.858s $ make PREFIX=$HOME/nestdaq install
- 設定ファイルを $HOME/nestdaq/etc にコピー
$ mkdir $HOME/nestdaq/etc $ cp $HOME/nestdaq/src/redis/redis.conf $HOME/nestdaq/etc/
- daemon mode をオンにする。
$ emacs -nw $HOME/nestdaq/etc/redis.conf #daemonize no daemonize yes
RedisTimeSeries をインストール
$ cd $HOME/nestdaq/src $ git clone --recursive https://github.com/RedisTimeSeries/RedisTimeSeries.git $ cd RedisTimeSeries $ git checkout -b v1.4.9 v1.4.9 $ time make ... real 0m2.577s user 0m4.461s sys 0m0.410s $ mkdir $HOME/nestdaq/lib $ cp $HOME/nestdaq/src/RedisTimeSeries/bin/linux-x64-release/redistimeseries.so $HOME/nestdaq/lib/
- time make -j2 とすると、エラーとなる。
$ time make -j2 make[1]: warning: -j0 forced in submake: resetting jobserver mode. Submodule path 'deps/RedisModulesSDK': checked out 'c0740b8209abae38775adc6f3fefe05a520be55b' Submodule path 'deps/readies': checked out '32e37e68f6ffa66f5a6e41cb37794147e84c38cb' ../deps/readies/mk/main:67: /home/nestdaq/nestdaq/src/RedisTimeSeries/deps/readies/mk/cfg: No such file or directory make[1]: *** No rule to make target '/home/nestdaq/nestdaq/src/RedisTimeSeries/deps/readies/mk/cfg'. Stop. make: *** [Makefile:31: build] Error 2
Boot をインストール
- Boost をダウンロードしてきてmake
$ cd $HOME/nestdaq/src $ git clone https://github.com/boostorg/boost.git $ cd boost $ git checkout -b boost-1.80.0 boost-1.80.0 $ time git submodule update --init --recursive ... real 3m42.531s user 1m53.620s sys 0m15.122s $ time ./bootstrap.sh ... real 0m16.048s user 0m14.757s sys 0m1.247s $ time ./b2 install \ link=static,shared \ threading=single,multi \ cxxstd=17 \ variant=release,debug \ --layout=tagged \ -j10 \ --prefix=$HOME/nestdaq ... ...updated 20451 targets... real 10m38.834s user 64m47.405s sys 4m7.307s
ZeroMQをインストール
- ZeroMQ を持ってきてコンパイル
$ cd $HOME/nestdaq/src $ git clone https://github.com/zeromq/libzmq.git $ cd libzmq $ mkdir build $ cmake \ -DCMAKE_INSTALL_PREFIX=$HOME/nestdaq \ -DCMAKE_CXX_STANDARD=17 \ -B ./build \ -S . $ cd build $ time make -j10 ... real 0m17.104s user 2m27.583s sys 0m15.862s $ make install
fmtlib をインストール
$ cd $HOME/nestdaq/src $ git clone https://github.com/fmtlib/fmt.git $ cd fmt $ mkdir build $ cmake \ -DCMAKE_INSTALL_PREFIX=$HOME/nestdaq \ -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \ -DCMAKE_CXX_STANDARD=17 \ -B build \ -S . $ cd build $ time make -j10 ... real 0m58.847s user 5m26.186s sys 0m8.569s $ make install
FairLogger をインストール
$ cd $HOME/nestdaq/src $ git clone https://github.com/FairRootGroup/FairLogger.git $ cd FairLogger $ mkdir build $ cmake \ -DCMAKE_INSTALL_PREFIX=$HOME/nestdaq \ -DCMAKE_CXX_STANDARD=17 \ -DUSE_EXTERNAL_FMT=OFF \ -B build \ -S . $ cd build $ time make -j10 ... real 0m16.190s user 0m49.333s sys 0m1.913s $ make install
FairMQ をインストール (v1.4.55)
$ cd $HOME/nestdaq/src $ git clone https://github.com/FairRootGroup/FairMQ.git $ cd FairMQ $ git checkout -b v1.4.55 v1.4.55 $ mkdir build $ cmake \ -DCMAKE_INSTALL_PREFIX=$HOME/nestdaq \ -DCMAKE_CXX_STANDARD=17 \ -DCMAKE_PREFIX_PATH="$HOME/nestdaq" \ -B build \ -S . $ cd build $ time make -j10 ... real 1m53.872s user 11m53.531s sys 0m30.784s $ make install
hiredis のインストール (v1.1.0)
$ cd $HOME/nestdaq/src $ git clone https://github.com/redis/hiredis.git $ cd hiredis $ time make PREFIX=$HOME/nestdaq install ... real 0m1.641s user 0m1.568s sys 0m0.063s
redis-plus-plus のインストール (1.3.6)
$ cd $HOME/nestdaq/src $ git clone https://github.com/sewenew/redis-plus-plus.git $ cd redis-plus-plus $ mkdir build $ cmake \ -DCMAKE_INSTALL_PREFIX=$HOME/nestdaq \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_PREFIX_PATH=$HOME/nestdaq \ -DREDIS_PLUS_PLUS_CXX_STANDARD=17 \ -DREDIS_PLUS_PLUS_BUILD_TEST=OFF \ -B ./build \ -S . $ cd build $ time make -j10 install ... real 0m7.923s user 1m0.113s sys 0m2.943s
nestdaq のインストール
$ cd $HOME/nestdaq/src $ git clone https://github.com/spadi-alliance/nestdaq.git $ cd nestdaq $ mkdir build $ cmake \ -DCMAKE_INSTALL_PREFIX=$HOME/nestdaq \ -DCMAKE_PREFIX_PATH=$HOME/nestdaq \ -B ./build \ -S . $ cd build $ time make -j10 install ... real 0m23.572s user 2m28.622s sys 0m7.740s
redisinsight のインストール
$ cd $HOME/nestdaq/bin $ wget https://downloads.redisinsight.redislabs.com/latest/redisinsight-linux64 $ chmod +x redisinsight-linux64 $ ./redisinsight-linux64 <なにも表示されなければOK。Ctrl-Cで殺す。殺したときはいろいろ言われる。> $
スクリプトなどの設定
- run ディレクトリ作成
$ mkdir $HOME/run
- 初期設定ファイル nestdaq.sh を /home/nestdaq/run に作成
$ cd $HOME/run $ emacs nestdaq.sh
中身は以下。
#!/bin/bash export NESTDAQ=$HOME/nestdaq export PATH=$NESTDAQ/bin:$PATH
さらに、$HOME/.bashrc に以下の行を追記。
# For NestDAQ 2023.10.02 source $HOME/run/nestdaq.sh
- redis の立ち上げのためのファイル作成
$ cd $HOME/run $ emacs init.sh
中身は以下。
#!/bin/bash redis-server $NESTDAQ/etc/redis.conf --loadmodule $NESTDAQ/lib/redistimeseries.so #RIHOST=0.0.0.0 redisinsight-linux64 & #daq-webctl >& $NESTDAQ/log/daq-webctl.log & daq-webctl >& /dev/null &
さらに、実行権限を付与
$ chmod +x ./init.sh
- NestDAQ起動のためのスクリプトをコピー
$ cd $HOME/run $ cp $HOME/nestdaq/scripts/*.sh ./
動かしてみる
- run ディレクトリに移動
cd $HOME/run
- .bashrcをソースし、init.sh を実行する。
$ source $HOME/.bashrc $ ./init.sh
もし間違って ./init.sh を複数回実行した場合、redis と daq-webctl のプロセスを殺す。プロセスの殺し方は色々あるが、
$ killall redis-server $ killall daq-webctl
とすれば、全部殺せる。このようなスクリプトを用意しておいても良いかも。または、init.sh を編集し、すでにプロセスが立ち上がっていたら新たに立ち上げないとか、既存のプロセスを殺してから立ち上げるとか、賢い感じに編集しても良い。
- これで Firefox などのブラウザを立ち上げ、http://localhost:8080/にアクセス
- web ブラウザ上で、 任意の Run Number を入力。初回起動時は最新のランナンバーがないと言われるが、それが正しい。
- tmux を立ち上げ、ウィンドウを分割。Ctl-b “ で上下方向分割、Ctl-b % で左右方向分割。ウィンドウ間の移動は Ctl-b o。emacs のショートカットに近いものに設定しても良い。
- tmux 上で 3 分割くらいにして、以下のスクリプトを実行。
--------------------------------------- $ ./topology-1-1.sh ... --------------------------------------- $ ./start_device.sh Sampler ... --------------------------------------- $ ./start_device.sh Sink ... ---------------------------------------
- この状態で、DAQ Controller から、Initialize, Reset Task, Run とボタンを押すと、DAQがスタートする。
- tmux の端末では、メッセージが流れているはず。データが流れていれば、In や Out のデータ転送レートが 0 以外になる。
- DAQをストップする場合は、 Stop ボタンを押す。
nestdaq-user-impl のインストール
- まず、比較的新しい ROOT をインストールする必要があった。バイナリからをインストールするには、以下の手順をふむ。
- 手元のパソコンに root_v6.28.06.Linux-centos8-x86_64-gcc8.5.tar.gz をダウンロード。
$ $ wget https://root.cern/download/root_v6.28.06.Linux-centos8-x86_64-gcc8.5.tar.gz
- ファイルを /home/kobayash/local/root_v ディレクトリにダウンロードして解凍。
$ mkdir $HOME/local $ cd $HOME/local $ wget https://root.cern/download/root_v6.28.06.Linux-centos8-x86_64-gcc8.5.tar.gz $ tar zxvf root_v6.28.06.Linux-ubuntu22-x86_64-gcc11.4.tar.gz
- $HOME/.bashrc を編集し、ROOTの設定を行う。
# For root 2023.10.02 source $HOME/local/root/bin/thisroot.sh
- 試しにroot を実行。
$ source $HOME/.bashrc $ root root ------------------------------------------------------------------ | Welcome to ROOT 6.28/06 https://root.cern | | ... | ------------------------------------------------------------------ root [0] TF1 * f = new TF1("f","sin(x)",0,10) (TF1 *) 0x55bf8ff68140 root [1] f->Draw() Info in <TCanvas::MakeDefCanvas>: created default TCanvas with name c1 <sin カーブが書かれる。> root [2] .q
- nestdaq-user-impl をコンパイル。
$ cd $HOME/nestdaq/src $ git clone https://github.com/spadi-alliance/nestdaq-user-impl.git $ cd nestdaq-user-impl $ mkdir build $ cmake \ -DCMAKE_INSTALL_PREFIX=$HOME/nestdaq \ -DCMAKE_PREFIX_PATH=$HOME/nestdaq \ -B ./build \ -S . $ cd build $ time make -j10 install ...
ただし、これをすると /home/nestdaq/nestdaq/bin 内の nestdaq のインストール時に作られた実行形式ファイル Sampler や Sink が上書きされる。nestdaq の 実行形式ファイルと nestdaq-user-impl の実行形式ファイルを別々に扱うには、インストール場所を変えるなどの対策が必要 (-DCMAKE_INSTALL_PREFIX を変えるとか)。
nestdaq-user-impl (TFBFilePlayer - fltcoin - tfdump) の実行
- 五十嵐さんの以下のドキュメントを参考に、Data Replayer を動かしてみる。
$ cd $HOME/run $ wget http://www-online.kek.jp/~igarashi/nestdaq/run000408_00_stf.dat.gz $ wget http://www-online.kek.jp/~igarashi/nestdaq/run000410.dat.gz $ wget http://www-online.kek.jp/~igarashi/nestdaq/topo_player.sh $ gunzip run000408_00_stf.dat.gz $ gunzip run000410.dat.gz $ ls ... run000408_00_stf.dat run000410.dat ...
- redis-server と daq-webctl が立ち上がっているか ps コマンドで確認。立ち上がっていなかったら、init.sh を実行。
$ ps aux | grep redis $ ps aux | grep daq-webctl $ ./init.sh
- 五十嵐さんの topo_player.sh を実行。
$ chmod +x topo_plauer.sh $ ./topo_player.sh
- /hoem/nestdaq/run ディレクトリで tmux を立ち上げ、4分割 (Ctrl-b % と Ctrl-b ” を使う。パネル移動は Ctrl-b o。)し、FairMQ デバイスを立ち上げる。
<パネル 1> $ ./start_device.sh TFBFilePlayer --in-file run000410.dat <パネル 2> $ ./start_device.sh fltcoin <パネル 3> $ ./start_device.sh tfdump
- web ブラウザを立ち上げ、 http://localhost:8080 にアクセスしする。
- RUN number の New value: に任意の数字を入力し、 [ Send ] ボタンを押す。
- [Init Device and Connection] > [ Init Task ] > [ Run ] ボタンを順次押すと、実行される。
- DAQ のストップは [ Stop ] ボタンを押す。DAQ を終了する場合は、さらに [ Reset Task ], [ Reset Device ] を押す。
- FairMQデバイスも終了する場合は [ End ] ボタンを押す。
nestdaq-user-impl (STFBplayer - FileSink/Scaler) の実行
- まず、topology_stbplayer_scr.sh を作成。
#!/bin/bash #host=127.0.0.1 #port=6379 #db=0 server=redis://127.0.0.1:6379/0 #function config_endpoint () { function endpoint () { # Usage: # config_endpoint "service" "channel" "parameters" echo redis-cli -u $server hset daq_service:topology:endpoint:$1:$2 ${@:3} $NESTDAQ/bin/redis-cli -u $server hset daq_service:topology:endpoint:$1:$2 ${@:3} } #function config_link () { function link () { # config_link "service1" "channel" "service2" "channel" "parameters" echo redis-cli -u $server set daq_service:topology:link:$1:$2,$3:$4 non $NESTDAQ/bin/redis-cli -u $server set daq_service:topology:link:$1:$2,$3:$4 none } echo "---------------------------------------------------------------------" echo " config endpoint (socket)" echo "---------------------------------------------------------------------" #--------------------------------------------------------------------------- # service channel options #--------------------------------------------------------------------------- endpoint STFBFilePlayer out type push method connect endpoint STFBFilePlayer dqm type push method connect endpoint Scaler in type pull method bind endpoint Scaler out type push method connect endpoint FileSink in type pull method bind endpoint ScrSink in type pull method bind echo "---------------------------------------------------------------------" echo " config link" echo "---------------------------------------------------------------------" #--------------------------------------------------------------------------- # service1 channel1 service2 channel2 #--------------------------------------------------------------------------- link STFBFilePlayer out FileSink in link STFBFilePlayer dqm Scaler in link Scaler out ScrSink in
- mq_param_stbplayer_scr.sh を作成。
#!/bin/bash server=redis://127.0.0.1:6379/2 function param () { # "instance":"field" "value" #echo redis-cli -u $server set parameters:$1:$2 ${@:3} #redis-cli -u $server set parameters:$1:$2 ${@:3} echo redis-cli -u $server hset parameters:$1 ${@:2} redis-cli -u $server hset parameters:$1 ${@:2} } #============================================================================== # isntance-id field value field value field value param FileSink-0 multipart true openmode create prefix data ext .dat param ScrSink-0 multipart true openmode create prefix scrdata ext .dat param Scaler-0 num-source 1 prefix scr ext .dat
- start_device.sh を編集し、以下のように、DQM_URI を追加。
#!/bin/bash #MY_TERM=xterm DAQSERVICE_URI=' --registry-uri tcp://127.0.0.1:6379/0' METRICS_URI=' --metrics-uri tcp://127.0.0.1:6379/1' CONFIG_URI=' --parameter-config-uri tcp://127.0.0.1:6379/2' DQM_URI=' --dqm-uri tcp://127.0.0.1:6379/3' #--------------------------------------------------------- if [[ $1 =~ fairmq- ]]; then BINDIR="" else BINDIR=/home/nestdaq/nestdaq/bin fi PLUGIN_LIBDIR=/home/nestdaq/nestdaq/lib PLUGIN_SEARCH_PATH=" -S '<$PLUGIN_LIBDIR'" DAQSERVICE_PLUGIN=" -P daq_service" METRICS_PLUGIN=" -P metrics" CONFIG_PLUGIN=" -P parameter_config" echo "BINDIR = $BINDIR" echo "PLUGIN_LIBDIR = $PLUGIN_LIBDIR" echo "PLUGIN_SEARCH_PATH = $PLUGIN_SEARCH_PATH" echo "DAQSERVICE_PLUGIN = $DAQSERVICE_PLUGIN" echo "METRICS_PLUGIN = $METRICS_PLUGIN" echo "CONFIG_PLUGIN = $CONFIG_PLUGIN" echo "DAQSERVICE_URI = $DAQSERVICE_URI" echo "METRICS_URI = $METRICS_URI" echo "CONFIG_URI = $CONFIG_URI" echo "DQM_URI = $DQM_URI" #============================================================================== function run_device () { local var; var+=$PLUGIN_SEARCH_PATH var+=$DAQSERVICE_PLUGIN var+=$METRICS_PLUGIN var+=$CONFIG_PLUGIN var+=$DAQSERVICE_URI var+=$METRICS_URI var+=$CONFIG_URI var+=$DQM_URI var+=" --severity debug4" if [ -n "$MY_TERM" ]; then #echo \ $MY_TERM -title $1 -e "$BINDIR/$@ $var" else #echo \ eval "$BINDIR/$@ $var" fi } run_device $@
さらに、start_device.sh をコピーし、start_device_scr.sh をつくり、function run_device () の中のvar に var+=“–service-name ScrSink” という行を追加。(2024/1/19 start_device.sh 実行時に –service-name ScrSink オプションをつければ良いことがわかったので、この作業削除。)- topology_stbplayer_scr.sh, mq_param_stbplayer_scr.sh を実行。
$ chmod +x topology_stbplayer_scr.sh $ chmod +x mq_param_stbplayer_scr.sh $ chmod +x start_device_scr.sh $ ./topology_stbplayer_scr.sh $ ./mq_param_stbplayer_scr.sh
- ファイルを保存する場所を作成。
$ mkdir scr scrdata data
- /hoemnestdaq/run ディレクトリで tmux を立ち上げ、4分割 (Ctrl-b % と Ctrl-b “ を使う。パネル移動は Ctrl-b o。)し、FairMQ デバイスを立ち上げる。
<パネル 1> $ ./start_device.sh STFBFilePlayer --wait 1000 --in-file run000408_00_stf.dat <パネル 2> $ ./start_device.sh Scaler <パネル 3> $ ./start_device.sh FileSink --service-name ScrSink <パネル 4> $ ./start_device.sh FileSink
ちなみに、STFBFilePlayer –wait 1000 は 1000 ms wait している。wait がないと一瞬でファイルを読んでしまう。ただし、mq_param.sh で STFBFilePlayer-0 に wait を設定していると、それで上書きされる。実行時のオプションより redis のパラメータの方が優先されるので注意。redis をクリアする必要あり。
- web ブラウザを立ち上げ、 http://localhost:8080 にアクセスしする。
- RUN number の New value: に任意の数字を入力し、 [ Send ] ボタンを押す。
- [Init Device and Connection] > [ Init Task ] > [ Run ] ボタンを順次押すと、実行される。
- DAQ のストップは [ Stop ] ボタンを押す。DAQ を終了する場合は、さらに [ Reset Task ], [ Reset Device ] を押す。
- FairMQデバイスも終了する場合は [ End ] ボタンを押す。
SlowDash のインストール
- SlowDash の20230608 版をダウンロード: https://www.rcnp.osaka-u.ac.jp/mattermost/spadi-alliance/pl/e57nuxyswpg8irahb1fh5mz9ca
- ダウンロードした SlowDash-230608.tgz を /home/nestdaq/nestdaq/src/ にコピーし、解凍。
$ cp $HOME/Downloads/SlowDash-230608.tgz $HOME/nestdaq/src/ $ cd $HOME/nestdaq/src $ tar zxvf SlowDash-230608.tgz
- SlowDash-230608/system ディレクトリに行き、make する。
$ cd $HOME/nestdaq/src/SlowDash-230608/system/ $ make
- 毎回 source コマンドを実行するのは面倒なので、PATH を .bashrc で設定する。以下の行を /home/nestdaq/.bashrc に追記。
# For SlowDash 2023.10.02 export PATH=${PATH}:${HOME}/nestdaq/src/SlowDash-230608/bin
SlowDash で Scalerから Redis に投げたヒストグラムなどを表示する
- SlowDash の Project 用のディレクトリを作成
$ mkdir $HOME/nestdaq/src/SlowDash-230608/Projects/Test_Redis_Histo $ cd $HOME/nestdaq/src/SlowDash-230608/Projects/Test_Redis_Histo
- SlowDash の SlowdashProject.yaml ファイルを作成
slowdash_project: name: RedisTest title: Redis Test, Simple version data_source: type: Redis parameters: url: redis://localhost:6379/ time_series: {db: 1} object: { db: 3 }
- ここに移動し、試しに起動。ただ、起動前に python3 のredis パッケージが必要だった。
$ pip3 install redis $ slowdash --port=18881
- web ブラウザで http://localhost:18881 にアクセス。
メモ
- Raspberry Pi で FairMQ を make するとき、atomic ライブラリのリンクでエラーとなっていたが、Ubuntuではエラーにならない。Raspberry Pi では cmake コマンドのオプションに -DCMAKE_CXX_LINK_FLAGS=”-Wl,–no-as-needed -latomic“としていたが、Ubuntuでは必要なかった。atomic はデフォルトでリンクされるようだ?
- nestdaq-user-impl make 時のエラー。
[ 34%] Linking CXX executable FileSink /usr/bin/ld: CMakeFiles/FileSink.dir/FileSink.cxx.o: warning: relocation against `_ZN5boost9iostreams5bzip210stream_endE' in read-only section `.text._ZN5boost9iostreams16symmetric_filterINS0_6detail21bzip2_compressor_implISaIcEEES4_E5closeINS0_20non_blocking_adapterINS2_16linked_streambufIcSt11char_traitsIcEEEEEEEvRT_St13_Ios_Openmode[_ZN5boost9iostreams16symmetric_filterINS0_6detail21bzip2_compressor_implISaIcEEES4_E5closeINS0_20non_blocking_adapterINS2_16linked_streambufIcSt11char_traitsIcEEEEEEEvRT_St13_Ios_Openmode]' /usr/bin/ld: CMakeFiles/FileSink.dir/FileSink.cxx.o: in function `boost::detail::sp_counted_impl_p<boost::iostreams::symmetric_filter<boost::iostreams::detail::bzip2_compressor_impl<std::allocator<char> >, std::allocator<char> >::impl>::dispose()': FileSink.cxx: ... /usr/bin/ld: CMakeFiles/FileSink.dir/FileSink.cxx.o: in function `void boost::iostreams::detail::close_all<boost::iostreams::basic_bzip2_compressor<std::allocator<char> >, boost::iostreams::detail::linked_streambuf<char, std::char_traits<char> > >(boost::iostreams::basic_bzip2_compressor<std::allocator<char> >&, boost::iostreams::detail::linked_streambuf<char, std::char_traits<char> >&)': FileSink.cxx:(.text._ZN5boost9iostreams6detail9close_allINS0_22basic_bzip2_compressorISaIcEEENS1_16linked_streambufIcSt11char_traitsIcEEEEEvRT_RT0_[_ZN5boost9iostreams6detail9close_allINS0_22basic_bzip2_compressorISaIcEEENS1_16linked_streambufIcSt11char_traitsIcEEEEEvRT_RT0_]+0x49): undefined reference to `boost::iostreams::detail::bzip2_base::end(bool)' /usr/bin/ld: CMakeFiles/FileSink.dir/FileSink.cxx.o: in function `nestdaq::Compressor::CreateFilter(nestdaq::Compressor::Format, int)': FileSink.cxx:(.text._ZN7nestdaq10Compressor12CreateFilterENS0_6FormatEi[_ZN7nestdaq10Compressor12CreateFilterENS0_6FormatEi]+0x692): undefined reference to `boost::iostreams::detail::bzip2_base::bzip2_base(boost::iostreams::bzip2_params const&)' /usr/bin/ld: FileSink.cxx:(.text._ZN7nestdaq10Compressor12CreateFilterENS0_6FormatEi[_ZN7nestdaq10Compressor12CreateFilterENS0_6FormatEi]+0xaa2): undefined reference to `boost::iostreams::detail::bzip2_base::end(bool, std::nothrow_t)' /usr/bin/ld: FileSink.cxx:(.text._ZN7nestdaq10Compressor12CreateFilterENS0_6FormatEi[_ZN7nestdaq10Compressor12CreateFilterENS0_6FormatEi]+0xaaa): undefined reference to `boost::iostreams::detail::bzip2_base::~bzip2_base()' /usr/bin/ld: FileSink.cxx:(.text._ZN7nestdaq10Compressor12CreateFilterENS0_6FormatEi[_ZN7nestdaq10Compressor12CreateFilterENS0_6FormatEi]+0xaec): undefined reference to `boost::iostreams::detail::bzip2_base::end(bool, std::nothrow_t)' /usr/bin/ld: FileSink.cxx:(.text._ZN7nestdaq10Compressor12CreateFilterENS0_6FormatEi[_ZN7nestdaq10Compressor12CreateFilterENS0_6FormatEi]+0xaf4): undefined reference to `boost::iostreams::detail::bzip2_base::~bzip2_base()' /usr/bin/ld: warning: creating DT_TEXTREL in a PIE collect2: error: ld returned 1 exit status make[2]: *** [CMakeFiles/FileSink.dir/build.make:131: FileSink] Error 1 make[1]: *** [CMakeFiles/Makefile2:205: CMakeFiles/FileSink.dir/all] Error 2 make: *** [Makefile:136: all] Error 2
boot のコンパイル時に bzip2 が no になっていたのが原因のようだ。
- zlib : yes (cached) [5] - bzip2 : no (cached) [5] - lzma : no (cached) [5] - zstd : yes (cached) [5] - lzma : no (cached) [5] - has_lzma_cputhreads builds : no (cached) [9]
sudo apt install libbz2-dev としてから、/home/nestdaq/nestdaq/src/boost ディレクトリを全部削除してから、コンパイルし直した。そうしないと、bzip2 : yes (cached) [5] とならない(他に良い方法あるんだろうか?)。boost をコンパイルし直したあと、ZeroMQ, fmtlib, FairLogger, FairMQ, hiredis, redis-plus-plus, nestdaq, redisinsight を make し直す必要はないようだ。
- ./stat_device.sh Scaler 時のエラー。
nestdaq@a04:~/run$ ./start_device.sh Scaler │ BINDIR = /home/nestdaq/nestdaq/bin │ PLUGIN_LIBDIR = /home/nestdaq/nestdaq/lib │ PLUGIN_SEARCH_PATH = -S '</home/nestdaq/nestdaq/lib' │ DAQSERVICE_PLUGIN = -P daq_service │ METRICS_PLUGIN = -P metrics │ CONFIG_PLUGIN = -P parameter_config │ DAQSERVICE_URI = --registry-uri tcp://127.0.0.1:6379/0 │ METRICS_URI = --metrics-uri tcp://127.0.0.1:6379/1 │ CONFIG_URI = --parameter-config-uri tcp://127.0.0.1:6379/2 │ DQM_URI = --dqm-uri tcp://127.0.0.1:6379/3 │ /home/nestdaq/nestdaq/bin/Scaler: symbol lookup error: /home/nestdaq/nestdaq/bin/Scaler: undefin│ ed symbol: _ZN7UH1Book4FillEd
なんかライブラリのリンクとかを疑ってみたが、ldd $HOME/nestdaq/bin/Scaler ではちゃんとリンクされていた。ただ、objdump -T libuhbook.so とすると、_ZN7UH1Book4FillEdd, _ZN7UH1Book4FillEddd というのはあったが、_ZN7UH1Book4FillEd はなかった。関数がちゃんと読めていないのかと思って、多重定義関数のソースコードの引数などを修正する必要があるかと思ったが、そもそも make install していなかったことに気づいた。前にインストールしたライブラリの関数の名前が残っていてリンクのエラーっぽいエラーメッセージになっていた。はまりやすいところなので注意。