osm2pgsql-dev / osm2pgsql

OpenStreetMap data to PostgreSQL converter
https://osm2pgsql.org
GNU General Public License v2.0
1.5k stars 474 forks source link

libboost_filesystem.so.1.71.0: cannot open shared object file: No such file or directory #1794

Closed raphael10-collab closed 2 years ago

raphael10-collab commented 2 years ago

Following the indications found here: https://switch2osm.org/serving-tiles/manually-building-a-tile-server-ubuntu-22-04-lts/ I'm trying to install Tile Server in Ubuntu 22.04

but I'm getting this error:

raphy@pc:~$ sudo -u _renderd osm2pgsql -d gis --create --slim  -G --hstore --tag-transform-script ./OSM_src/openstreetmap-carto/openstreetmap-carto.lua -C 2500 --number-processes 1 -S ./OSM_src/openstreetmap-carto/openstreetmap-carto.style ./OSM_src/data/azerbaijan-latest.osm.pbf
osm2pgsql: error while loading shared libraries: libboost_filesystem.so.1.71.0: cannot open shared object file: No such file or directory

The libboost library present is 1.74.0:

raphy@pc:~$ sudo apt install libboost-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libboost-dev is already the newest version (1.74.0.3ubuntu7).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

raphy@pc:/usr/lib/x86_64-linux-gnu$ ls -lah | grep libboost_filesystem.so
lrwxrwxrwx   1 root root    29 mar 16  2022 libboost_filesystem.so -> libboost_filesystem.so.1.74.0
-rw-r--r--   1 root root  123K mar 16  2022 libboost_filesystem.so.1.74.0

Following the indications found here: https://askubuntu.com/questions/950313/how-to-set-ld-library-path-permanently I've set in .bashrc file:

LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu/libboost_filesystem.so"

And, following the indications found here: https://serverfault.com/questions/201709/how-to-set-ld-library-path-in-ubuntu I've set /etc/ld.so.conf.d/libboost.conf as :

/usr/lib/x86_64-linux-gnu/libboost_filesystem.so

And then

sudo ldconfig

But still get the error:

osm2pgsql: error while loading shared libraries: libboost_filesystem.so.1.71.0: cannot open shared object file: No such file or directory

How to solve the problem?

PS: I tried also to compile osm2pgsql library but in the make phase I get:

