Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update code in the extern directory #26

Closed
traversaro opened this issue Dec 21, 2020 · 30 comments
Closed

Update code in the extern directory #26

traversaro opened this issue Dec 21, 2020 · 30 comments

Comments

@traversaro
Copy link
Member

The code in the extern directory is extracted from the MT Software Suite distributed by Xsens, see https://github.com/robotology/yarp-device-xsensmt/blob/master/extern/CMakeLists.txt#L5 . The last time we updated it was in 2018 with the version 4.8.2 .

As we are experiencing now some problems in using this device with yarp-device-xsensmt, it is probably worth to try to update it.

@traversaro
Copy link
Member Author

cc @Nicogene @violadelbono

@traversaro
Copy link
Member Author

I gave it a shot in https://github.com/robotology/yarp-device-xsensmt/compare/update/2020.0.2 .

Unfortunately the API changed a lot, and Xsens switched to recommend a callback-based API that is actually much better that the polling that we used until now, but migrating to that one will probably take a bit more time. For the time being, I tried to migrate from the old API to the new API, but I did a lot of cargo cult changes until it compiled, so it is perfectly possible that is not working fine.

@traversaro
Copy link
Member Author

fyi @prashanthr05

@HosameldinMohamed
Copy link
Contributor

@traversaro I was coming here to open the same issue! 😄
I am trying to interface a device MTi-680G, and I couldn't make it work with the current API in this repo.

Reading through the documents and the code, the API was indeed renovated. And it makes more sense now to have the update to version 2022.0.0. I'll try to draft a working version.

@traversaro
Copy link
Member Author

I'll try to draft a working version.

Can you try to use the branch https://github.com/robotology/yarp-device-xsensmt/compare/update/2020.0.2 and perhaps solve the conflics w.r.t. to the existing master? I think back in time it was compiling fine, but probably in the end we never tested on the real sensor, so it may be worth to start from that.

@traversaro
Copy link
Member Author

By the way it seems that in the meanwhile several new versions of the API have been released, see https://mtidocs.xsens.com/release-notes-change-logs, so it could make sense to use those. Also https://base.xsens.com/s/article/Open-source-XDA-Xsens-Device-API?language=en_US seems relevant, even if I not fully understand the relation between the API that we were using and this XDA Xsens Device API.

@HosameldinMohamed
Copy link
Contributor

By the way it seems that in the meanwhile several new versions of the API have been released, see https://mtidocs.xsens.com/release-notes-change-logs, so it could make sense to use those. Also https://base.xsens.com/s/article/Open-source-XDA-Xsens-Device-API?language=en_US seems relevant, even if I not fully understand the relation between the API that we were using and this XDA Xsens Device API.

I haven't checked the details of the API were are using,

However, I downloaded the latest API they have (version 2022.0.0), and it contains precompiled shared libraries and header files, so that you can compile your application against them. At the same time, they provide a "public" code, which includes also the .c and .cpp files. I think they refer to the latter as the "Open Source XDA".

They also include detailed documentation as local html files

See the screenshot of the the files contnents.

image

Here's a screenshot of the overview page of the documentation they provide..

image

@HosameldinMohamed
Copy link
Contributor

Regarding the examples they have, they have 2 sets of examples (concerning the MTi devices in C++): the xda_cpp and the xda_public_cpp. The first is compiled against the pre-compiled libraries and second is compiled with the open-source code.

I compiled the SDK and tested it with the examples. xda_cpp runs with no issues. While xda_public_cpp gets stuck at Scanning for devices.

@traversaro
Copy link
Member Author

The "public" code seems the one that back in time we included in the extern directory of this repo.

@HosameldinMohamed
Copy link
Contributor

The "public" code seems the one that back in time we included in the extern directory of this repo.

Mmmmm, are you sure? For example, the method XsScanner::scanPorts() doesn't exist in the one we are using,, and many others, assuming the files included in the extern directory contain all the relevant API.

By the way, example files .../xda_cpp/example_mti_receive_data.cpp and .../xda_public_cpp/example_mti_receive_data.cpp are almost the same, excluding the include section at the top, and other minor differences.

image

@traversaro
Copy link
Member Author

The "public" code seems the one that back in time we included in the extern directory of this repo.

Mmmmm, are you sure? For example, the method XsScanner::scanPorts() doesn't exist in the one we are using,, and many others, assuming the files included in the extern directory contain all the relevant API.

Sorry, I was not clear. I meant that it is the one corresponding to the code that back in time we imported in extern. Then, the API changed and so changed also the "public" code, see for example in th 2020.02 the code that you mentioned is there: https://github.com/robotology/yarp-device-xsensmt/compare/update/2020.0.2#diff-7354e6bffae4e567120f41cda43366ec42d05456c0a2a3eee0abcd5b488088f2R84 .

