Score:0

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

ru flag

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: 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

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

How to solve the problem?

jabbson avatar
sb flag
Tried the process on a fresh ubuntu 22.04 with no issue. While this by itself isn't too helpful in regard to why this isn't working for you, I want to point out that based on the output you provided, the libboost 1.74 is installed, but the installation process is looking for libboost 1.71 (note the difference in versions)? On the fresh ubuntu i spun up for this test I see that I also have libboost 1.74 installed. Hope it gives you ideas.
jabbson avatar
sb flag
https://forums.opensuse.org/showthread.php/544048-C-Linker-links-to-wrong-Boost-version appears to be quiet similar in nature
Raphael10 avatar
ru flag
Thanks @jabbson but unfortunately removing the cache and rebuild doesn't solve the problem: `rm /etc/ld.so.cache ldconfig`
Raphael10 avatar
ru flag
@jabbson I've updated my post above with the output of `sudo ldconfig -p | grep boost`
Martin avatar
kz flag
you are mixing things up here: `LD_LIBRARY_PATH` should contain a colon seperated list of additional _directories_ containing shared libraries, not the path to the .so file itself. And: similar to the environmental variable, the config file to ldconfig must contain directories, not files!
Raphael10 avatar
ru flag
Hi @Martin ! Is this correct ( in .bashrc) ? : `LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu/" ` I've put also in `/etc/ld.so.conf.d/libboost.conf` : `/usr/lib/x86_64-linux-gnu/` 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`
Martin avatar
kz flag
well, not unless you have the statement `export LD_LIBRARY_PATH` after this line... and: you are executing your application via `sudo` - are you editing the correct .bashrc? I would check with the command `sudo -u _renderd /bin/bash -c 'echo "$LD_LIBRARY_PATH"'` that the path is indeed set correctly...
Martin avatar
kz flag
I can't teach you bash syntax in comments; the line `var=$var:blabla` takes the original value of `var` and appends the string ":blabla" to it. Obviously, the directory /usr/lib/x86_64-linux-gnu/ already has been inside the LD_LIBRARY_PATH, and your line appended it a second time...
Raphael10 avatar
ru flag
@Martin I've tried in these both ways in `.bashrc` : `export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":/usr/lib/x86_64-linux-gnu/` or `export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:"$LD_LIBRARY_PATH"` but I do not get any output with `sudo -u _renderd /bin/bash -c 'echo "$LD_LIBRARY_PATH"'` .
Martin avatar
kz flag
try the following command to launch your app: `sudo -u _renderd /bin/bash -c "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu ; 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"`
Raphael10 avatar
ru flag
@Martin `raphy@pc:~$ sudo -u _renderd /bin/bash -c "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu ; 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 `
Raphael10 avatar
ru flag
@Martin I tried to modify `.bashrc` as follows: 1) `export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":/usr/lib/x86_64-linux-gnu/` 2) `export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:"$LD_LIBRARY_PATH"` 3) `LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu/" export LD_LIBRARY_PATH` 4) `export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu/` . But in all these attempts `sudo -u _renderd /bin/bash -c 'echo "$LD_LIBRARY_PATH"'` give no output
Raphael10 avatar
ru flag
@Martin `raphy@pc:~$ echo $LD_LIBRARY_PATH /usr/lib/x86_64-linux-gnu/:/usr/lib/x86_64-linux-gnu/` .So. it seems correct. But still `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`
Martin avatar
kz flag
I think the sudo command is clearing the environment, and the bashrc file is not read unless an interactive shell is started. (Try adding `-i` to /bin/bash). I think I just found the reason, the application `osm2pgsql` expects `libboost_filesystem.so.1.71.0`, but you have an incompatible version: `libboost_filesystem.so.1.74.0`
Raphael10 avatar
ru flag
@Martin I've already opened an issue in `osm2pgsql` github's repo: https://github.com/openstreetmap/osm2pgsql/issues/1794 about the fact that this lib looks for `libboost 1.71.0` even if the pre-installed (the system's) version is `1.74.0`. But I thought the problem could be also the `LD_LIBRARY_PATH` settings
Martin avatar
kz flag
well, you must have the correct version of boos inside your linker search path... so, either recompile the application with boost 1.74.0, or set the path accordingly to a boost installation version 1.71.0 (I do not know if you still have that version installed somewhere)
Raphael10 avatar
ru flag
@Martin The official version of `libboost`in the `Ubuntu Repo` is version `1.74.0` : https://packages.ubuntu.com/jammy/libs/libboost-atomic1.74.0 . But why to install a version which has been set by the Ubuntu team as `obsolete` ? : `raphy@pc:~$ sudo apt-get install libboost-all-dev=1.71.0 Reading package lists Building dependency tree 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 `
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.