robotology / idyntree-yarp-tools

Tools based on the iDynTree library that depend on YARP.
GNU Lesser General Public License v2.1
6 stars 2 forks source link

Compilation fails on Ubuntu 20 with latest YARP master version #13

Closed S-Dafarra closed 3 years ago

S-Dafarra commented 3 years ago

Here the error:

[ 93%] Building CXX object src/modules/idyntree-yarp-visualizer/CMakeFiles/idyntree-yarp-visualizer.dir/thrifts/VisualizerCommands.cpp.o
[100%] Linking CXX executable ../../../bin/idyntree-yarp-visualizer
/usr/bin/ld: CMakeFiles/idyntree-yarp-visualizer.dir/thrifts/VisualizerCommands.cpp.o: in function `VisualizerCommands::setBasePosition(double, double, double)':
VisualizerCommands.cpp:(.text+0x41a0): undefined reference to `yarp::os::WireLink::write(yarp::os::PortWriter const&, yarp::os::PortReader&) const'
/usr/bin/ld: CMakeFiles/idyntree-yarp-visualizer.dir/thrifts/VisualizerCommands.cpp.o: in function `VisualizerCommands::setBaseRotation(double, double, double)':
VisualizerCommands.cpp:(.text+0x4300): undefined reference to `yarp::os::WireLink::write(yarp::os::PortWriter const&, yarp::os::PortReader&) const'
/usr/bin/ld: CMakeFiles/idyntree-yarp-visualizer.dir/thrifts/VisualizerCommands.cpp.o: in function `VisualizerCommands::setBasePose(double, double, double, double, double, double)':
VisualizerCommands.cpp:(.text+0x446c): undefined reference to `yarp::os::WireLink::write(yarp::os::PortWriter const&, yarp::os::PortReader&) const'
/usr/bin/ld: CMakeFiles/idyntree-yarp-visualizer.dir/thrifts/VisualizerCommands.cpp.o: in function `VisualizerCommands::reconnectToRobot[abi:cxx11]()':
VisualizerCommands.cpp:(.text+0x45f7): undefined reference to `yarp::os::WireLink::write(yarp::os::PortWriter const&, yarp::os::PortReader&) const'
/usr/bin/ld: CMakeFiles/idyntree-yarp-visualizer.dir/thrifts/VisualizerCommands.cpp.o: in function `VisualizerCommands::getCameraPosition()':
VisualizerCommands.cpp:(.text+0x49b6): undefined reference to `yarp::os::WireLink::write(yarp::os::PortWriter const&, yarp::os::PortReader&) const'
/usr/bin/ld: CMakeFiles/idyntree-yarp-visualizer.dir/thrifts/VisualizerCommands.cpp.o:VisualizerCommands.cpp:(.text+0x4c96): more undefined references to `yarp::os::WireLink::write(yarp::os::PortWriter const&, yarp::os::PortReader&) const' follow
/usr/bin/ld: ../../../lib/libreadonlyremotecontrolboard.a(jointData.cpp.o): in function `yarp::dev::impl::jointData::Editor::read(yarp::os::ConnectionReader&)':
jointData.cpp:(.text+0x507a): undefined reference to `yarp::os::idl::WireWriter::writeVocab32(int) const'
collect2: error: ld returned 1 exit status
make[2]: *** [src/modules/idyntree-yarp-visualizer/CMakeFiles/idyntree-yarp-visualizer.dir/build.make:151: bin/idyntree-yarp-visualizer] Error 1
make[1]: *** [CMakeFiles/Makefile2:303: src/modules/idyntree-yarp-visualizer/CMakeFiles/idyntree-yarp-visualizer.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

I tried on Ubuntu 20.04 using yarp at https://github.com/robotology/yarp/commit/e985634c867aaf108a931c27c77b7d3775d8f133

traversaro commented 3 years ago

Did you tested this after https://github.com/robotology/idyntree-yarp-tools/pull/11 ? The problem seems to be related to jointData.cpp. Could it be that the vendored jointData.cpp was not updated and so does not work with latest YARP? In that case https://github.com/robotology/idyntree-yarp-tools/pull/11 could fix the problem.

S-Dafarra commented 3 years ago

Did you tested this after #11 ? The problem seems to be related to jointData.cpp. Could it be that the vendored jointData.cpp was not updated and so does not work with latest YARP? In that case #11 could fix the problem.

Yes, I do have the same error

[100%] Linking CXX executable ../../../bin/idyntree-yarp-visualizer
/usr/bin/ld: CMakeFiles/idyntree-yarp-visualizer.dir/thrifts/VisualizerCommands.cpp.o: in function `VisualizerCommands::setBasePosition(double, double, double)':
/home/sdafarra/Software/idyntree-yarp-tools/build/src/modules/idyntree-yarp-visualizer/thrifts/VisualizerCommands.cpp:365: undefined reference to `yarp::os::WireLink::write(yarp::os::PortWriter const&, yarp::os::PortReader&) const'
/usr/bin/ld: CMakeFiles/idyntree-yarp-visualizer.dir/thrifts/VisualizerCommands.cpp.o: in function `VisualizerCommands::setBaseRotation(double, double, double)':
/home/sdafarra/Software/idyntree-yarp-tools/build/src/modules/idyntree-yarp-visualizer/thrifts/VisualizerCommands.cpp:375: undefined reference to `yarp::os::WireLink::write(yarp::os::PortWriter const&, yarp::os::PortReader&) const'
/usr/bin/ld: CMakeFiles/idyntree-yarp-visualizer.dir/thrifts/VisualizerCommands.cpp.o: in function `VisualizerCommands::setBasePose(double, double, double, double, double, double)':
/home/sdafarra/Software/idyntree-yarp-tools/build/src/modules/idyntree-yarp-visualizer/thrifts/VisualizerCommands.cpp:385: undefined reference to `yarp::os::WireLink::write(yarp::os::PortWriter const&, yarp::os::PortReader&) const'
/usr/bin/ld: CMakeFiles/idyntree-yarp-visualizer.dir/thrifts/VisualizerCommands.cpp.o: in function `VisualizerCommands::reconnectToRobot[abi:cxx11]()':
/home/sdafarra/Software/idyntree-yarp-tools/build/src/modules/idyntree-yarp-visualizer/thrifts/VisualizerCommands.cpp:395: undefined reference to `yarp::os::WireLink::write(yarp::os::PortWriter const&, yarp::os::PortReader&) const'
/usr/bin/ld: CMakeFiles/idyntree-yarp-visualizer.dir/thrifts/VisualizerCommands.cpp.o: in function `VisualizerCommands::getCameraPosition()':
/home/sdafarra/Software/idyntree-yarp-tools/build/src/modules/idyntree-yarp-visualizer/thrifts/VisualizerCommands.cpp:405: undefined reference to `yarp::os::WireLink::write(yarp::os::PortWriter const&, yarp::os::PortReader&) const'
/usr/bin/ld: CMakeFiles/idyntree-yarp-visualizer.dir/thrifts/VisualizerCommands.cpp.o:/home/sdafarra/Software/idyntree-yarp-tools/build/src/modules/idyntree-yarp-visualizer/thrifts/VisualizerCommands.cpp:415: more undefined references to `yarp::os::WireLink::write(yarp::os::PortWriter const&, yarp::os::PortReader&) const' follow
collect2: error: ld returned 1 exit status
make[2]: *** [src/modules/idyntree-yarp-visualizer/CMakeFiles/idyntree-yarp-visualizer.dir/build.make:151: bin/idyntree-yarp-visualizer] Error 1
make[1]: *** [CMakeFiles/Makefile2:303: src/modules/idyntree-yarp-visualizer/CMakeFiles/idyntree-yarp-visualizer.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

It seems related to the thrift generation :thinking:

traversaro commented 3 years ago

Seems to be related to this: https://github.com/robotology/yarp/pull/2616 . Can you compile with make VERBOSE=1 so that we get the exact linker command for Linking CXX executable ../../../bin/idyntree-yarp-visualizer ? In this way we can get the YARP library that is being use to link, and via nm we can actually check if yarp::os::WireLink::write(yarp::os::PortWriter const&, yarp::os::PortReader&) const is there or not. It seems like if a YARP version different from the one used to generate the thrift is linked.

S-Dafarra commented 3 years ago

It seems like if a YARP version different from the one used to generate the thrift is linked.

That was indeed the problem. I switched back to the 3.4 version of yarp. Then it was compiling. I then uninstalled, changed branch to master, installed again. Then, with a clean build, running cmake for idyntree-yarp-tools fails with the message

-- The CXX compiler identification is GNU 9.3.0
-- The C compiler identification is GNU 9.3.0
-- Check for working CXX compiler: /usr/lib/ccache/c++
-- Check for working CXX compiler: /usr/lib/ccache/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/lib/ccache/cc
-- Check for working C compiler: /usr/lib/ccache/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found YCM: /home/sdafarra/Software/robotology-superbuild/build/install/share/cmake/YCM (found version "0.13.20210707.2-20210707.2+gite17e55a")
CMake Error at /home/sdafarra/Software/robotology-superbuild/build/install/lib/cmake/YARP_os/YARP_osTargets.cmake:87 (message):
  The imported target "YARP::YARP_os" references the file

     "/home/sdafarra/Software/robotology-superbuild/build/install/lib/libYARP_os.so.3.4.1"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/home/sdafarra/Software/robotology-superbuild/build/install/lib/cmake/YARP_os/YARP_osTargets.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  /home/sdafarra/Software/robotology-superbuild/build/install/lib/cmake/YARP_os/YARP_osConfig.cmake:20 (include)
  /home/sdafarra/Software/robotology-superbuild/build/install/lib/cmake/YARP/YARPConfig.cmake:162 (find_package)
  CMakeLists.txt:63 (find_package)

-- Configuring incomplete, errors occurred!

I will try to delete the superbuild install folder.

S-Dafarra commented 3 years ago

I will try to delete the superbuild install folder.

I ran into https://github.com/robotology/robotology-superbuild/issues/819

traversaro commented 3 years ago

@S-Dafarra compilation seems to be working more and less fine in this repo. I guess this was something related to your setup, could it make sense to close the issue unless it emerges again?

S-Dafarra commented 3 years ago

Yes, sounds good!