Closed MyatToe closed 8 months ago
Finally, I solved the error.
It is because lack of boost library directory.
We can update by /PX4-Autopilot/Tools/jsbsim_bridge/CMakeLists.txt
around line number 8,
please add
_find_package(MAVLink) find_package(Boost 1.58 REQUIRED COMPONENTS system thread filesystem) set(Boost_INCLUDE_DIR /usr/include/boost) findpackage(TinyXML REQUIRED)
Usually boost is at the location of /usr/include/boost
you can also check boost is inside the system by running locate libboost in the terminal ~
Note: locate also need to install :)
_I installed jsbsim git clone https://github.com/JSBSim-Team/jsbsim.git and build successfully then I installed PX4 packages git clone https://github.com/PX4/PX4-Autopilot.git and then make px4_sitl has no error but when I run make px4_sitl jsbsim for the jsbsim bridge with PX4 then the error came_
make px4_sitl jsbsim [0/6] Performing configure step for 'jsbsim_bridge' -- /home/PX4-Autopilot/build/px4_sitl_default/mavlink -- catkin DISABLED CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: /home/PX4-Autopilot/Tools/jsbsim_bridge/Boost_INCLUDE_DIR used as include directory in directory /home/PX4-Autopilot/Tools/jsbsim_bridge
-- Configuring incomplete, errors occurred! See also "/home/PX4-Autopilot/build/px4_sitl_default/build_jsbsim_bridge/CMakeFiles/CMakeOutput.log". See also "/home/PX4-Autopilot/build/px4_sitl_default/build_jsbsim_bridge/CMakeFiles/CMakeError.log". [1/6] Generating ../../logs FAILED: external/Stamp/jsbsim_bridge/jsbsim_bridge-configure cd /home/PX4-Autopilot/build/px4_sitl_default/build_jsbsim_bridge && /usr/bin/cmake -DCMAKE_INSTALL_PREFIX=/usr/local -GNinja /home/PX4-Autopilot/Tools/jsbsim_bridge && /usr/bin/cmake -E touch /home/PX4-Autopilot/build/px4_sitl_default/external/Stamp/jsbsim_bridge/jsbsim_bridge-configure ninja: build stopped: subcommand failed. make: *** [Makefile:235: px4_sitl] Error 1
When I check the CMakeError.log It is shown as
Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output: Change Dir: /home/PX4-Autopilot/build/px4_sitl_default/build_jsbsim_bridge/CMakeFiles/CMakeTmp
Run Build Command(s):/bin/ninja cmTC_8af19 && [1/2] Building C object CMakeFiles/cmTC_8af19.dir/src.c.o [2/2] Linking C executable cmTC_8af19 FAILED: cmTC_8af19 : && /bin/cc -DCMAKE_HAVE_LIBC_PTHREAD -rdynamic CMakeFiles/cmTC_8af19.dir/src.c.o -o cmTC_8af19 && : /bin/ld: CMakeFiles/cmTC_8af19.dir/src.c.o: in function
main': src.c:(.text+0x46): undefined reference to
pthread_create' /bin/ld: src.c:(.text+0x52): undefined reference topthread_detach' /bin/ld: src.c:(.text+0x63): undefined reference to
pthread_join' collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed.Source file was:
include
void test_func(void data) { return data; }
int main(void) { pthread_t thread; pthread_create(&thread, NULL, test_func, NULL); pthread_detach(thread); pthread_join(thread, NULL); pthread_atfork(NULL, NULL, NULL); pthread_exit(NULL);
return 0; }
Determining if the function pthread_create exists in the pthreads failed with the following output: Change Dir: /home/PX4-Autopilot/build/px4_sitl_default/build_jsbsim_bridge/CMakeFiles/CMakeTmp
Run Build Command(s):/bin/ninja cmTC_b4d1e && [1/2] Building C object CMakeFiles/cmTC_b4d1e.dir/CheckFunctionExists.c.o [2/2] Linking C executable cmTC_b4d1e FAILED: cmTC_b4d1e : && /bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -rdynamic CMakeFiles/cmTC_b4d1e.dir/CheckFunctionExists.c.o -o cmTC_b4d1e -lpthreads && : /bin/ld: cannot find -lpthreads collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed.
I tried to remove and reinstall and also install repeatable but still getting same error
sudo apt-get remove/install libboost-all-dev
May I know the solution if anyone has the experience with this error?