RefBox のインストール(Ubuntu 14.04 – 2019/06/25版)

基本形はRefBox のインストール(2019/03/11版)ですが,refBox とMPS間の通信がOPCに変わったため,freeopcua のパッケージのインストールが必要となります.

ググってみたところ,https://github.com/FreeOpcUaとのことですので,取ってきましょう.
mbedtls/entropy.h が見つからないエラーに対しては,https://github.com/wolfeidau/mbedtlsを使うのかと思いますが,そっちのreadmeを見ると,ある機器とケーブルつないでって書いているのでちょっと面倒くさそうです.
そこで,回避策として,freeopcuaのCMakeLists.txt の以下の部分をONからOFFに書き換えましょう.

option(SSL_SUPPORT_MBEDTLS "Support rsa-oaep password encryption using mbedtls library " ON)

あと,mps_comm.mk にて mbedtlsのライブラリが指定されていますので,コメントアウトしましょう.

  LDFLAGS_MPS_COMM = $(shell $(PKGCONFIG) --libs $(FREEOPCUA_COMPONENTS)) # -lmbedtls
git clone https://github.com/FreeOpcUa/freeopcua
cd freeopcua
vi CMakeLists.txt
# please change the option for SSL_SUPPORT_MBEDTLS from ON to OFF

ccmake .
# please select [ c ] => [ c ] => [ g ]

cmake .
make
sudo make install

この状態で,新しいRefBox をmake すると,エラーメッセージが大量に出ます.
最初の方が読めないので,ファイルに落としましょう.

make 2> err.txt
head err.txt
/usr/include/c++/4.8/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

とのことですので,-std=c++11 のオプションが必要かと思いきや,c++11ではなくc++14が必要です.
Makefile を変更して,CFLAGS に -std=c++14 を追加します.

ifeq ($(HAVE_MPS_COMM),1)
  CFLAGS  += $(CFLAGS_MPS_COMM) -std=c++14
  LDFLAGS += $(LDFLAGS_MPS_COMM)
  LIBS_all = $(LIBDIR)/libmps_comm.so
else
  WARN_TARGETS += warning_libmps_comm
endif

-std=c++11にすると,‘chrono_literals’ でエラーが出ます.
c++11 ではなく,c++14が必要らしいですが,Ubuntu 14.04 だと対応していません….

Ubuntu 14.04 に GCC 4.9 をインストールするを参考に作業しましょう.

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-4.9

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20

sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20

sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20

sudo rm /usr/bin/cpp
sudo update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-4.8 10
sudo update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-4.9 20

sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
sudo update-alternatives --set cc /usr/bin/gcc

sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
sudo update-alternatives --set c++ /usr/bin/g++

これで,make が通ります.

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

*