cyang-kth / fmm

Fast map matching, an open source framework in C++
https://fmm-wiki.github.io/
Apache License 2.0
875 stars 205 forks source link

issues on Boost library #232

Closed ttingtingwang closed 2 years ago

ttingtingwang commented 2 years ago

I use "cmake .." to successfully install required packages. But when I conducted "make -j4", I had some issues about Boost library. Attach my error log

[ 7%] Building CXX object CMakeFiles/ALGORITHM.dir/src/algorithm/geom_algorithm.cpp.o [ 7%] Building CXX object CMakeFiles/CORE.dir/src/core/geometry.cpp.o [ 7%] Building CXX object CMakeFiles/IO.dir/src/io/gps_reader.cpp.o [ 7%] Building CXX object CMakeFiles/CONFIG.dir/src/config/gps_config.cpp.o In file included from /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.cpp:5:0: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:41:11: error: ‘linestring’ in namespace ‘boost::geometry::model’ does not name a type typedef boost::geometry::model::linestring linestring_t; ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:171:16: error: ‘linestring_t’ does not name a type inline const linestring_t &get_geometry_const() const{ ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:178:3: error: ‘linestring_t’ does not name a type linestring_t &get_geometry(){ ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:210:3: error: ‘linestring_t’ does not name a type linestring_t line; ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp: In member function ‘double FMM::CORE::LineString::get_x(int) const’: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:48:36: error: ‘line’ was not declared in this scope return boost::geometry::get<0>(line.at(i)); ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp: In member function ‘double FMM::CORE::LineString::get_y(int) const’: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:57:36: error: ‘line’ was not declared in this scope return boost::geometry::get<1>(line.at(i)); ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp: In member function ‘void FMM::CORE::LineString::set_x(int, double)’: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:65:29: error: ‘line’ was not declared in this scope boost::geometry::set<0>(line.at(i),v); ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp: In member function ‘void FMM::CORE::LineString::set_y(int, double)’: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:73:29: error: ‘line’ was not declared in this scope boost::geometry::set<1>(line.at(i),v); ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp: In member function ‘void FMM::CORE::LineString::add_point(double, double)’: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:81:29: error: ‘line’ was not declared in this scope boost::geometry::append(line, Point(x,y)); ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp: In member function ‘void FMM::CORE::LineString::add_point(const Point&)’: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:88:29: error: ‘line’ was not declared in this scope boost::geometry::append(line, point); ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp: In member function ‘FMM::CORE::Point FMM::CORE::LineString::get_point(int) const’: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:101:7: error: ‘line’ was not declared in this scope line.at(i)),boost::geometry::get<1>(line.at(i))); ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp: In member function ‘const Point& FMM::CORE::LineString::at(int) const’: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:110:12: error: ‘line’ was not declared in this scope return line.at(i); ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp: In member function ‘int FMM::CORE::LineString::get_num_points() const’: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:117:40: error: ‘line’ was not declared in this scope return boost::geometry::num_points(line); ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp: In member function ‘bool FMM::CORE::LineString::is_empty()’: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:124:40: error: ‘line’ was not declared in this scope return boost::geometry::num_points(line)==0; ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp: In member function ‘void FMM::CORE::LineString::clear()’: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:130:28: error: ‘line’ was not declared in this scope boost::geometry::clear(line); ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp: In member function ‘double FMM::CORE::LineString::get_length() const’: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:137:36: error: ‘line’ was not declared in this scope return boost::geometry::length(line); ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp: In member function ‘std::string FMM::CORE::LineString::export_wkt(int) const’: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:147:64: error: ‘line’ was not declared in this scope ss << std::setprecision(precision) << boost::geometry::wkt(line); ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.cpp: In function ‘std::ostream& FMM::CORE::operator<<(std::ostream&, const FMM::CORE::LineString&)’: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.cpp:16:58: error: ‘const class FMM::CORE::LineString’ has no member named ‘line’ os<< std::setprecision(12) << boost::geometry::wkt(rhs.line); ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.cpp: In function ‘FMM::CORE::LineString FMM::CORE::wkt2linestring(const string&)’: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.cpp:44:38: error: ‘class FMM::CORE::LineString’ has no member named ‘get_geometry’ boost::geometry::read_wkt(wkt,line.get_geometry()); ^ In file included from /research/remote/petabyte/users/s3852647/fmm/src/algorithm/geom_algorithm.hpp:15:0, from /research/remote/petabyte/users/s3852647/fmm/src/algorithm/geom_algorithm.cpp:1: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:41:11: error: ‘linestring’ in namespace ‘boost::geometry::model’ does not name a type typedef boost::geometry::model::linestring linestring_t; ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:171:16: error: ‘linestring_t’ does not name a type inline const linestring_t &get_geometry_const() const{ ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:178:3: error: ‘linestring_t’ does not name a type linestring_t &get_geometry(){ ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:210:3: error: ‘linestring_t’ does not name a type linestring_t line; ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp: In member function ‘double FMM::CORE::LineString::get_x(int) const’: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:48:36: error: ‘line’ was not declared in this scope return boost::geometry::get<0>(line.at(i)); ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp: In member function ‘double FMM::CORE::LineString::get_y(int) const’: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:57:36: error: ‘line’ was not declared in this scope return boost::geometry::get<1>(line.at(i)); ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp: In member function ‘void FMM::CORE::LineString::set_x(int, double)’: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:65:29: error: ‘line’ was not declared in this scope boost::geometry::set<0>(line.at(i),v); ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp: In member function ‘void FMM::CORE::LineString::set_y(int, double)’: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:73:29: error: ‘line’ was not declared in this scope boost::geometry::set<1>(line.at(i),v); ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp: In member function ‘void FMM::CORE::LineString::add_point(double, double)’: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:81:29: error: ‘line’ was not declared in this scope boost::geometry::append(line, Point(x,y)); ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp: In member function ‘void FMM::CORE::LineString::add_point(const Point&)’: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:88:29: error: ‘line’ was not declared in this scope boost::geometry::append(line, point); ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp: In member function ‘FMM::CORE::Point FMM::CORE::LineString::get_point(int) const’: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:101:7: error: ‘line’ was not declared in this scope line.at(i)),boost::geometry::get<1>(line.at(i))); ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp: In member function ‘const Point& FMM::CORE::LineString::at(int) const’: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:110:12: error: ‘line’ was not declared in this scope return line.at(i); ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp: In member function ‘int FMM::CORE::LineString::get_num_points() const’: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:117:40: error: ‘line’ was not declared in this scope return boost::geometry::num_points(line); ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp: In member function ‘bool FMM::CORE::LineString::is_empty()’: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:124:40: error: ‘line’ was not declared in this scope return boost::geometry::num_points(line)==0; ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp: In member function ‘void FMM::CORE::LineString::clear()’: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:130:28: error: ‘line’ was not declared in this scope boost::geometry::clear(line); ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp: In member function ‘double FMM::CORE::LineString::get_length() const’: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:137:36: error: ‘line’ was not declared in this scope return boost::geometry::length(line); ^ /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp: In member function ‘std::string FMM::CORE::LineString::export_wkt(int) const’: /research/remote/petabyte/users/s3852647/fmm/src/core/geometry.hpp:147:64: error: ‘line’ was not declared in this scope ss << std::setprecision(precision) << boost::geometry::wkt(line);

