Page 1 of 1

ZMQ API, cant build it.

Posted: 11 Jan 2024, 17:31
by MauHernandez
Hello, Its Mauricio

I have been trying to figure out how to make the ZMQ API to work for C++. It worked fine for the python part, but can not for the life of me build it in c++. I am running it in Ubuntu 20.04, this are the messages that I get when running the
cmake ..
cmake --build .
As indicated in the https://manual.coppeliarobotics.com/en/ ... erview.htm

Code: Select all

cmake ..
-- CoppeliaSim: COPPELIASIM_INCLUDE_DIR: /home/frankaepson/software/CoppeliaSim_Edu_V4_6_0_rev16_Ubuntu20_04/programming/include
-- CoppeliaSim: COPPELIASIM_ROOT_DIR: /home/frankaepson/software/CoppeliaSim_Edu_V4_6_0_rev16_Ubuntu20_04
-- Checking CoppeliaSim header version...
-- CoppeliaSim headers version 4.6.0 rev16
-- CoppeliaSim: COPPELIASIM_RESOURCES_DIR: /home/frankaepson/software/CoppeliaSim_Edu_V4_6_0_rev16_Ubuntu20_04
-- CoppeliaSim: COPPELIASIM_PLUGINS_DIR: /home/frankaepson/software/CoppeliaSim_Edu_V4_6_0_rev16_Ubuntu20_04
-- CoppeliaSim: COPPELIASIM_EXECUTABLES_DIR: /home/frankaepson/software/CoppeliaSim_Edu_V4_6_0_rev16_Ubuntu20_04
-- CoppeliaSim: COPPELIASIM_LIBRARIES_DIR: /home/frankaepson/software/CoppeliaSim_Edu_V4_6_0_rev16_Ubuntu20_04
-- CoppeliaSim: COPPELIASIM_ADDONS_DIR: /home/frankaepson/software/CoppeliaSim_Edu_V4_6_0_rev16_Ubuntu20_04/addOns
-- CoppeliaSim: COPPELIASIM_HELPFILES_DIR: /home/frankaepson/software/CoppeliaSim_Edu_V4_6_0_rev16_Ubuntu20_04/helpFiles
-- CoppeliaSim: COPPELIASIM_MODELS_DIR: /home/frankaepson/software/CoppeliaSim_Edu_V4_6_0_rev16_Ubuntu20_04/models
-- CoppeliaSim: COPPELIASIM_SCENES_DIR: /home/frankaepson/software/CoppeliaSim_Edu_V4_6_0_rev16_Ubuntu20_04/scenes
-- CoppeliaSim: COPPELIASIM_EXECUTABLE: /home/frankaepson/software/CoppeliaSim_Edu_V4_6_0_rev16_Ubuntu20_04/coppeliaSim
-- Detected CPPZMQ Version - 4.10.0
-- cppzmq v4.10.0
-- Configuring done
-- Generating done
-- Build files have been written to: /home/frankaepson/software/CoppeliaSim_Edu_V4_6_0_rev16_Ubuntu20_04/programming/zmqRemoteApi/clients/cpp/build