[ 98%] Building CXX object CMakeFiles/osm2pgsql.dir/src/osm2pgsql.cpp.o
make[2]: *** No rule to make target '/usr/lib/x86_64-linux-gnu/libboost_system.so.1.74.0', needed by 'osm2pgsql'.  Stop.
make[1]: *** [CMakeFiles/Makefile2:118: CMakeFiles/osm2pgsql.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

And

With set(Boost_INCLUDE_DIR,"/usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.74.0") in CmakeLists.txt it still says: No rule to make target '/usr/lib/x86_64-linux-gnu/libboost_system.so.1.74.0', needed by 'osm2pgsql'. Stop : CMakeLists.txt

pnorman commented 2 years ago

Following the indications found here: https://switch2osm.org/serving-tiles/manually-building-a-tile-server-ubuntu-22-04-lts/ I'm trying to install Tile Server in Ubuntu 22.04

Those instructions are not part of osm2pgsql, they're maintained by different people. Can you clean your system of the stuff you've done and try the instructions in the osm2pgsql readme?

PS: I tried also to compile osm2pgsql library but in the make phase I get:

Have you followed the instructions at https://github.com/openstreetmap/osm2pgsql#building? Specifically that about installing dependencies.

Ubuntu 22.04 comes with osm2pgsql 1.6.0. Do you need a more recent version?

raphael10-collab commented 2 years ago

@pnorman The osm2pgsql installed through Ubuntu Repo (sudo apt install osm2pgsql) looks for libboost 1.71.0 : osm2pgsql: error while loading shared libraries: libboost_filesystem.so.1.71.0: cannot open shared object file: No such file or directory while the pre-installed libboost version is 1.74.0

But alsoosm2pgsql installed following these instructions: https://github.com/openstreetmap/osm2pgsql#building , looks for version 1.71.0 of libboost while the pre-installed version of libboost is 1.74.0:

raphy@pc:~/OSM_src$ sudo apt-get install make cmake g++ libboost-dev libboost-system-dev \
  libboost-filesystem-dev libexpat1-dev zlib1g-dev \
  libbz2-dev libpq-dev libproj-dev lua5.3 liblua5.3-dev pandoc
[sudo] password for raphy: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
g++ is already the newest version (4:11.2.0-1ubuntu1).
libboost-dev is already the newest version (1.74.0.3ubuntu7).
libboost-filesystem-dev is already the newest version (1.74.0.3ubuntu7).
libboost-system-dev is already the newest version (1.74.0.3ubuntu7).
libbz2-dev is already the newest version (1.0.8-5build1).
libexpat1-dev is already the newest version (2.4.7-1).
liblua5.3-dev is already the newest version (5.3.6-1build1).
make is already the newest version (4.3-4.1build1).
libproj-dev is already the newest version (8.2.1-1).
lua5.3 is already the newest version (5.3.6-1build1).
pandoc is already the newest version (2.9.2.1-3ubuntu2).
libpq-dev is already the newest version (14.5-0ubuntu0.22.04.1).
cmake is already the newest version (3.22.1-1ubuntu1.22.04.1).
zlib1g-dev is already the newest version (1:1.2.11.dfsg-2ubuntu9.1).
0 upgraded, 0 newly install

raphy@pc:~/OSM_src$ git clone https://github.com/openstreetmap/osm2pgsql.git
raphy@pc:~/OSM_src$ git clone https://github.com/openstreetmap/osm2pgsql.git
Cloning into 'osm2pgsql'...
remote: Enumerating objects: 21255, done.
remote: Counting objects: 100% (869/869), done.
remote: Compressing objects: 100% (345/345), done.
remote: Total 21255 (delta 545), reused 817 (delta 508), pack-reused 20386
Receiving objects: 100% (21255/21255), 49.04 MiB | 19.59 MiB/s, done.
Resolving deltas: 100% (15517/15517), done.
raphy@pc:~/OSM_src$ cd osm2pgsql/
raphy@pc:~/OSM_src/osm2pgsql$ mkdir build && cd build
raphy@pc:~/OSM_src/osm2pgsql/build$ cmake ..
-- The CXX compiler identification is GNU 11.2.0
-- The C compiler identification is GNU 11.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Building osm2pgsql 1.7.1
-- Building in C++17 mode
-- Found Git: /usr/bin/git (found version "2.34.1") 
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found Protozero: /home/raphy/OSM_src/osm2pgsql/contrib/protozero/include (found suitable version "1.7.1", minimum required is "1.6.3") 
-- Found EXPAT: /usr/lib/x86_64-linux-gnu/libexpat.so (found version "2.4.7") 
-- Found BZip2: /usr/lib/x86_64-linux-gnu/libbz2.so (found version "1.0.8") 
-- Looking for BZ2_bzCompressInit
-- Looking for BZ2_bzCompressInit - found
-- Found Osmium: /home/raphy/OSM_src/osm2pgsql/contrib/libosmium/include (found suitable version "2.17.3", minimum required is "2.17.3") 
-- Building with Lua support
-- Found Lua: /usr/lib/x86_64-linux-gnu/liblua5.3.so;/usr/lib/x86_64-linux-gnu/libm.so (found version "5.3.6") 
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake (found suitable version "1.74.0", minimum required is "1.50") found components: system filesystem 
-- Found PostgreSQL: /usr/lib/x86_64-linux-gnu/libpq.so (found version "14.5")  
-- Found Proj [API 6] /usr/lib/x86_64-linux-gnu/libproj.so
-- Libraries used to build: Boost::system;Boost::filesystem;/usr/lib/x86_64-linux-gnu/libpq.so;/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libexpat.so;/usr/lib/x86_64-linux-gnu/libbz2.so;/usr/lib/x86_64-linux-gnu/libproj.so;/usr/lib/x86_64-linux-gnu/liblua5.3.so;/usr/lib/x86_64-linux-gnu/libm.so
-- Looking for clang-tidy
-- Looking for clang-tidy - not found
--   Build target 'clang-tidy' will not be available.
-- Tests disabled. Set BUILD_TESTS=ON to enable tests.
-- Looking for pandoc
-- Looking for argparse-manpage
-- Looking for pandoc - found
--   osm2pgsql manual page can be built using 'man' target
-- Looking for argparse-manpage - not found
--   osm2pgsql-replication page can not be built
-- Configuring done
-- Generating done
-- Build files have been written to: /home/raphy/OSM_src/osm2pgsql/build
raphy@pc:~/OSM_src/osm2pgsql/build$ make
[  2%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/db-check.cpp.o
[  4%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/db-copy.cpp.o
[  6%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/dependency-manager.cpp.o
[  8%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/expire-tiles.cpp.o
[ 10%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/gazetteer-style.cpp.o
In file included from /usr/include/boost/bind.hpp:30,
                 from /usr/include/boost/property_tree/json_parser/detail/parser.hpp:7,
                 from /usr/include/boost/property_tree/json_parser/detail/read.hpp:13,
                 from /usr/include/boost/property_tree/json_parser.hpp:16,
                 from /home/raphy/OSM_src/osm2pgsql/src/gazetteer-style.cpp:15:
/usr/include/boost/bind.hpp:36:1: note: ‘#pragma message: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.’
   36 | BOOST_PRAGMA_MESSAGE(
      | ^~~~~~~~~~~~~~~~~~~~
[ 12%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/geom.cpp.o
[ 14%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/geom-box.cpp.o
[ 16%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/geom-from-osm.cpp.o
[ 18%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/geom-functions.cpp.o
In file included from /usr/include/boost/math/tools/cxx03_warn.hpp:9,
                 from /usr/include/boost/math/constants/constants.hpp:11,
                 from /usr/include/boost/geometry/util/math.hpp:29,
                 from /usr/include/boost/geometry/core/radian_access.hpp:33,
                 from /usr/include/boost/geometry/geometry.hpp:51,
                 from /usr/include/boost/geometry.hpp:17,
                 from /home/raphy/OSM_src/osm2pgsql/src/geom-boost-adaptor.hpp:15,
                 from /home/raphy/OSM_src/osm2pgsql/src/geom-functions.cpp:11:
/usr/include/boost/detail/no_exceptions_support.hpp:17:1: note: ‘#pragma message: This header is deprecated. Use <boost/core/no_exceptions_support.hpp> instead.’
   17 | BOOST_HEADER_DEPRECATED("<boost/core/no_exceptions_support.hpp>")
      | ^~~~~~~~~~~~~~~~~~~~~~~
[ 20%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/input.cpp.o
[ 22%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/logging.cpp.o
[ 24%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/middle.cpp.o
[ 26%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/middle-pgsql.cpp.o
[ 28%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/middle-ram.cpp.o
[ 30%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/node-locations.cpp.o
[ 32%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/node-persistent-cache.cpp.o
[ 34%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/options.cpp.o
[ 36%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/ordered-index.cpp.o
[ 38%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/osmdata.cpp.o
[ 40%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/output-gazetteer.cpp.o
[ 42%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/output-null.cpp.o
[ 44%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/output-pgsql.cpp.o
[ 46%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/output.cpp.o
[ 48%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/pgsql.cpp.o
[ 50%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/pgsql-capabilities.cpp.o
[ 52%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/pgsql-helper.cpp.o
[ 54%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/progress-display.cpp.o
[ 56%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/reprojection.cpp.o
[ 58%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/table.cpp.o
[ 60%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/taginfo.cpp.o
[ 62%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/tagtransform-c.cpp.o
[ 64%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/tagtransform.cpp.o
[ 66%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/tile.cpp.o
[ 68%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/thread-pool.cpp.o
[ 70%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/util.cpp.o
[ 72%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/wildcmp.cpp.o
[ 74%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/wkb.cpp.o
[ 76%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/flex-table.cpp.o
[ 78%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/flex-table-column.cpp.o
[ 80%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/flex-lua-geom.cpp.o
[ 82%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/geom-transform.cpp.o
[ 84%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/lua-utils.cpp.o
[ 86%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/output-flex.cpp.o
[ 88%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/tagtransform-lua.cpp.o
[ 90%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/lua-init.cpp.o
[ 92%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/version.cpp.o
[ 94%] Building CXX object src/CMakeFiles/osm2pgsql_lib.dir/reprojection-generic-proj6.cpp.o
[ 96%] Linking CXX static library libosm2pgsql.a
[ 96%] Built target osm2pgsql_lib
[ 98%] Building CXX object CMakeFiles/osm2pgsql.dir/src/osm2pgsql.cpp.o
make[2]: *** No rule to make target '/usr/lib/x86_64-linux-gnu/libboost_system.so.1.74.0', needed by 'osm2pgsql'.  Stop.
make[1]: *** [CMakeFiles/Makefile2:118: CMakeFiles/osm2pgsql.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
raphy@pc:~/OSM_src/osm2pgsql/build$ 

This is the output of sudo ldconfig -p | grep boost :

    raphy@pc:~$ sudo ldconfig -p | grep boost
      libboost_wserialization.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_wserialization.so.1.74.0
      libboost_wserialization.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_wserialization.so
      libboost_wave.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_wave.so.1.74.0
      libboost_wave.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_wave.so
      libboost_unit_test_framework.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.74.0
      libboost_unit_test_framework.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_unit_test_framework.so
      libboost_type_erasure.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_type_erasure.so.1.74.0
      libboost_type_erasure.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_type_erasure.so
      libboost_timer.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_timer.so.1.74.0
      libboost_timer.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_timer.so
      libboost_thread.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_thread.so.1.74.0
      libboost_thread.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_thread.so
      libboost_stacktrace_noop.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_stacktrace_noop.so.1.74.0
      libboost_stacktrace_noop.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_stacktrace_noop.so
      libboost_stacktrace_basic.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_stacktrace_basic.so.1.74.0
      libboost_stacktrace_basic.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_stacktrace_basic.so
      libboost_stacktrace_backtrace.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_stacktrace_backtrace.so.1.74.0
      libboost_stacktrace_backtrace.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_stacktrace_backtrace.so
      libboost_stacktrace_addr2line.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_stacktrace_addr2line.so.1.74.0
      libboost_stacktrace_addr2line.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_stacktrace_addr2line.so
      libboost_serialization.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_serialization.so.1.74.0
      libboost_serialization.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_serialization.so
      libboost_regex.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_regex.so.1.74.0
      libboost_regex.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_regex.so
      libboost_random.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_random.so.1.74.0
      libboost_random.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_random.so
      libboost_python310.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_python310.so.1.74.0
      libboost_python310.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_python310.so
      libboost_program_options.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_program_options.so.1.74.0
      libboost_program_options.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_program_options.so
      libboost_prg_exec_monitor.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_prg_exec_monitor.so.1.74.0
      libboost_prg_exec_monitor.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_prg_exec_monitor.so
      libboost_numpy310.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_numpy310.so.1.74.0
      libboost_numpy310.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_numpy310.so
      libboost_nowide.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_nowide.so.1.74.0
      libboost_nowide.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_nowide.so
      libboost_mpi_python310.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_mpi_python310.so.1.74.0
      libboost_mpi_python310.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_mpi_python310.so
      libboost_mpi.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_mpi.so.1.74.0
      libboost_mpi.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_mpi.so
      libboost_math_tr1l.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_math_tr1l.so.1.74.0
      libboost_math_tr1l.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_math_tr1l.so
      libboost_math_tr1f.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_math_tr1f.so.1.74.0
      libboost_math_tr1f.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_math_tr1f.so
      libboost_math_tr1.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_math_tr1.so.1.74.0
      libboost_math_tr1.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_math_tr1.so
      libboost_math_c99l.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_math_c99l.so.1.74.0
      libboost_math_c99l.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_math_c99l.so
      libboost_math_c99f.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_math_c99f.so.1.74.0
      libboost_math_c99f.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_math_c99f.so
      libboost_math_c99.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_math_c99.so.1.74.0
      libboost_math_c99.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_math_c99.so
      libboost_log_setup.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_log_setup.so.1.74.0
      libboost_log_setup.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_log_setup.so
      libboost_log.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_log.so.1.74.0
      libboost_log.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_log.so
      libboost_locale.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_locale.so.1.74.0
      libboost_locale.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_locale.so
      libboost_iostreams.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_iostreams.so.1.74.0
      libboost_iostreams.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_iostreams.so
      libboost_graph_parallel.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_graph_parallel.so.1.74.0
      libboost_graph_parallel.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_graph_parallel.so
      libboost_graph.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_graph.so.1.74.0
      libboost_graph.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_graph.so
      libboost_filesystem.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_filesystem.so.1.74.0
      libboost_filesystem.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_filesystem.so
      libboost_fiber.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_fiber.so.1.74.0
      libboost_fiber.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_fiber.so
      libboost_date_time.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_date_time.so.1.74.0
      libboost_date_time.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_date_time.so
      libboost_coroutine.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_coroutine.so.1.74.0
      libboost_coroutine.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_coroutine.so
      libboost_context.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_context.so.1.74.0
      libboost_context.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_context.so
      libboost_container.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_container.so.1.74.0
      libboost_container.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_container.so
      libboost_chrono.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_chrono.so.1.74.0
      libboost_chrono.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_chrono.so
      libboost_atomic.so.1.74.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_atomic.so.1.74.0
      libboost_atomic.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libboost_atomic.so

    raphy@pc:~$ cat /etc/ld.so.conf.d/libboost.conf
    /usr/lib/x86_64-linux-gnu/

In .bashrc: LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu/"

raphy@pc:~$ echo $LD_LIBRARY_PATH
/usr/lib/x86_64-linux-gnu/:/usr/lib/x86_64-linux-gnu/

And the Ubuntu team has set as obsolete the version 1.71.0 of libboost for Ubuntu 22.04:

raphy@pc:~$ sudo apt-get install libboost-all-dev=1.71.0
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package libboost-all-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Version '1.71.0' for 'libboost-all-dev' was not found
pnorman commented 2 years ago

@pnorman The osm2pgsql installed through Ubuntu Repo (sudo apt install osm2pgsql) looks for libboost 1.71.0 : osm2pgsql: error while loading shared libraries: libboost_filesystem.so.1.71.0: cannot open shared object file: No such file or directory while the pre-installed libboost version is 1.74.0

You've somehow screwed up your system, as osm2pgsql in 22.04 depends on 1.74.0. On discord you mentioned that you had upgraded your system, and as 20.04 came with boost 1.71.0, it's likely related to incorrectly updating.

This is the output of sudo ldconfig -p | grep boost :

You shouldn't need to do anything with ldconfig, and you definitely should not be setting LD_LIBRARY_PATH.

Closing as not an osm2pgsql issue.

raphael10-collab commented 2 years ago

@pnorman

"You've somehow screwed up your system, as osm2pgsql in 22.04 depends on 1.74.0. On discord you mentioned that you had upgraded your system":

1) I just and only did sudo do-release-upgrade and everything was upgraded smoothly, without any problems reported 2) As showed, the Ubuntu team has set as obsolete the version 1.71.0 of libboost for Ubuntu 22.04:

raphy@pc:~$ sudo dpkg -s libboost-dev | grep 'Version'
Version: 1.74.0.3ubuntu7

raphy@pc:~$ sudo apt-get install libboost-all-dev=1.71.0
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package libboost-all-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Version '1.71.0' for 'libboost-all-dev' was not found

And the only version available for Ubuntu 22.04 of libboost library is the version 1.74.0 .

So.... why does the error message say osm2pgsql: error while loading shared libraries: libboost_filesystem.so.1.71.0: cannot open shared object file: No such file or directory ?

ImreSamu commented 2 years ago

So.... why does the error message say osm2pgsql: error while loading shared libraries: libboost_filesystem.so.1.71.0: cannot open shared object file: No such file or directory

imho: You may have old osm2pgsql installations that should be removed ( and after re-install ! )

raphael10-collab commented 2 years ago

@ImreSamu Thanks for giving me an help

steps followed:

1) removed osm2pgsql :

raphy@pc:~$ sudo apt remove osm2pgsql
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following package was automatically installed and is no longer required:
  python3-pyosmium
Use 'sudo apt autoremove' to remove it.
The following packages will be REMOVED:
  osm2pgsql
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 1.080 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 256271 files and directories currently installed.)
Removing osm2pgsql (1.6.0+ds-1) ...
Processing triggers for man-db (2.10.2-1) ...

2) checked which osm2pgsql :

raphy@pc:~$ which osm2pgsql
/usr/local/bin/osm2pgsql

3) apt update :

raphy@pc:~$ sudo apt update
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 https://dl.google.com/linux/chrome/deb stable InRelease              
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [114 kB]    
Get:4 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]      
Get:5 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 DEP-11 Metadata [92,7 kB]
Get:6 http://archive.ubuntu.com/ubuntu jammy-updates/multiverse amd64 DEP-11 Metadata [940 B]
Get:7 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 DEP-11 Metadata [247 kB]
Get:8 http://security.ubuntu.com/ubuntu jammy-security/main amd64 DEP-11 Metadata [13,0 kB]
Get:9 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 DEP-11 Metadata [12,4 kB]
Fetched 591 kB in 1s (736 kB/s)             
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.

4) install osm2pgsql

raphy@pc:~$ sudo apt install osm2pgsql
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  osm2pgsql
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 414 kB of archives.
After this operation, 1.080 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu jammy/universe amd64 osm2pgsql amd64 1.6.0+ds-1 [414 kB]
Fetched 414 kB in 0s (1.944 kB/s) 
Selecting previously unselected package osm2pgsql.
(Reading database ... 256257 files and directories currently installed.)
Preparing to unpack .../osm2pgsql_1.6.0+ds-1_amd64.deb ...
Unpacking osm2pgsql (1.6.0+ds-1) ...
Setting up osm2pgsql (1.6.0+ds-1) ...
Processing triggers for man-db (2.10.2-1) ...

5)

raphy@pc:~$ sudo dpkg -s osm2pgsql | grep 'Version'
Version: 1.6.0+ds-1

raphy@pc:~$ which osm2pgsql
/usr/local/bin/osm2pgsql

raphy@pc:/usr/local/bin$ ls -lah | grep osm2pgsql
-rwxr-xr-x  1 root root  68M lug  8 11:31 osm2pgsql
-rwxr-xr-x  1 root root  21K lug  8 09:06 osm2pgsql-replication

raphy@pc:~$ osm2pgsql -V
osm2pgsql: error while loading shared libraries: libboost_filesystem.so.1.71.0: cannot open shared object file: No such file or 
directory

Why does this happen?

joto commented 2 years ago

apt install will install to /usr/bin/osm2pgsql. So if you find it in /usr/local/bin you have two versions installed.

raphael10-collab commented 2 years ago

@joto do you suggest me to manually remove /usr/local/bin/osm2pgsql ?