Attach my cmake log

-- CMAKE version 3.22.0 -- Set CMP0074 state to NEW -- Set CMP0086 state to NEW -- Set CMP0078 state to NEW

conda environments:

# base * /home/sl7/S3852647/anaconda2

-- Set CONDA_PREFIX /home/sl7/S3852647/anaconda2 -- GDAL headers found at /home/sl7/S3852647/gdal-2.2.4/include -- GDAL library found at /home/sl7/S3852647/gdal-2.2.4/lib/libgdal.so -- Found Boost: /home/sl7/S3852647/boost/include (found suitable version "1.56.0", minimum required is "1.56.0") found components: serialization -- Boost headers found at /home/sl7/S3852647/boost/include -- Boost library found at /home/sl7/S3852647/boost/lib/libboost_serialization-mt.so -- Boost library version 1_56 -- Found OpenMP_C: -fopenmp (found version "3.1") -- Found OpenMP_CXX: -fopenmp (found version "3.1") -- Found OpenMP: TRUE (found version "3.1")
-- OpenMP_HEADERS found at -- OpenMP_CXX_LIBRARIES found at /usr/lib/gcc/x86_64-redhat-linux/4.8.5/libgomp.so;/usr/lib64/libpthread.so -- Installation folder /usr/local -- Not install fmm headers -- Add python cmake information -- Found SWIG: /home/sl7/S3852647/swig-4.0.2/bin/swig (found version "4.0.2")
-- Swig version is 4.0.2 -- Found PythonInterp: /home/sl7/S3852647/anaconda2/bin/python (found version "2.7.18") -- Found PythonLibs: /home/sl7/S3852647/anaconda2/lib/libpython2.7.so (found version "2.7.18") -- Python header found at /home/sl7/S3852647/anaconda2/include/python2.7 -- Python library found at /home/sl7/S3852647/anaconda2/lib/libpython2.7.so -- Python packages /home/sl7/S3852647/anaconda2/lib/python2.7/site-packages -- Using swig add library -- Configuring done CMake Warning at /home/sl7/S3852647/cmake/share/cmake-3.22/Modules/UseSWIG.cmake:905 (add_library): Cannot generate a safe runtime search path for target pyfmm because files in some directories may conflict with libraries in implicit directories:

runtime library [libgomp.so.1] in /usr/lib/gcc/x86_64-redhat-linux/4.8.5 may be hidden by files in:
  /home/sl7/S3852647/anaconda2/lib

Some of these libraries may not be found correctly. Call Stack (most recent call first): python/CMakeLists.txt:35 (SWIG_ADD_LIBRARY)

cyang-kth commented 2 years ago

I think your boost version is too old. Try to install a newer version of boost

sudo apt-get -y install libboost-dev libboost-serialization-dev 
ttingtingwang commented 2 years ago

