Configuration process for the new host:
- Install make and Cmake
sudo apet-get install make sudo apt-get install cmake
- Install the environment for C++
g++ version should be 7.3 or higher
sudo apt-get install g++ # g++ version should be 7.3 or higher
-
delete CMakeCache.txt included in /build-x86_64 and /build-arm
-
To set up the ZMQ environment, you need to download the installation package for ZeroMQ.
- Here, we provide the installation package for ZMQ, and any version higher than 4.3.4 is suitable:
tar -xzvf libzmq-4.3.4.tar.gz .
- Then enter the directory:
cd libzmq-4.3.4
- Start to install:
./autogen.sh
- Use ‘prefix’ command to specify the installation directory:
./configure --prefix=/path/to/where/you/want --without-libsodium make make install
- If you encounter the following issue, it is a compatibility problem between the ZMQ library version and the system environment. In simple terms, the x86-64 version is only suitable for 64-bit hosts, while what is needed on ARM is cross-compiled library files.
ERROR: skipping incompatible
I apply the solution:
First, check the library linking information to confirm the assumptionreadelf -h libxxx.so
Recompile ZMQ using the cross-compilation tool. The cross-compilation tool I’m using is
/tools/Xilinx/SDK/2018.3/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++Therefore, in step three, modify the configure file as follows:
./configure --host=aarch64-linux CC=/tools/Xilinx/SDK/2018.3/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-gcc CXX=/tools/Xilinx/SDK/2018.3/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++ --prefix=/home/grand/arm_a_installed/ --without-libsodium
"No need to make changes to other steps; the key point is to ensure that the compiler and library versions match. ----20230621
("If you don’t have Xilinx tools, please refer to the ‘Compile grand-daq’ section later in the document) -
**Set up the environment for yaml **
-
Download the YAML installation package, which can be obtained from its official website, the version used is yaml-cpp-yaml-cpp-0.7.0.tar.gz.
-
Unzip the package:
tar -xzvf yaml-cpp-yaml-cpp-0.7.0.tar.gz
- Compile and install
- Enter the unzipped directory.
cd yaml-cpp-yaml-cpp-0.7.0 mkdir build
- Modify CMakeLists.txt, and add:
add_definitions(-w) // ignore the mistakes of dummy link_directories( /home/grand/pc_installed/lib ) // specify external linked libraries
- Enter ./build/ and specify the installation directory
cd build cmake -DCMAKE_INSTALL_PREFIX=/home/grand/pc_installed -DBUILD_SHARED_LIBS=ON .. // -DCMAKE_INSTALL_PREFIX=/path/to/where/you/want // specify the installation directory // or in CMakeLists.txt add 'SET(CMAKE_INSTALL_PREFIX < install_path >)' after PROJECT(< project_name>) // -DBUILD_SHARED_LIBS=ON Enable dynamic library compilation, which is disabled by default
- Start to compile
make -j8 sudo make install sudo ldconfig
The YAML environment has been successfully set up.
-
- If use yaml-cpp-release-0.5.0, you may meet followed problems:
- cannot find boost dependency libraries
- first you should install boost:
sudo apt-get install libboost-all-dev
- After installation, if it still doesn’t work, first check for the ‘boost_thread’ library, and then modify the CMakeLists file to specify the path where the boost library is located
locate boost_thread set(BOOST_LIBRARYDIR /usr/lib) # Assuming that the location of Boost is /usr/lib/x86_64-linux-gnu/libboost_thread.a find_package(Boost REQUIRED COMPONENTS thread)
- first you should install boost:
- Boost library is present, but when calling the respective file, it displays: error: ‘next’ is not a member of ‘boost’, and the solution is:
- Add the header file in the ‘next’ file where it is not found
vi /home/xuxing/externalTools/DBH/yaml-cpp-release-0.5.0/include/yaml-cpp/node/detail/iterator.h
#include <boost/next_prior.hpp> // Header files for Boost location
- cannot find boost dependency libraries
- After completing the above steps, recompile (repeating the installation steps from the YAML) to display a successful installation.
- iperf
Copy the iPerf tool that can be used on ARM to the ‘iperf_for_arm’ folder for future use. - Configuring the C++ environment on ARM, the steps are as follows:
scp /tools/Xilinx/SDK/2018.3/gnu/aarch64/lin/aarch64-linux/aarch64-linux-gnu/lib64/libstdc++.so.6.0.24 root@192.168.10.2:/lib/
scp /tools/Xilinx/SDK/2018.3/gnu/aarch64/lin/aarch64-linux/aarch64-linux-gnu/lib64/libgcc_s.so.1 root@192.168.10.2:/lib/
ssh root@<arm-host>
cd /lib
ln -s libstdc++.so.6.0.24 libstdc++.so.6
ln -s libstdc++.so.6 libstdc++.so
ln -s libgcc_s.so.1 libgcc_s.so
See details in ‘step_for_cpp.txt,’ the content is as follows:
3. scp /tools/Xilinx/SDK/2018.3/gnu/aarch64/lin/aarch64-linux/aarch64-linux-gnu/lib64/libstdc++.so.6.0.24 root@192.168.61.xx:/lib/
4. scp /tools/Xilinx/SDK/2018.3/gnu/aarch64/lin/aarch64-linux/aarch64-linux-gnu/lib64/libgcc_s.so.1 root@192.168.61.xx:/lib/
5. ssh root@<arm-host>
6. cd /lib/
7. # Search for the C++ libraries and then create symbolic links.
8. ln -s libstdc++.so.6.0.24 libstdc++.so.6
9. ln -s libstdc++.so.6 libstdc++.so
10. ln -s libgcc_s.so.1 libgcc_s.so
If you change the host and the hostname is not ‘grand’
In that case, you need to perform the following steps:
1. rm ./build-arm/CMakeCache.txt
2. rm ./build-x86_64/CMakeCache.txt
3. vi CMakeLists.txt # modify set(EXTERNAL_DIR_ARM /home/duanbh/arm_a_installed) and set(EXTERNAL_DIR_PC /home/duanbh/pc_installed) to /home/user
4. vi ./package.sh # modify EXTERNAL_DIR_PC=/home/grand/pc_installed and EXTERNAL_DIR_ARM=/home/grand/arm_a_installed to /home/user
5. vi env.sh # modify all '/home/grand' to '/home/user'
Complete the entire process.
Compile grand-daq
- Execute the script.
sh duantest.sh
- Possible problems
-
If you encounter the following issue, it’s a compatibility problem between the library version and the system environment. In simple terms, the x86-64 version is suitable for 64-bit hosts, while what is needed on ARM are cross-compiled library files.
ERROR: skipping incompatible
solutions:
First, examine the linked library information to confirm the assumption.readelf -h libxxx.so
Recompile the tools (ZeroMQ, YAML) using cross-compilation tools, or locate the library files within the cross-compilation tool. The cross-compilation tool I’m using is:
- /tools/Xilinx/SDK/2018.3/gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-g++, but this tool requires Xilinx to be downloaded in advance and is not universal
- Download aarch64-linux-gnu-g++ directly.
sudo apt-get install g++-aarch64-linux-gnu aarch64-linux-gnu-g++ --vresion(check the version)
-
cannot open linker script file ****: Too many open files, the solution is the same as mentioned above
-
When packaging the software, you may encounter a situation as shown in the figure:
At this point, you should carefully check whether the library files and other components specified in the packaging script are present on the host, as shown in the following figure
If there are any other issues, updates will continue.
GRAND@Dunhuang
Author: duanbohao@GRAND