Skip to content

musl compatibility - #827

Merged
edolstra merged 2 commits into
NixOS:masterfrom
edef1c:musl
Mar 3, 2016
Merged

edolstra merged 2 commits into
NixOS:masterfrom
edef1c:musl

Conversation

@edef1c

@edef1c edef1c commented Feb 29, 2016

Copy link
Copy Markdown
Member

This allows Nix to compile against musl libc.
Fixes #469.

@domenkozar

Copy link
Copy Markdown
Member

Would also be nice to add a build with musl to release.nix

@edef1c

edef1c commented Feb 29, 2016

Copy link
Copy Markdown
Member Author

Definitely, but we haven't got a musl stdenv yet (I'm working on one) — perhaps the same trick we pull with busybox (makeFlags = [ "CC=gcc -isystem ${musl}/include -B${musl}/lib -L${musl}/lib" ]) could work?

@edolstra

Copy link
Copy Markdown
Member

Not wanting to channel Lennart Poettering too much, but maybe it would be better to fix this in musl? (I.e., add sched_getcpu to musl once rather than to every package that uses it.)

@edef1c

edef1c commented Feb 29, 2016

Copy link
Copy Markdown
Member Author

@edolstra Definitely — the musl folks have said they're open to this. However, that still hasn't happened, and it's gonna take a while for that to trickle down to musl-using distros, and my branch works in the present.

@edef1c

edef1c commented Feb 29, 2016

Copy link
Copy Markdown
Member Author

It's worth noting that sched_getcpu(3) isn't a part of any standard (it's only provided by glibc), nor is it the name of a syscall (the syscall is getcpu(2), which doesn't have a libc wrapper, as the manpage notes)

@copumpkin

Copy link
Copy Markdown
Member

What happens on darwin, where that syscall invocation is nonsense? I assume there's already an ifdef around the code calling sched_getcpu?

@edef1c

edef1c commented Feb 29, 2016

Copy link
Copy Markdown
Member Author

@copumpkin I'm assuming the pre-existing #if __linux__ doesn't fire on Darwin (I'm not sure why it isn't an #ifdef, but I didn't want to contaminate this PR with a style fix for old code)

@edef1c

edef1c commented Mar 1, 2016

Copy link
Copy Markdown
Member Author

I'm working on getting sched_getcpu merged into musl, with vDSO support and everything (something I wouldn't attempt if it were inlined here)

@edef1c

edef1c commented Mar 3, 2016

Copy link
Copy Markdown
Member Author

@edolstra I've removed the sched_getcpu polyfill. Any objections to merging these two lines?
It'll work with the next stable musl release in 1-3 months.

edolstra added a commit that referenced this pull request Mar 3, 2016
@edolstra
edolstra merged commit 0a26b56 into NixOS:master Mar 3, 2016
@edef1c
edef1c deleted the musl branch March 3, 2016 15:09
@gitfoxi

gitfoxi commented Mar 5, 2016

Copy link
Copy Markdown

@nathan7 Wow. That's good news. If I want to try it out do I need to first install musl from git under alpine then use your alpine package to install nix?

I'll try that and see how it goes.

@edef1c

edef1c commented Mar 5, 2016

Copy link
Copy Markdown
Member Author

@gitfoxi My package actually works with current stable musl, since it does include the sched_getcpu patches (it's based off Nix 1.11.2, and stable musl)

Ma27 pushed a commit to Ma27/nix that referenced this pull request Mar 8, 2026
Vaguely one half of NixOS#186.
Fixes NixOS#827.

Change-Id: Ie6a296465beb089bf812ea27091648ca6a6a6964
ai-georgyo pushed a commit to georgyo/nix that referenced this pull request Nov 29, 2026
…ic-functions

packaging/nix-make: Link libraries with -Bsymbolic-functions
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.

5 participants