I think your boost version is too old. Try to install a newer version of boost

sudo apt-get -y install libboost-dev libboost-serialization-dev 

I used the new version, but it still has the same problem

cyang-kth commented 2 years ago

If you used the newer version then this version number should be higher

/home/sl7/S3852647/boost/include (found suitable version "1.56.0", minimum required is "1.56.0") 

Try to manually specify the header location or include the necessary header files into the source file.

ttingtingwang commented 2 years ago

If you used the newer version then this version number should be higher

/home/sl7/S3852647/boost/include (found suitable version "1.56.0", minimum required is "1.56.0") 

Try to manually specify the header location or include the necessary header files into the source file.

It works! Thanks. I have another issue: whether I can conduct "make install" without "sudo" (I have no root authority)

cyang-kth commented 2 years ago

You can try to specify the install location to another place using -DCMAKE_INSTALL_PREFIX

cmake -DCMAKE_INSTALL_PREFIX=$HOME ..
make -j $(nproc)
make install

However, you may need to add the location to your path variable if it is not there.

ttingtingwang commented 2 years ago

Thanks. I sucessfully installed fmm, but it has a new issue when typing "fmm"

[s3852647@segsresap04 build]$ fmm terminate called after throwing an instance of 'std::regex_error' what(): regex_error Aborted

Is it because my gcc version is too low? My current version is 4.8.5.

ttingtingwang commented 2 years ago

You can try to specify the install location to another place using -DCMAKE_INSTALL_PREFIX

cmake -DCMAKE_INSTALL_PREFIX=$HOME ..
make -j $(nproc)
make install

However, you may need to add the location to your path variable if it is not there.

I try to update gcc version (6.5.0), but it has other issues when conducting "make -j4"

[ 80%] Linking CXX shared library libFMMLIB.so [ 80%] Built target FMMLIB [ 88%] Building CXX object CMakeFiles/stmatch.dir/src/app/stmatch.cpp.o [ 88%] Building CXX object CMakeFiles/fmm.dir/src/app/fmm.cpp.o [ 88%] Building CXX object CMakeFiles/h3mm.dir/src/app/h3mm.cpp.o [ 88%] Building CXX object CMakeFiles/ubodt_gen.dir/src/app/ubodt_gen_app.cpp.o [ 90%] Linking CXX executable ubodt_gen libFMMLIB.so: undefined reference to boost::archive::basic_binary_oprimitive<boost::archive::binary_oarchive, char, std::char_traits<char> >::save(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' collect2: error: ld returned 1 exit status make[2]: *** [ubodt_gen] Error 1 make[1]: *** [CMakeFiles/ubodt_gen.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... [ 92%] Linking CXX executable fmm libFMMLIB.so: undefined reference toboost::archive::basic_binary_oprimitive<boost::archive::binary_oarchive, char, std::char_traits >::save(std::cxx11::basic_string<char, std::char_traits, std::allocator > const&)' collect2: error: ld returned 1 exit status make[2]: [fmm] Error 1 make[1]: [CMakeFiles/fmm.dir/all] Error 2 [ 94%] Linking CXX executable stmatch libFMMLIB.so: undefined reference to `boost::archive::basic_binary_oprimitive<boost::archive::binary_oarchive, char, std::char_traits >::save(std::cxx11::basic_string<char, std::char_traits, std::allocator > const&)' collect2: error: ld returned 1 exit status make[2]: [stmatch] Error 1 make[1]: [CMakeFiles/stmatch.dir/all] Error 2 [ 96%] Linking CXX executable h3mm libFMMLIB.so: undefined reference to `boost::archive::basic_binary_oprimitive<boost::archive::binary_oarchive, char, std::char_traits >::save(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)' collect2: error: ld returned 1 exit status make[2]: [h3mm] Error 1 make[1]: [CMakeFiles/h3mm.dir/all] Error 2 make: *** [all] Error 2

cyang-kth commented 2 years ago

It might be related with LD_LIBRARY_PATH, which should install the path of boost library. I have not tested in a non-root user machine so I cannot provide solutions.

If you have multiple boost libraries installed, you may encounter an issue like this as you link to another version of boost so you need to set the LD_LIBRARY_PATH to put your newer boost library ahead of the default/old one.

ttingtingwang commented 2 years ago

It might be related with LD_LIBRARY_PATH, which should install the path of boost library. I have not tested in a non-root user machine so I cannot provide solutions.

If you have multiple boost libraries installed, you may encounter an issue like this as you link to another version of boost so you need to set the LD_LIBRARY_PATH to put your newer boost library ahead of the default/old one.

I try to put boost header file into the source file, and sucessfully installed fmm. However typing "fmm" still has issues. This is related to Boost library?

[s3852647@segsresap04 build]$ fmm terminate called after throwing an instance of 'std::regex_error' what(): regex_error Aborted

cyang-kth commented 2 years ago

Your problem still seems to be old gcc compiler used.

Fern-Parker commented 2 years ago

Hi, ttingtingwang! I also encountered the same error: terminate called after throwing an instance of 'std::regex_error' what(): regex_error. Have your problem been solved?