I'm trying to run a code, for that, I have to compile a shared librairy with cmake and boost. The tuto says I have to do:
cd ParallelPcap
mkdir build
cd build
cmake ..
make parallelpcap
Firstly, I had issues with the CmakeLists.txt when I was doing cmake, indeed I had to put
find_package(Boost REQUIRED unit_test_framework program_options
system python numpy filesystem serialization)
instead of
find_package(Boost REQUIRED unit_test_framework program_options
system python3 numpy3 filesystem serialization)
and instead of
cmake ..
I did
cmake -DPYTHON_EXECUTABLE="/cvmfs/soft.computecanada.ca/easybuild/software/2020/avx2/Core/python/3.8.2/bin/python" ..
After the make and mv commands, I tried to run my code and I have
python3 main.py run -c packet2vec_config.yml
Traceback (most recent call last):
File "main.py", line 19, in <module>
import pcaps.process as pp
File "/project/6045847/ropic/packet2vec/pcaps/process.py", line 1, in <module>
import parallelpcap
ImportError: /project/6045847/ropic/packet2vec/parallelpcap.so: undefined symbol: _ZN5boost6python6detail12gcc_demangleEPKc
for more readable error, I did this command
c++filt -n _ZN5boost6python6detail12gcc_demangleEPKc
boost::python::detail::gcc_demangle(char const*)
After researching, I found that and that.
So I put in CMakeLists.txt
set(GCC_COVERAGE_COMPILE_FLAGS "-g -O2 -std=c++11 -pthread -Wl,--no-as-needed -ftree-vectorize -msse2 -fopt-info-vec-optimized -lboost_python38 -lboost_system")
instead of
set(GCC_COVERAGE_COMPILE_FLAGS "-g -O2 -std=c++11 -pthread -Wl,--no-as-needed -ftree-vectorize -msse2 -fopt-info-vec-optimized -lboost_python38 -lboost_system")
(I added -lboost_python38 and -lboost_system flags in the CMaleLists.txt)
But I have the same issue when I run my code
I have huge outputs when I do cmake and make so I'm not sure if it's necessary that I share them
EDIT: When I do a research (with the term "#include <boost/") I have the following result:
ReadPcap.hpp
#include <boost/program_options.hpp>
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/filesystem.hpp>
#include <boost/serialization/map.hpp>
#include <boost/serialization/vector.hpp>
CountDictionnary.hpp
#include <boost/python.hpp>
#include <boost/serialization/serialization.hpp>
Packet.hpp
#include <boost/serialization/vector.hpp>
Pacekt2Vec.hpp
#include <boost/python.hpp>
#include <boost/python/numpy.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/filesystem.hpp>
Pcap.hpp
#include <boost/lexical_cast.hpp>
#include <boost/python.hpp>
#include <boost/serialization/vector.hpp>
TestPcap.hpp
#include <boost/archive/text_iarchive.hpp>
#include <boost/python.hpp>
#include <boost/python/numpy.hpp>
#include <boost/serialization/map.hpp>
#include <boost/serialization/vector.hpp>
Util.hpp
#include <boost/serialization/serialization.hpp>
#include <boost/serialization/version.hpp>
#include <boost/serialization/split_free.hpp>
ParallelPcapExt.cpp
#include <boost/python.hpp>
#include <boost/python/numpy.hpp>
Does this mean I need to add libraries as build options in my CMakeLists.txt ? Or can the code run with my current compiler options (more precisely -lboost_python38 and -lboost_system flags) ?
EDIT2: I tried to add -lboost_serialization -lboost_filesystem flags to my CMakeLists.txt like -lboost_python38 and -lboost_system without success. I still have the same error when I run the code