Skip to content

Fix pthread_create thread function signature - #5

Open
Vorckea wants to merge 1 commit into
FS-AI:mainfrom
Vorckea:fix/pthread-create-thread-signature
Open

Vorckea wants to merge 1 commit into
FS-AI:mainfrom
Vorckea:fix/pthread-create-thread-signature

Conversation

@Vorckea

@Vorckea Vorckea commented Oct 10, 2026 •

Copy link
Copy Markdown

Summary

Fix the pthread_create() compilation error in the FS-AI API.

The can_read_thread function was declared without parameters, but pthread_create() requires a thread function with the signature:

void *thread_function(void *arg)

The function now accepts the required void * argument and explicitly marks it as unused. Existing CAN reader behaviour is unchanged.

Issue

This issue is present when building the FS-AI API on Ubuntu 26.04 and ROS Lyrical. The compiler reports:

error: passing argument 3 of ‘pthread_create’ from incompatible pointer type

The error is caused by the incompatible function-pointer type passed to pthread_create().

Validation

  • Rebuilt the FS-AI API library successfully.
  • Rebuilt the FS-AI API.
  • Confirmed the pthread_create() complication error is resolved.

Build environment

  • OS: Ubuntu 26.04.1 LTS (Resolute Raccoon)
  • Kernel: Linux 6.18.40.1 Microsoft-standard-WSL2
  • Architecture: x86_64
  • CMake: 4.2.3
  • GCC: 15.2.0
  • G++: 15.2.0
  • GNU Make: 4.4.1
  • Python: 3.14.4
  • colcon-core: 0.21.3
  • C++ standard configured by CMake: C++17
  • Package build type: ament_cmake
  • ROS: Lyrical

@Vorckea

Vorckea commented Oct 16, 2026

Copy link
Copy Markdown
Author

Complete error:

fs-ai_api.c: In function ‘fs_ai_api_init’:
fs-ai_api.c:585:51: error: passing argument 3 of ‘pthread_create’ from incompatible pointer type [-Wincompatible-pointer-types]
  585 |         err = pthread_create(&can_read_tid, NULL, &can_read_thr, NULL);
      |                                                   ^~~~~~~~~~~~~
      |                                                   |
      |                                                   void * (*)(void)
In file included from fs-ai_api.c:43:
/usr/include/pthread.h:204:36: note: expected ‘void * (*)(void *)’ but argument is of type ‘void * (*)(void)’
  204 |                            void *(*__start_routine) (void *),
      |                            ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
fs-ai_api.c:284:14: note: ‘can_read_thread’ declared here
  284 | static void *can_read_thread() {
      |              ^~~~~~~~~~~~~~~
gmake[3]: *** [<builtin>: fs-ai_api.o] Error 1
gmake[2]: *** [CMakeFiles/fs-ai-api.dir/build.make:70: CMakeFiles/fs-ai-api] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:156: CMakeFiles/fs-ai-api.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2

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

Successfully merging this pull request may close these issues.

1 participant