stack-of-tasks / pinocchio

A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives
http://stack-of-tasks.github.io/pinocchio/
BSD 2-Clause "Simplified" License
1.91k stars 395 forks source link

undefined reference to `boost::filesystem::detail::path_algorithms::find_root_directory` #2237

Closed wzjscut closed 5 months ago

wzjscut commented 5 months ago

Bug description

cannot build the project in ubuntu20.04

Reproduction steps

I follow the installation step and when I use make, it returns the erros

/usr/bin/ld: ../src/libpinocchio.so.2.7.1: undefined reference to boost::filesystem::detail::path_algorithms::append_v3(boost::filesystem::path&, char const*, char const*)' /usr/bin/ld: ../src/libpinocchio.so.2.7.1: undefined reference toboost::filesystem::detail::path_algorithms::find_root_directory(boost::filesystem::path const&)' /usr/bin/ld: ../bindings/python/pinocchio/pinocchio_pywrap.cpython-38-x86_64-linux-gnu.so.2.7.1: undefined reference to `boost::python::instance_holder::allocate(_object*, unsigned long, unsigned long, unsigned long)' collect2: error: ld returned 1 exit status make[2]: [unittest/CMakeFiles/test-cpp-python_parser.dir/build.make:99: unittest/test-cpp-python_parser] Error 1 make[2]: Leaving directory '/home/ubuntu/hand/pinocchio/build' make[1]: [CMakeFiles/Makefile2:2076: unittest/CMakeFiles/test-cpp-python_parser.dir/all] Error 2 make[1]: Leaving directory '/home/ubuntu/hand/pinocchio/build' make: *** [Makefile:144: all] Error 2

System

i use the command dpkg -S /usr/include/boost/version.hpp and check the boost version of my system libboost1.71-dev:amd64: /usr/include/boost/version.hpp

nim65s commented 5 months ago

Can you provide the output of the env command ?

wzjscut commented 5 months ago

Can you provide the output of the env command ?

env
SHELL=/bin/bash
ROS_VERSION=1
SESSION_MANAGER=local/wzj:@/tmp/.ICE-unix/2659,unix/wzj:/tmp/.ICE-unix/2659
QT_ACCESSIBILITY=1
COLORTERM=truecolor
XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg
XDG_MENU_PREFIX=gnome-
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
CONDA_MKL_INTERFACE_LAYER_BACKUP=
GTK_IM_MODULE=fcitx
CONDA_EXE=/home/ubuntu/anaconda3/bin/conda
_CE_M=
PKG_CONFIG_PATH=/opt/ros/noetic/lib/pkgconfig:/opt/ros/noetic/lib/x86_64-linux-gnu/pkgconfig
ROS_PYTHON_VERSION=3
LANGUAGE=en_US:en
QT4_IM_MODULE=fcitx
LC_ADDRESS=en_HK.UTF-8
GNOME_SHELL_SESSION_MODE=ubuntu
LC_NAME=en_HK.UTF-8
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
XMODIFIERS=@im=fcitx
DESKTOP_SESSION=ubuntu
LC_MONETARY=en_HK.UTF-8
SSH_AGENT_PID=2616
ROS_PACKAGE_PATH=/opt/ros/noetic/share
XML_CATALOG_FILES=file:///home/ubuntu/anaconda3/envs/ros/etc/xml/catalog file:///etc/xml/catalog
GTK_MODULES=gail:atk-bridge
ROSLISP_PACKAGE_DIRECTORIES=
PWD=/home/ubuntu/hand/pinocchio
LOGNAME=ubuntu
XDG_SESSION_DESKTOP=ubuntu
XDG_SESSION_TYPE=x11
CONDA_PREFIX=/home/ubuntu/anaconda3/envs/ros
GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1
XAUTHORITY=/run/user/1000/gdm/Xauthority
GJS_DEBUG_TOPICS=JS ERROR;JS LOG
WINDOWPATH=2
HOME=/home/ubuntu
USERNAME=ubuntu
IM_CONFIG_PHASE=1
LC_PAPER=en_HK.UTF-8
LANG=en_US.UTF-8
ROS_ETC_DIR=/opt/ros/noetic/etc/ros
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
XDG_CURRENT_DESKTOP=ubuntu:GNOME
VTE_VERSION=6003
CONDA_PROMPT_MODIFIER=(ros) 
CMAKE_PREFIX_PATH=/opt/ros/noetic
GNOME_TERMINAL_SCREEN=/org/gnome/Terminal/screen/7eae121c_239a_4dc3_8a0d_751dfe21b8e5
INVOCATION_ID=c6b3c91a1b414ba7bb76572373519d2d
MANAGERPID=2501
CLUTTER_IM_MODULE=fcitx
GJS_DEBUG_OUTPUT=stderr
LESSCLOSE=/usr/bin/lesspipe %s %s
XDG_SESSION_CLASS=user
PYTHONPATH=/opt/ros/noetic/lib/python3/dist-packages::/home/ubuntu/hand/raisim/dgrasp/raisim/linux/lib
TERM=xterm-256color
LC_IDENTIFICATION=en_HK.UTF-8
_CE_CONDA=
LESSOPEN=| /usr/bin/lesspipe %s
USER=ubuntu
GNOME_TERMINAL_SERVICE=:1.240
CONDA_SHLVL=2
DISPLAY=:1
SHLVL=1
LC_TELEPHONE=en_HK.UTF-8
ROS_MASTER_URI=http://localhost:11311
QT_IM_MODULE=fcitx
LC_MEASUREMENT=en_HK.UTF-8
PAPERSIZE=a4
CONDA_PYTHON_EXE=/home/ubuntu/anaconda3/bin/python
LD_LIBRARY_PATH=/opt/ros/noetic/lib:/opt/ros/noetic/lib/x86_64-linux-gnu::/home/ubuntu/hand/raisim/dgrasp/raisim/linux/lib
XDG_RUNTIME_DIR=/run/user/1000
CONDA_DEFAULT_ENV=ros
LC_TIME=en_HK.UTF-8
JOURNAL_STREAM=8:103078
XDG_DATA_DIRS=/usr/share/ubuntu:/home/ubuntu/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
PATH=/opt/ros/noetic/bin:/home/ubuntu/anaconda3/envs/ros/bin:/home/ubuntu/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
GDMSESSION=ubuntu
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
CONDA_PREFIX_1=/home/ubuntu/anaconda3
ROS_ROOT=/opt/ros/noetic/share/ros
ROS_DISTRO=noetic
LC_NUMERIC=en_HK.UTF-8
MKL_INTERFACE_LAYER=LP64,GNU
OLDPWD=/home/ubuntu
_=/usr/bin/env
nim65s commented 5 months ago

You have conda in there, and it is possible that conda provide another boost version somewhere.

You must choose either

  1. using conda (and in this case you should not have things finding /usr/include/boost)
  2. not using conda ( and in this case, you should not have anything with "conda" in this env output)
abussy-aldebaran commented 3 months ago

Some additional infos.

I had the same problem. I was building in a conda environment where I had pinocchio installed with conda install pinocchio. conda correctly installed the boost dependencies, but cmake was finding boost in /usr/....

To correct this while using conda (option 1 above), I added -DCMAKE_FIND_PACKAGE_PREFER_CONFIG=True to the cmake command. This way, cmake finds the config.cmake files for boost in the conda env, and thus the boost version installed with conda.

Notes: This would probably also apply to all dependencies installed in the conda environment.

fabinsch commented 3 months ago

Hi @abussy-aldebaran,

I also encountered this before and for me it depends on which cmake I am using.

did you also conda install cmake in your activated conda environment? You can check by doing which cmake if you are using cmake from your env or another one.

If I use cmake from the corresponding env, it usually correctly finds boost/other desps in the env and not from my system somewhere else without additional flags. Maybe this can help.

jorisv commented 3 months ago

Hi @abussy-aldebaran,

You can also find a full working conda environment in this file https://github.com/stack-of-tasks/pinocchio/blob/master/.github/workflows/conda/environment_macos_linux.yml

It's the same used by the CI.

abussy-aldebaran commented 3 months ago

I'm using my system's cmake. I guess that if I want to build within a conda environment, I should go all the way and install the toolchain within the env.

Thanks @jorisv !