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.
cmake -j 1
will simplify this, as will directing stdout to a file or null (so you only see the stderr stuff).cmake ... > /dev/null
. This will redirect non-errors to nowhere, and you will only see errors. If you post that, there is a good chance someone can tell you what the problem is; linker errors are generally easy to remedy. Short of that, you're waiting for someone to come along who has done this and will post exact instructions for you, which may never happen.