Skip to content

Fix build when linking against musl#70

Open
Calinou wants to merge 1 commit intokmammou:masterfrom
Calinou:fix-musl-build
Open

Fix build when linking against musl#70
Calinou wants to merge 1 commit intokmammou:masterfrom
Calinou:fix-musl-build

Conversation

@Calinou
Copy link

@Calinou Calinou commented Nov 10, 2019

musl doesn't define PTHREAD_MUTEX_RECURSIVE, so it has to be done manually.

From my testing, this seems to work when using both GCC + glibc and GCC + musl (on Fedora 31 and Alpine respectively).

@akien-mga
Copy link

musl doesn't define this macro, so it has to be done manually. Since there doesn't seem to be a macro to detect whether musl is used, we should always define the macro on Linux.

I think you can use !defined(__GLIBC__): https://stackoverflow.com/questions/4266354/how-to-tell-if-glibc-is-used
It might still let through some non-GNU C libraries which define __GLIBC__ for compatibility, but at least musl doesn't seem to: http://git.musl-libc.org/cgit/musl/tree/include/features.h

musl doesn't define `PTHREAD_MUTEX_RECURSIVE`, so it has to be done
manually.
@akien-mga
Copy link

Any chance to see this reviewed/merged? We use it downstream in Godot, would be good to have it upstream for others.

@Calinou
Copy link
Author

Calinou commented Mar 9, 2021

Bump (again) 🙂

cc @kmammou

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.

2 participants