cmake --build .
[ 16%] Built target RemoteAPIClient
[ 25%] Linking CXX executable qt
/usr/bin/ld: /home/frankaepson/anaconda3/lib/libQt5Core.so.5.15.2: undefined reference to `std::__exception_ptr::exception_ptr::_M_release()@CXXABI_1.3.13'
/usr/bin/ld: /home/frankaepson/anaconda3/lib/libQt5Widgets.so.5.15.2: undefined reference to `std::__throw_bad_array_new_length()@GLIBCXX_3.4.29'
/usr/bin/ld: /home/frankaepson/anaconda3/lib/libQt5Core.so.5.15.2: undefined reference to `std::__exception_ptr::exception_ptr::_M_addref()@CXXABI_1.3.13'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/qt.dir/build.make:89: qt] Error 1
make[1]: *** [CMakeFiles/Makefile2:106: CMakeFiles/qt.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
Also, trying with make -j4, got also this error

Code: Select all

Scanning dependencies of target RemoteAPIClient
[  8%] Building CXX object CMakeFiles/RemoteAPIClient.dir/RemoteAPIClient.cpp.o
/home/frankaepson/software/CoppeliaSim_Edu_V4_6_0_rev16_Ubuntu20_04/programming/zmqRemoteApi/clients/cpp/RemoteAPIClient.cpp: In member function ‘jsoncons::json RemoteAPIClient::recv()’:
/home/frankaepson/software/CoppeliaSim_Edu_V4_6_0_rev16_Ubuntu20_04/programming/zmqRemoteApi/clients/cpp/RemoteAPIClient.cpp:217:23: warning: ignoring return value of ‘zmq::recv_result_t zmq::detail::socket_base::recv(zmq::message_t&, zmq::recv_flags)’, declared with attribute nodiscard [-Wunused-result]
  217 |     rpcSocket.recv(msg);
      |                       ^
In file included from /home/frankaepson/software/CoppeliaSim_Edu_V4_6_0_rev16_Ubuntu20_04/programming/zmqRemoteApi/clients/cpp/RemoteAPIClient.h:6,
                 from /home/frankaepson/software/CoppeliaSim_Edu_V4_6_0_rev16_Ubuntu20_04/programming/zmqRemoteApi/clients/cpp/RemoteAPIClient.cpp:1:
/home/frankaepson/software/CoppeliaSim_Edu_V4_6_0_rev16_Ubuntu20_04/programming/zmqRemoteApi/clients/cpp/build/cppzmq/zmq.hpp:2037:19: note: declared here
 2037 |     recv_result_t recv(message_t &msg, recv_flags flags = recv_flags::none)
      |                   ^~~~
[ 16%] Linking CXX static library libRemoteAPIClient.a
[ 16%] Built target RemoteAPIClient
Scanning dependencies of target qt
Scanning dependencies of target bubbleRobClient
Scanning dependencies of target opencv
Scanning dependencies of target example
[ 33%] Building CXX object CMakeFiles/bubbleRobClient.dir/bubbleRobClient.cpp.o
[ 33%] Building CXX object CMakeFiles/example.dir/example.cpp.o
[ 41%] Building CXX object CMakeFiles/opencv.dir/opencv.cpp.o
[ 50%] Building CXX object CMakeFiles/qt.dir/qt.cpp.o
[ 58%] Linking CXX executable bubbleRobClient
[ 58%] Built target bubbleRobClient
Scanning dependencies of target synchronousImageTransmission
[ 66%] Building CXX object CMakeFiles/synchronousImageTransmission.dir/synchronousImageTransmission.cpp.o
[ 75%] Linking CXX executable opencv
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libp11-kit.so.0: undefined reference to `ffi_closure_alloc@LIBFFI_CLOSURE_7.0'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libp11-kit.so.0: undefined reference to `ffi_prep_closure_loc@LIBFFI_CLOSURE_7.0'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libp11-kit.so.0: undefined reference to `ffi_type_uint8@LIBFFI_BASE_7.0'
/usr/bin/ld: /usr/lib/libgdal.so.26: undefined reference to `TIFFReadRGBATileExt@LIBTIFF_4.0'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libwayland-client.so.0: undefined reference to `ffi_type_void@LIBFFI_BASE_7.0'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libwayland-client.so.0: undefined reference to `ffi_prep_cif@LIBFFI_BASE_7.0'
/usr/bin/ld: /usr/lib/libgdal.so.26: undefined reference to `TIFFReadRGBAStripExt@LIBTIFF_4.0'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libwayland-client.so.0: undefined reference to `ffi_type_uint32@LIBFFI_BASE_7.0'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libwayland-client.so.0: undefined reference to `ffi_type_sint32@LIBFFI_BASE_7.0'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libwayland-client.so.0: undefined reference to `ffi_call@LIBFFI_BASE_7.0'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libwayland-client.so.0: undefined reference to `ffi_type_pointer@LIBFFI_BASE_7.0'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libp11-kit.so.0: undefined reference to `ffi_type_uint64@LIBFFI_BASE_7.0'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/opencv.dir/build.make:91: opencv] Error 1
make[1]: *** [CMakeFiles/Makefile2:133: CMakeFiles/opencv.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 83%] Linking CXX executable example
[ 83%] Built target example
[ 91%] Linking CXX executable synchronousImageTransmission
[ 91%] Built target synchronousImageTransmission
[100%] Linking CXX executable qt
/usr/bin/ld: /home/frankaepson/anaconda3/lib/libQt5Core.so.5.15.2: undefined reference to `std::__exception_ptr::exception_ptr::_M_release()@CXXABI_1.3.13'
/usr/bin/ld: /home/frankaepson/anaconda3/lib/libQt5Widgets.so.5.15.2: undefined reference to `std::__throw_bad_array_new_length()@GLIBCXX_3.4.29'
/usr/bin/ld: /home/frankaepson/anaconda3/lib/libQt5Core.so.5.15.2: undefined reference to `std::__exception_ptr::exception_ptr::_M_addref()@CXXABI_1.3.13'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/qt.dir/build.make:89: qt] Error 1
make[1]: *** [CMakeFiles/Makefile2:106: CMakeFiles/qt.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
The error of the rpcSocket.recv(msg); was also in the make build but I dont know why it stopped showing.
I am really stuck, have already tried to update the Qt, and dont know if there is something I am missing.
Would very much appreciate the help. Thanks in advance.
By the way, I am running this in the programming/zmqRemoteApi/clients/cpp/build
If I understood correctly, that is where it is supposed to be ran at, right?

Re: ZMQ API, cant build it.

Posted: 12 Jan 2024, 13:16
by coppelia
Hello,

didn't look too much into details, but I think you need to export the root directory of CoppeliaSim, also you can turn file generation off (ok as long as you don't have new API functions). Also Python is being used to generate various things and you can select with Python interpreter, try with something like:

Code: Select all

export COPPELIASIM_ROOT_DIR=$COPPELIASIM_ROOT_DIR
cmake -DGENERATE=OFF -DPython3_EXECUTABLE="pathToYourPython" ..
Cheers