Skip to content

build(deps): check for pthread_getname_np symbol before bundling libuv#33288

Closed
whouishere wants to merge 1 commit intoneovim:masterfrom
whouishere:pthread-symbol-check-fix
Closed

build(deps): check for pthread_getname_np symbol before bundling libuv#33288
whouishere wants to merge 1 commit intoneovim:masterfrom
whouishere:pthread-symbol-check-fix

Conversation

@whouishere
Copy link
Copy Markdown

On systems that use a musl version prior to 1.2.3 neovim fails to link because the bundled libuv uses pthread_getname_np, which was implemented in musl 1.2.3.

Our solution is to check for the pthread_getname_np symbol before bundling libuv. If not found, require to use the system libuv library, which may not need pthread_getname_np.

Fixes #32613

…buv.

Problem: On systems that use a musl version prior to 1.2.3 neovim
fails to link because the bundled libuv uses `pthread_getname_np`,
which was implemented in musl 1.2.3.

Solution: Check for the `pthread_getname_np` symbol before bundling
libuv. If not found, require to use the system libuv library, which
may not need `pthread_getname_np`.
@github-actions github-actions Bot added the build building and installing Neovim using the provided scripts label Apr 3, 2025
@whouishere
Copy link
Copy Markdown
Author

Surprised to see more than half of checks failing because it tries to use the system libuv. Especially since Ubuntu should have pthread_getname_np.

I'm going to investigate it and fix it.

@whouishere whouishere marked this pull request as draft April 3, 2025 12:34
Comment thread cmake.deps/CMakeLists.txt
Comment on lines +113 to +120
include(CheckSymbolExists)
check_symbol_exists(pthread_getname_np "pthread.h" HAVE_PTHREAD_GETNAME_NP)

if(HAVE_PTHREAD_GETNAME_NP)
include(BuildLibuv)
else()
set(USE_BUNDLED_LIBUV OFF)
endif()
Copy link
Copy Markdown
Member

@dundargoc dundargoc Apr 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer this check to be at the top around the "# Options" comment, then it can be rewritten as the following:

include(CheckSymbolExists)
check_symbol_exists(pthread_getname_np "pthread.h" HAVE_PTHREAD_GETNAME_NP)
option(USE_BUNDLED_LIBUV "Use the bundled libuv." ${USE_BUNDLED} AND ${HAVE_PTHREAD_GETNAME_NP})

That last line might be need to be rewritten as a basic if-def like it's done with USE_BUNDLED_GETTEXT, but that's still easier IMO.

@justinmk
Copy link
Copy Markdown
Member

do you plan to address dundar's comment?

@justinmk justinmk added the needs:response Waiting for reply, will auto-close after 30 days. label Apr 21, 2025
@whouishere
Copy link
Copy Markdown
Author

Oh yeah, I will soon fix it and refactor the PR as dundar suggested. I just haven't got the time in the past weeks, will soon get around to spin up all of the VMs to test it!

@github-actions github-actions Bot removed the needs:response Waiting for reply, will auto-close after 30 days. label Apr 21, 2025
@justinmk justinmk added the needs:response Waiting for reply, will auto-close after 30 days. label Apr 21, 2025
@github-actions
Copy link
Copy Markdown
Contributor

This has been closed since a request for information has not been answered for 30 days. It can be reopened when the requested information is provided.

@github-actions github-actions Bot closed this May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build building and installing Neovim using the provided scripts needs:response Waiting for reply, will auto-close after 30 days.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build fails on Void Linux (Musl), missing pthread_getname_np

3 participants