Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pthread component needs "newlib_include_locks_impl" type treatment for gcc 8 (IDFGH-1437) #3709

Closed
bpietsch opened this issue Jun 29, 2019 · 0 comments

Comments

@bpietsch
Copy link

I'm using c++ and the gthread library has a dependency on pthread_cond_xxx. I found that with gcc 8.2 I had to apply the following bit of trickery (copied from newlib) to be able to link (along with corresponding stub functions in the source files, of course):

if(GCC_NOT_5_2_0)
set(EXTRA_LINK_FLAGS "-u pthread_include_pthread_impl")
list(APPEND EXTRA_LINK_FLAGS "-u pthread_include_pthread_cond_impl")
list(APPEND EXTRA_LINK_FLAGS "-u pthread_include_pthread_local_storage_impl")
endif()

idf_component_register(SRCS "pthread.c"
"pthread_cond_var.c"
"pthread_local_storage.c"
INCLUDE_DIRS include)

if(CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP)
target_link_libraries(${COMPONENT_LIB} "-Wl,--wrap=vPortCleanUpTCB")
endif()

if(EXTRA_LINK_FLAGS)
target_link_libraries(${COMPONENT_LIB} INTERFACE "${EXTRA_LINK_FLAGS}")
endif()

@github-actions github-actions bot changed the title pthread component needs "newlib_include_locks_impl" type treatment for gcc 8 pthread component needs "newlib_include_locks_impl" type treatment for gcc 8 (IDFGH-1437) Jun 29, 2019
@igrr igrr closed this as completed in 6617695 Aug 5, 2019
trombik pushed a commit to trombik/esp-idf that referenced this issue Aug 9, 2019
Force linking pthread implementation from IDF, instead of the weak
functions provided by gthread library. Previously this would either
work or not depending on the linking order.

Thanks @bpietsch for suggesting the fix.

Closes espressif#3709
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

No branches or pull requests

1 participant