@HosameldinMohamed
Copy link
Contributor

HosameldinMohamed commented Feb 28, 2023

I'll try to draft a working version.

Can you try to use the branch https://github.com/robotology/yarp-device-xsensmt/compare/update/2020.0.2 and perhaps solve the conflics w.r.t. to the existing master? I think back in time it was compiling fine, but probably in the end we never tested on the real sensor, so it may be worth to start from that.

I started from the branch and fixed some conflicts. There are still some mixed logic between the master and the branch that probably needs to be checked.

But focusing on the compilation compilation and running. The devices compiles with no errors, but when trying to run it throws the following errors:

[DEBUG] |yarp.devices.ServerInertial| Subdevice xsensmt
[ERROR] |yarp.os.YarpPluginSettings| Error while opening /home/hosameldin/code/robotology-superbuild/build/install/lib/yarp/xsensmt.so:
  /home/hosameldin/code/robotology-superbuild/build/install/lib/yarp/xsensmt.so: undefined symbol: _ZTIN5xsens14StandardThreadE
[ERROR] |yarp.os.YarpPluginSettings| Error while opening /home/hosameldin/code/robotology-superbuild/build/install/lib/yarp/xsensmt.so:
  /home/hosameldin/code/robotology-superbuild/build/install/lib/yarp/xsensmt.so: undefined symbol: _ZTIN5xsens14StandardThreadE
[ERROR] |yarp.os.YarpPluginSettings| Error while opening /home/hosameldin/code/robotology-superbuild/build/install/lib/yarp/xsensmt.so:
  /home/hosameldin/code/robotology-superbuild/build/install/lib/yarp/xsensmt.so: undefined symbol: _ZTIN5xsens14StandardThreadE
[ERROR] |yarp.os.YarpPluginSettings| Error while opening /home/hosameldin/code/robotology-superbuild/build/install/lib/yarp/xsensmt.so:
  /home/hosameldin/code/robotology-superbuild/build/install/lib/yarp/xsensmt.so: undefined symbol: _ZTIN5xsens14StandardThreadE
[ERROR] |yarp.os.YarpPluginSettings| Error while opening /home/hosameldin/code/robotology-superbuild/build/install/lib/yarp/xsensmt.so:
  /home/hosameldin/code/robotology-superbuild/build/install/lib/yarp/xsensmt.so: undefined symbol: _ZTIN5xsens14StandardThreadE
[ERROR] |yarp.os.YarpPluginSettings| Error while opening /home/hosameldin/code/robotology-superbuild/build/install/lib/yarp/xsensmt.so:
  /home/hosameldin/code/robotology-superbuild/build/install/lib/yarp/xsensmt.so: undefined symbol: _ZTIN5xsens14StandardThreadE
[ERROR] |yarp.os.YarpPluginSettings| Error while opening /home/hosameldin/code/robotology-superbuild/build/install/lib/yarp/xsensmt.so:
  /home/hosameldin/code/robotology-superbuild/build/install/lib/yarp/xsensmt.so: undefined symbol: _ZTIN5xsens14StandardThreadE
[ERROR] |yarp.os.YarpPluginSettings| Error while opening /home/hosameldin/code/robotology-superbuild/build/install/lib/yarp/xsensmt.so:
  /home/hosameldin/code/robotology-superbuild/build/install/lib/yarp/xsensmt.so: undefined symbol: _ZTIN5xsens14StandardThreadE
[WARNING] |yarp.os.YarpPluginSettings| Cannot load plugin from shared library (xsensmt)
[WARNING] |yarp.os.YarpPluginSettings| (xsensmt: cannot open shared object file: No such file or directory
xsensmt.so: cannot open shared object file: No such file or directory
libxsensmt.so: cannot open shared object file: No such file or directory)

The Demangler shows the symbols are related to xsens::StandardThread.

I tried adding add_compile_options(-pthread) to CMake but it still did not solve the issue.

Branch: https://github.com/HosameldinMohamed/yarp-device-xsensmt/tree/update/2020.0.2

@traversaro
Copy link
Member Author

Those class is defined in https://github.com/HosameldinMohamed/yarp-device-xsensmt/blob/update/2020.0.2/extern/xspublic/xscommon/threading.cpp, that is included in the static library https://github.com/HosameldinMohamed/yarp-device-xsensmt/blob/update/2020.0.2/extern/CMakeLists.txt#L16 . Can you check if that symbol can be found in the library, by doing something like:

cd yarp-device-xsensmt
cd build
nm -s ./lib/libxscommon.a | grep _ZTIN5xsens14StandardThreadE 

?

@HosameldinMohamed
Copy link
Contributor

Those class is defined in https://github.com/HosameldinMohamed/yarp-device-xsensmt/blob/update/2020.0.2/extern/xspublic/xscommon/threading.cpp, that is included in the static library https://github.com/HosameldinMohamed/yarp-device-xsensmt/blob/update/2020.0.2/extern/CMakeLists.txt#L16 . Can you check if that symbol can be found in the library, by doing something like:

cd yarp-device-xsensmt
cd build
nm -s ./lib/libxscommon.a | grep _ZTIN5xsens14StandardThreadE 

?

In the <build-of-yarp-device-xsensmt>/extern there's a libxscommon.a

running nm -s libxscommon.a | grep _ZTIN5xsens14StandardThreadE: gives:

_ZTIN5xsens14StandardThreadE in threading.cpp.o
0000000000000000 V _ZTIN5xsens14StandardThreadE
                 U _ZTIN5xsens14StandardThreadE

@traversaro
Copy link
Member Author

If you want, we can debug this together today.

@HosameldinMohamed
Copy link
Contributor

With @traversaro we debugged the problem, after handling the dependencies in CMakeLists.txt (https://github.com/robotology/yarp-device-xsensmt/blob/update/2020.0.2/extern/CMakeLists.txt), to handle the dependence of the libraries xstypes, xscommon and xscontroller on each other.

CMakeLists of xspublic
# Globbing should be avoided in general, but this is a library that we use directly as provided by Xsens 
file(GLOB xstypes_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/xspublic/xstypes/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/xspublic/xstypes/*.c)
# See EXCLUDE argument in xstypes' Makefile
list(FILTER xstypes_SRCS EXCLUDE REGEX "xstypesdynlib")
add_library(xstypes STATIC ${xstypes_SRCS})
target_include_directories(xstypes PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/xspublic)
target_include_directories(xstypes PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/xspublic/xstypes)


file(GLOB xscommon_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/xspublic/xscommon/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/xspublic/xscommon/*.c)
add_library(xscommon STATIC ${xscommon_SRCS})
target_include_directories(xscommon PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/xspublic)
target_include_directories(xscommon PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/xspublic/xscommon)
target_compile_options(xscommon PRIVATE "SHELL:-include xscommon_config.h" "SHELL:-include xstypes/xsens_compat.h")
target_link_libraries(xscommon PUBLIC xstypes)


file(GLOB xscontroller_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/xspublic/xscontroller/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/xspublic/xscontroller/*.c)
add_library(xscontroller STATIC ${xscontroller_SRCS})
target_include_directories(xscontroller PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/xspublic)
target_include_directories(xscontroller PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/xspublic/xscontroller)
target_compile_options(xscontroller PRIVATE "SHELL:-include xscontrollerconfig.h")
target_compile_definitions(xscontroller PRIVATE -DHAVE_JOURNALLER)
target_link_libraries(xscontroller PUBLIC xstypes xscommon)

find_package (Threads)

add_library(xsens_mt_software_suite INTERFACE)
target_link_libraries(xsens_mt_software_suite INTERFACE xstypes xscommon xscontroller)

The error becaume looking for the symbol gJournal.

Solved by adding

Journaller* gJournal;

In XsensMT.cpp (https://github.com/robotology/yarp-device-xsensmt/blob/update/2020.0.2/xsensmt/XsensMT.cpp)

See https://movella.my.site.com/XsensKnowledgebase/s/question/0D50900002dCD2CCAW/use-sdk-with-cmakelisttxt-qt-framework?language=en_US

@HosameldinMohamed
Copy link
Contributor

I'm testing the software with my Linux PC and the MTi-680G device, the software gets stuck at

if (!m_xsensCommunicator.openPort(m_portInfo))

Concerning #26 (comment) The issue seems to be one of the three:

  1. Some hardware/setup issue.
  2. Some bug in the public source code.
  3. Some bug in the way we are compiling it.

@HosameldinMohamed
Copy link
Contributor

With @traversaro we debugged the issue #26 (comment)

The debugging consists of:

  • Using the debugger of Kdevelop, to debug the executable of the example provided by the Xsens, we found that the execution is blocked (I guess by busy waiting), When returning from the function:
XsResultValue Scanner::fetchBasicInfo(XsPortInfo& portInfo, uint32_t singleScanTimeout, bool detectRs485)

The debugger was showing the other 4 threads running at that point, then it gets stuck.

Library CMakeLists file contents
# Globbing should be avoided in general, but this is a library that we use directly as provided by Xsens 
file(GLOB xstypes_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/xspublic/xstypes/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/xspublic/xstypes/*.c)
# See EXCLUDE argument in xstypes' Makefile
list(FILTER xstypes_SRCS EXCLUDE REGEX "xstypesdynlib")
add_library(xstypes STATIC ${xstypes_SRCS})
target_include_directories(xstypes PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/xspublic)
target_include_directories(xstypes PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/xspublic/xstypes)


file(GLOB xscommon_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/xspublic/xscommon/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/xspublic/xscommon/*.c)
add_library(xscommon STATIC ${xscommon_SRCS})
target_include_directories(xscommon PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/xspublic)
target_include_directories(xscommon PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/xspublic/xscommon)
target_compile_options(xscommon PRIVATE "SHELL:-include xscommon_config.h" "SHELL:-include xstypes/xsens_compat.h")
target_link_libraries(xscommon PUBLIC xstypes)


file(GLOB xscontroller_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/xspublic/xscontroller/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/xspublic/xscontroller/*.c)
add_library(xscontroller STATIC ${xscontroller_SRCS})
target_include_directories(xscontroller PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/xspublic)
target_include_directories(xscontroller PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/xspublic/xscontroller)
target_compile_options(xscontroller PRIVATE "SHELL:-include xscontrollerconfig.h")
target_compile_definitions(xscontroller PRIVATE -DHAVE_JOURNALLER)
target_link_libraries(xscontroller PUBLIC xstypes xscommon)

find_package (Threads)

add_library(xsens_mt_software_suite INTERFACE)
target_link_libraries(xsens_mt_software_suite INTERFACE xstypes xscommon xscontroller)

Then the executable is linked with the compiled libraries (xsens_mt_software_suite)

@HosameldinMohamed
Copy link
Contributor

Interestingly, When trying to move the example to this Repo and try to compile it along with the YARP device xsensmt. It throughs linking errors:

Linking errors
≻ make install -j4
-- Found YARP: /home/hosameldin/code/robotology-superbuild/build/install/lib/cmake/YARP (found version "3.7.2")
CMake Deprecation Warning at /home/hosameldin/code/robotology-superbuild/build/install/lib/cmake/YARP/YARPConfig.cmake:280 (message):
  The YARP_MODULE_PATH variable is deprecated.  CMake find package modules
  are now in YCM.
Call Stack (most recent call first):
  CMakeLists.txt:9223372036854775807 (_yarp_module_path_is_deprecated)
  CMakeLists.txt:12 (list)


--  [x] Plugin: xsensmt (ENABLE_xsensmt)
CMake Deprecation Warning at /home/hosameldin/code/robotology-superbuild/build/install/lib/cmake/YARP/YARPConfig.cmake:223 (message):
  The YARP_INCLUDE_DIRS variable is deprecated
Call Stack (most recent call first):
  xsensmt/CMakeLists.txt:9223372036854775807 (_yarp_deprecated_variable_warning)
  xsensmt/CMakeLists.txt:21 (target_include_directories)


-- Configuring done
-- Generating done
-- Build files have been written to: /home/hosameldin/code/robotology-superbuild/build/src/yarp-device-xsensmt
[ 39%] Built target xstypes
[ 51%] Built target xscommon
[ 96%] Built target xscontroller
[ 97%] Linking CXX executable xsensExample
[ 98%] Linking CXX shared module ../lib/yarp/xsensmt.so
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: CMakeFiles/xsensExample.dir/exampleScanDevicesAndReceiveData.cpp.o: in function `CallbackHandler::~CallbackHandler()':
exampleScanDevicesAndReceiveData.cpp:(.text._ZN15CallbackHandlerD2Ev[_ZN15CallbackHandlerD5Ev]+0x71): undefined reference to `pthread_mutexattr_destroy'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: CMakeFiles/xsensExample.dir/exampleScanDevicesAndReceiveData.cpp.o: in function `CallbackHandler::~CallbackHandler()':
exampleScanDevicesAndReceiveData.cpp:(.text._ZN15CallbackHandlerD0Ev[_ZN15CallbackHandlerD5Ev]+0x67): undefined reference to `pthread_mutexattr_destroy'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: CMakeFiles/xsensExample.dir/exampleScanDevicesAndReceiveData.cpp.o: in function `main':
exampleScanDevicesAndReceiveData.cpp:(.text.startup.main+0x911): undefined reference to `pthread_mutexattr_init'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: exampleScanDevicesAndReceiveData.cpp:(.text.startup.main+0x91f): undefined reference to `pthread_mutexattr_settype'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscontroller.a(callbackmanagerxda.cpp.o): in function `CallbackManagerXda::CallbackManagerXda() [clone .cold]':
callbackmanagerxda.cpp:(.text.unlikely._ZN18CallbackManagerXdaC2Ev+0xe): undefined reference to `pthread_mutexattr_destroy'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscontroller.a(callbackmanagerxda.cpp.o): in function `CallbackManagerXda::CallbackManagerXda()':
callbackmanagerxda.cpp:(.text._ZN18CallbackManagerXdaC2Ev+0x1b8): undefined reference to `pthread_mutexattr_init'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: callbackmanagerxda.cpp:(.text._ZN18CallbackManagerXdaC2Ev+0x1c6): undefined reference to `pthread_mutexattr_settype'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscontroller.a(callbackmanagerxda.cpp.o): in function `CallbackManagerXda::~CallbackManagerXda()':
callbackmanagerxda.cpp:(.text._ZN18CallbackManagerXdaD2Ev+0x52): undefined reference to `pthread_mutexattr_destroy'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscontroller.a(xscontrol_def.cpp.o): in function `XsControl::XsControl() [clone .cold]':
xscontrol_def.cpp:(.text.unlikely._ZN9XsControlC2Ev+0x29): undefined reference to `pthread_mutexattr_destroy'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: xscontrol_def.cpp:(.text.unlikely._ZN9XsControlC2Ev+0x47): undefined reference to `pthread_mutexattr_destroy'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscontroller.a(xscontrol_def.cpp.o): in function `XsControl::XsControl()':
xscontrol_def.cpp:(.text._ZN9XsControlC2Ev+0x133): undefined reference to `pthread_mutexattr_init'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: xscontrol_def.cpp:(.text._ZN9XsControlC2Ev+0x141): undefined reference to `pthread_mutexattr_settype'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: xscontrol_def.cpp:(.text._ZN9XsControlC2Ev+0x1bc): undefined reference to `pthread_mutexattr_init'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: xscontrol_def.cpp:(.text._ZN9XsControlC2Ev+0x1ca): undefined reference to `pthread_mutexattr_settype'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscontroller.a(xscontrol_def.cpp.o): in function `XsControl::~XsControl()':
xscontrol_def.cpp:(.text._ZN9XsControlD2Ev+0xe7): undefined reference to `pthread_mutexattr_destroy'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: xscontrol_def.cpp:(.text._ZN9XsControlD2Ev+0x116): undefined reference to `pthread_mutexattr_destroy'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscontroller.a(xsdevice_def.cpp.o): in function `xsens::GuardedMutex::~GuardedMutex()':
xsdevice_def.cpp:(.text._ZN5xsens12GuardedMutexD2Ev[_ZN5xsens12GuardedMutexD5Ev]+0x1d): undefined reference to `pthread_mutexattr_destroy'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: xsdevice_def.cpp:(.text._ZN5xsens12GuardedMutexD2Ev[_ZN5xsens12GuardedMutexD5Ev]+0x46): undefined reference to `pthread_mutexattr_destroy'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscontroller.a(xsdevice_def.cpp.o): in function `XsDevice::~XsDevice()':
xsdevice_def.cpp:(.text._ZN8XsDeviceD2Ev+0x2a5): undefined reference to `pthread_mutexattr_destroy'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscontroller.a(xsdevice_def.cpp.o):xsdevice_def.cpp:(.text._ZN8XsDeviceD2Ev+0x2bb): more undefined references to `pthread_mutexattr_destroy' follow
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscontroller.a(xsdevice_def.cpp.o): in function `XsDevice::XsDevice(XsDeviceId const&)':
xsdevice_def.cpp:(.text._ZN8XsDeviceC2ERK10XsDeviceId+0x61): undefined reference to `pthread_mutexattr_init'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: xsdevice_def.cpp:(.text._ZN8XsDeviceC2ERK10XsDeviceId+0x6f): undefined reference to `pthread_mutexattr_settype'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: xsdevice_def.cpp:(.text._ZN8XsDeviceC2ERK10XsDeviceId+0xe7): undefined reference to `pthread_mutexattr_init'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: xsdevice_def.cpp:(.text._ZN8XsDeviceC2ERK10XsDeviceId+0xf5): undefined reference to `pthread_mutexattr_settype'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: xsdevice_def.cpp:(.text._ZN8XsDeviceC2ERK10XsDeviceId+0x123): undefined reference to `pthread_mutexattr_init'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: xsdevice_def.cpp:(.text._ZN8XsDeviceC2ERK10XsDeviceId+0x131): undefined reference to `pthread_mutexattr_settype'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscontroller.a(xsdevice_def.cpp.o): in function `XsDevice::XsDevice(Communicator*) [clone .cold]':
xsdevice_def.cpp:(.text.unlikely._ZN8XsDeviceC2EP12Communicator+0xa3): undefined reference to `pthread_mutexattr_destroy'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: xsdevice_def.cpp:(.text.unlikely._ZN8XsDeviceC2EP12Communicator+0xe6): undefined reference to `pthread_mutexattr_destroy'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscontroller.a(xsdevice_def.cpp.o): in function `XsDevice::XsDevice(Communicator*)':
xsdevice_def.cpp:(.text._ZN8XsDeviceC2EP12Communicator+0x68): undefined reference to `pthread_mutexattr_init'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: xsdevice_def.cpp:(.text._ZN8XsDeviceC2EP12Communicator+0x76): undefined reference to `pthread_mutexattr_settype'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: xsdevice_def.cpp:(.text._ZN8XsDeviceC2EP12Communicator+0xee): undefined reference to `pthread_mutexattr_init'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: xsdevice_def.cpp:(.text._ZN8XsDeviceC2EP12Communicator+0xfc): undefined reference to `pthread_mutexattr_settype'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: xsdevice_def.cpp:(.text._ZN8XsDeviceC2EP12Communicator+0x12a): undefined reference to `pthread_mutexattr_init'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: xsdevice_def.cpp:(.text._ZN8XsDeviceC2EP12Communicator+0x138): undefined reference to `pthread_mutexattr_settype'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscontroller.a(communicator.cpp.o): in function `Communicator::~Communicator()':
communicator.cpp:(.text._ZN12CommunicatorD2Ev+0x41): undefined reference to `pthread_mutexattr_destroy'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscontroller.a(communicator.cpp.o): in function `Communicator::Communicator() [clone .cold]':
communicator.cpp:(.text.unlikely._ZN12CommunicatorC2Ev+0x29): undefined reference to `pthread_mutexattr_destroy'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscontroller.a(communicator.cpp.o): in function `Communicator::Communicator()':
communicator.cpp:(.text._ZN12CommunicatorC2Ev+0x166): undefined reference to `pthread_mutexattr_init'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: communicator.cpp:(.text._ZN12CommunicatorC2Ev+0x174): undefined reference to `pthread_mutexattr_settype'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscontroller.a(replymonitor.cpp.o): in function `xsens::ReplyMonitor::~ReplyMonitor()':
replymonitor.cpp:(.text._ZN5xsens12ReplyMonitorD2Ev+0x2b): undefined reference to `pthread_mutexattr_destroy'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscontroller.a(replymonitor.cpp.o): in function `xsens::ReplyMonitor::ReplyMonitor()':
replymonitor.cpp:(.text._ZN5xsens12ReplyMonitorC2Ev+0x47): undefined reference to `pthread_mutexattr_init'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: replymonitor.cpp:(.text._ZN5xsens12ReplyMonitorC2Ev+0x55): undefined reference to `pthread_mutexattr_settype'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscontroller.a(replyobject.cpp.o): in function `ReplyObject::ReplyObject()':
replyobject.cpp:(.text._ZN11ReplyObjectC2Ev+0x37): undefined reference to `pthread_mutexattr_init'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: replyobject.cpp:(.text._ZN11ReplyObjectC2Ev+0x45): undefined reference to `pthread_mutexattr_settype'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscontroller.a(replyobject.cpp.o): in function `ReplyObject::~ReplyObject()':
replyobject.cpp:(.text._ZN11ReplyObjectD2Ev+0x4a): undefined reference to `pthread_mutexattr_destroy'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscontroller.a(dataparser.cpp.o): in function `DataParser::~DataParser()':
dataparser.cpp:(.text._ZN10DataParserD2Ev+0x172): undefined reference to `pthread_mutexattr_destroy'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscontroller.a(dataparser.cpp.o): in function `DataParser::DataParser() [clone .cold]':
dataparser.cpp:(.text.unlikely._ZN10DataParserC2Ev+0x18): undefined reference to `pthread_mutexattr_destroy'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscontroller.a(dataparser.cpp.o): in function `DataParser::DataParser()':
dataparser.cpp:(.text._ZN10DataParserC2Ev+0x42): undefined reference to `pthread_mutexattr_init'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: dataparser.cpp:(.text._ZN10DataParserC2Ev+0x50): undefined reference to `pthread_mutexattr_settype'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscommon.a(threading.cpp.o): in function `xsens::StandardThread::isAlive() const volatile':
threading.cpp:(.text._ZNVK5xsens14StandardThread7isAliveEv+0x1c): undefined reference to `pthread_kill'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscommon.a(threading.cpp.o): in function `xsens::StandardThread::startThread(char const*)':
threading.cpp:(.text._ZN5xsens14StandardThread11startThreadEPKc+0x58): undefined reference to `pthread_create'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscommon.a(threading.cpp.o): in function `xsens::StandardThread::stopThread()':
threading.cpp:(.text._ZN5xsens14StandardThread10stopThreadEv+0x63): undefined reference to `pthread_join'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscommon.a(threading.cpp.o): in function `xsens::WaitCondition::WaitCondition(xsens::Mutex&)':
threading.cpp:(.text._ZN5xsens13WaitConditionC2ERNS_5MutexE+0x2c): undefined reference to `pthread_condattr_setclock'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: threading.cpp:(.text._ZN5xsens13WaitConditionC2ERNS_5MutexE+0x59): undefined reference to `pthread_condattr_getclock'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscommon.a(xsens_threadpool.cpp.o): in function `std::_Sp_counted_ptr_inplace<xsens::PooledTask, std::allocator<xsens::PooledTask>, (__gnu_cxx::_Lock_policy)2>::_M_dispose()':
xsens_threadpool.cpp:(.text._ZNSt23_Sp_counted_ptr_inplaceIN5xsens10PooledTaskESaIS1_ELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv[_ZNSt23_Sp_counted_ptr_inplaceIN5xsens10PooledTaskESaIS1_ELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv]+0xc0): undefined reference to `pthread_mutexattr_destroy'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscommon.a(xsens_threadpool.cpp.o): in function `xsens::ThreadPool::ThreadPool() [clone .cold]':
xsens_threadpool.cpp:(.text.unlikely._ZN5xsens10ThreadPoolC2Ev+0x2d): undefined reference to `pthread_mutexattr_destroy'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscommon.a(xsens_threadpool.cpp.o): in function `xsens::ThreadPool::ThreadPool()':
xsens_threadpool.cpp:(.text._ZN5xsens10ThreadPoolC2Ev+0x178): undefined reference to `pthread_mutexattr_init'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: xsens_threadpool.cpp:(.text._ZN5xsens10ThreadPoolC2Ev+0x186): undefined reference to `pthread_mutexattr_settype'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscommon.a(xsens_threadpool.cpp.o): in function `xsens::ThreadPool::addTask(xsens::ThreadPoolTask*, unsigned int) [clone .cold]':
xsens_threadpool.cpp:(.text.unlikely._ZN5xsens10ThreadPool7addTaskEPNS_14ThreadPoolTaskEj+0xe): undefined reference to `pthread_mutexattr_destroy'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxscommon.a(xsens_threadpool.cpp.o): in function `xsens::ThreadPool::addTask(xsens::ThreadPoolTask*, unsigned int)':
xsens_threadpool.cpp:(.text._ZN5xsens10ThreadPool7addTaskEPNS_14ThreadPoolTaskEj+0xb5): undefined reference to `pthread_mutexattr_init'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: xsens_threadpool.cpp:(.text._ZN5xsens10ThreadPool7addTaskEPNS_14ThreadPoolTaskEj+0xc3): undefined reference to `pthread_mutexattr_settype'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxstypes.a(xslibraryloader.c.o): in function `XsLibraryLoader_resolve':
xslibraryloader.c:(.text.XsLibraryLoader_resolve+0x5): undefined reference to `dlsym'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxstypes.a(xslibraryloader.c.o): in function `XsLibraryLoader_unload':
xslibraryloader.c:(.text.XsLibraryLoader_unload+0x21): undefined reference to `dlclose'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxstypes.a(xslibraryloader.c.o): in function `XsLibraryLoader_load':
xslibraryloader.c:(.text.XsLibraryLoader_load+0x2a): undefined reference to `dlopen'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: ../extern/libxstypes.a(xsthread.c.o): in function `xsNameThisThread':
xsthread.c:(.text.xsNameThisThread+0x51): undefined reference to `pthread_setname_np'
/run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/../lib/gcc/x86_64-conda-linux-gnu/10.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: xsthread.c:(.text.xsNameThisThread+0x99): undefined reference to `pthread_setname_np'
collect2: error: ld returned 1 exit status
make[2]: *** [xsensmt/CMakeFiles/xsensExample.dir/build.make:100: xsensmt/xsensExample] Error 1
make[1]: *** [CMakeFiles/Makefile2:231: xsensmt/CMakeFiles/xsensExample.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 99%] Built target xsensmt
make: *** [Makefile:136: all] Error 2

The files are the same as in #26 (comment) excluding YARP-related lines.

  • The error seems related to pthread and dl libraries.

Actually, I saw in the CMakeLists of the ROS driver, they are linking these libraries. And also in this repo with the older versions (4.8.2) see

target_link_libraries(xsens_mt_software_suite PUBLIC ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS})

And adding linking these libraries actually solves the linking error, and the code runs as expected (not stuck at scanning devices)! I don't completely understand their role yet..

However

I'm compiling this repo with a compiler from Conda.

While the other case that doesn't throw a linking error and the execution gets stuck, uses the system compiler.

That's the difference I could think of, there could be other differences between the two attempts!

My Conda compiler:

≻ /run/media/hosameldin/HosamVolume/mambaforge/envs/robTest/bin/x86_64-conda-linux-gnu-c++ --version
x86_64-conda-linux-gnu-c++ (conda-forge gcc 10.4.0-19) 10.4.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

My System compiler:

≻ /usr/bin/g++ --version
g++ (GCC) 12.2.1 20230201
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Note

I upgraded the Xsens library to the latest version (2022.0.0), from the 2020 one. The current development is in the branch https://github.com/HosameldinMohamed/yarp-device-xsensmt/tree/update/2022.0.0_latest

@traversaro
Copy link
Member Author

And adding linking these libraries actually solves the linking error, and the code runs as expected (not stuck at scanning devices)! I don't completely understand their role yet..

The functions related to threading (pthread_*) and dynamic loading of library (dl*) are not provided by the operating system (as it is for system calls) or by the C or C++ standard library, so they needed to be linked as regular libraries. Anyhow, for linking pthreads the best practice is to use imported targets, i.e. :

find_package(Threads REQUIRED)
target_link_libraries(<> PRIVATE Threads::Threads)

@traversaro
Copy link
Member Author

So, just to understand, is the driver working now? Did you solved all the ThreadSanitizers problems?

@HosameldinMohamed
Copy link
Contributor

HosameldinMohamed commented Mar 2, 2023

So, just to understand, is the driver working now?

I'm compiling the Xsens example with 2 compilers
With the conda one it requires linking with pthread and dl.. and the issue is solved if I do the linking.

While the system compiler doesn't require linking dl and thread, and even if I link them the problem persists.

Did you solved all the ThreadSanitizers problems?

No, I encountered this linking issue so I was checking it out..

I left Xsens code as it arrives from the vendor for now..

@traversaro
Copy link
Member Author

Ok!

@HosameldinMohamed
Copy link
Contributor

With reference to #26 (comment),

I tested it in popOS 22.04 and the problem persists.
Version of g++ (and gcc) is 11.3.0
CMake version is 3.22.1

I tested it in Ubuntu 20.04 and it runs with no problem.
Version of g++ (and gcc) is 9.4.0.
CMake version is 3.19.1

I installed g++-11 and gcc-11 in Ubuntu 20.04, (version 11.1.0) and added I them to CMake configurations (assuming I did it correctly). And the still there was** no problem**.

@HosameldinMohamed
Copy link
Contributor

The problem appeared to be common with Ubuntu 22.04, due to update in glibc to 2.35 that broke some dependencies in the public XDA.

See https://base.xsens.com/s/article/Public-XDA-example-code-hanging-while-scanning-for-devices?language=en_US

Fix will arrive in a future SDK (v 2023).

Suggested workaround to follow: bluespace-ai/bluespace_ai_xsens_ros_mti_driver#17

I tested it in our systems and it removed the error 🎉

@traversaro
Copy link
Member Author

The problem appeared to be common with Ubuntu 22.04, due to update in glibc to 2.35 that broke some dependencies in the public XDA.

See https://base.xsens.com/s/article/Public-XDA-example-code-hanging-while-scanning-for-devices?language=en_US

Fix will arrive in a future SDK (v 2023).

Suggested workaround to follow: bluespace-ai/bluespace_ai_xsens_ros_mti_driver#17

I tested it in our systems and it removed the error 🎉

Great catch!

@HosameldinMohamed
Copy link
Contributor

Opened PR #38

I updated the configuration and the reading logic based on the example code provided in the MT Software Suite SDK, and the doc files.

@traversaro
Copy link
Member Author

The problem appeared to be common with Ubuntu 22.04, due to update in glibc to 2.35 that broke some dependencies in the public XDA.

See https://base.xsens.com/s/article/Public-XDA-example-code-hanging-while-scanning-for-devices?language=en_US

Fix will arrive in a future SDK (v 2023).

Suggested workaround to follow: bluespace-ai/bluespace_ai_xsens_ros_mti_driver#17

I tested it in our systems and it removed the error 🎉

For reference, this fix was done in a43369b .

@HosameldinMohamed
Copy link
Contributor

Hi @traversaro maybe this issue can be closed?

@traversaro
Copy link
Member Author

Sure!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants