0

I am trying to port AprilTags to the Pi Pico. This has a dependancy on pthreads.

As is outlined in this SO question pthreads needs a posix layer. However there is this youtube video showing it working on the pico with the ardunio SDK on effectively bare metal?

How does the ardunio libary work around needing posix?

I am asking this with a view to using the native C/C++ SDK.


What I have tried: I've tried adding this to the top of the CMakeLists.txt file in my AprilTags checkout:

set(CMAKE_THREAD_LIBS_INIT "-lpthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(CMAKE_USE_WIN32_THREADS_INIT 0)
set(CMAKE_USE_PTHREADS_INIT 1)
set(THREADS_PREFER_PTHREAD_FLAG ON)

And changing the libarry type to be static on line 31:

add_library(${PROJECT_NAME} STATIC ${APRILTAG_SRCS} ${COMMON_SRC} ${TAG_FILES})

Which seems to run cmake just fine as a subdirectory in my main project however when running make -j4 I get:

[ 39%] Linking C static library libapriltag.a
[ 39%] Built target apriltag
make: *** [Makefile:130: all] Error 2

I understand that this means the build has encountered a problem in building however I'm not sure how to know what the problem is.

2
  • 1
    Too may questions.
    – joan
    Apr 1 at 20:52
  • I have reduced the number of questions to be more specific. Apr 2 at 8:22
0

From man make.

A status of two will be returned if any errors were encountered.

1
  • Thank you for the response. My problem is more that I don't understand why it is erroring. I'm still fairly new to Makefiles and C in general and I am not quite sure what is the correct process to drill down and find out why. If it is line 130 in the top level make file causing the problem then line causing the error is $(MAKE) -f CMakeFiles/Makefile2 all. But I don't know how to find out why this is causing the error. Apr 2 at 8:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.