robotology / gz-sim-yarp-plugins

YARP plugins for Modern Gazebo (gz-sim).
BSD 3-Clause "New" or "Revised" License
8 stars 1 forks source link

Problem with CMake and YARP #9

Closed GiacomoBisio closed 1 year ago

GiacomoBisio commented 1 year ago

Sorry for the inconvenience, but I faced different problems in compiling the code and using the yarp server. Note that these problems happened only to me and not to my colleague Luca Pastore.

CMake Error at CMakeLists.txt:6 (find_package):
  By not providing "FindYARP.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "YARP", but
  CMake did not find one.

  Could not find a package configuration file provided by "YARP" with any of
  the following names:

    YARPConfig.cmake
    yarp-config.cmake

  Add the installation prefix of "YARP" to CMAKE_PREFIX_PATH or set
  "YARP_DIR" to a directory containing one of the above files.  If "YARP"
  provides a separate development package or SDK, be sure it has been
  installed.

-- Configuring incomplete, errors occurred!

Note that I followed the binary installation as in link_to_yarp_installation.

Call with --help for information on available options
Using port database: :memory:
Using subscription database: :memory:
IP address: default
Port number: 10000
Overriding non-local address for name server
PROBLEM: need to change settings in /home/giaco/.config/yarp/yarp.conf
  Current settings: host 192.168.224.1 port 10000 family yarp
  Desired settings:  host 192.168.235.180 port 10000 family yarp
Please specify '--write' if it is ok to overwrite current settings, or
Please specify '--read' to use the current settings, or
delete /home/giaco/.config/yarp/yarp.conf
[ERROR] Aborting.

Unfortunately, if I change /home/giaco/.config/yarp/yarp.conf with the desired setting it works momentarily, but then if I open a new terminal, the settings appears unchanged, and so I face the error again and again.

traversaro commented 1 year ago

First problem:

Interesting, can you return the output of the which yarp, which cmake and env commands? Also @lucapa17 installed YARP from .deb packages?

Second problem: Unfortunately, if I change /home/giaco/.config/yarp/yarp.conf with the desired setting it works momentarily, but then if I open a new terminal, the settings appears unchanged, and so I face the error again and again.

This happens also if you launch yarp server --write, as suggested by the error message?

GiacomoBisio commented 1 year ago

which yarp:

/usr/bin/yarp

which cmake:

/usr/bin/cmake

env:

SHELL=/bin/bash
WSL2_GUI_APPS_ENABLED=1
CONDA_EXE=/home/giaco/mambaforge/bin/conda
_CE_M=
WSL_DISTRO_NAME=Ubuntu
WT_SESSION=12abdfae-908c-477b-ae78-f7ffc6f29847
NAME=PC-di-Giacomo
PWD=/home/giaco
LOGNAME=giaco
HOME=/home/giaco
LANG=C.UTF-8
WSL_INTEROP=/run/WSL/185_interop
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:*.webp=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:
WAYLAND_DISPLAY=wayland-0
WINDOWS_HOST=192.168.224.1
LESSCLOSE=/usr/bin/lesspipe %s %s
TERM=xterm-256color
_CE_CONDA=
LESSOPEN=| /usr/bin/lesspipe %s
USER=giaco
CONDA_SHLVL=0
DISPLAY=:0
SHLVL=1
CONDA_PYTHON_EXE=/home/giaco/mambaforge/bin/python
XDG_RUNTIME_DIR=/mnt/wslg/runtime-dir
WSLENV=WT_SESSION::WT_PROFILE_ID
XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share:/usr/share:/var/lib/snapd/desktop
PATH=/home/giaco/.local/bin:/home/giaco/mambaforge/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/snap/bin
HOSTTYPE=x86_64
PULSE_SERVER=unix:/mnt/wslg/PulseServer
WT_PROFILE_ID={2c4de342-38b7-51cf-b940-2309a097f518}
_=/usr/bin/env

Also @lucapa17 installed YARP from .deb packages?

Yes, we followed the same installation path

Second problem:

This happens also if you launch yarp server --write, as suggested by the error message?

Ok, now it works, but in order to send simple messages using write/read ports I have to do the following commands:

Moreover, I have to use yarp detect --write even when I want to use yarp name list.

traversaro commented 1 year ago

Do you want to quickly debug this together? I am available from 14:00 to 14:30 and 15:00 to 16:00 .

GiacomoBisio commented 1 year ago

It's ok for me! I should be available from 15.15. As usual on Teams right?

traversaro commented 1 year ago

Ok!

GiacomoBisio commented 1 year ago

Problem solved! Thanks again to @traversaro for helping me

traversaro commented 1 year ago

Problem solved! Thanks again to @traversaro for helping me

For future reference, it is a good idea to briefly explain how we solved the problem (to avoid the problem https://xkcd.com/979/):

First problem:

The problem was that project was placed after find_package(YARP). All CMake code should go after cmake_minimu_version_required and project calls.

Second problem:

@GiacomoBisio had in his .bashrc a call to yarp conf, added following the docs in https://github.com/robotology/robotology-superbuild#connect-to-a-yarp-server-on-a-windows-host-on-wsl , that was resetting the expected yarpserver ip address every time a new terminal was opened. However, that is only useful if the yarpserver is running on Windows itself, not on WSL. We opened https://github.com/robotology/robotology-superbuild/pull/1412 to improve the docs.