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

More efficiently check for musl libc #314

Closed
nex3 opened this issue Jul 30, 2024 · 1 comment · Fixed by #315
Closed

More efficiently check for musl libc #314

nex3 opened this issue Jul 30, 2024 · 1 comment · Fixed by #315
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@nex3
Copy link
Contributor

nex3 commented Jul 30, 2024

Currently, the check we run to determine whether the current Node process is running under musl libc—and thus which Linux binary to use for the embedded compiler—is very expensive. This is particularly problematic in light of #313, which runs this check for every CLI invocation of the Sass compiler.

We should find a way to drive this cost down in order to minimize the overhead of starting the embedded host or the CLI. One option would be to port the Ruby host's ELF-parsing logic, although that's fairly complex. There are a few ELF parser libraries on npm, but none of them seem to support synchronous mode and operating on a file descriptor rather than the whole executable, both of which are hard requirements here. It's possible there are other solutions, like looking for /lib/libc.musl-x86_64.so.*, but we'd have to do some research to verify that that's reliable.

@nex3 nex3 added enhancement New feature or request help wanted Extra attention is needed labels Jul 30, 2024
@nex3 nex3 changed the title More efficiently check for MUSL LibC More efficiently check for musl libc Jul 30, 2024
@ntkme
Copy link
Contributor

ntkme commented Jul 30, 2024

I can take the action and write a simplified ELF parser as the goal is to only extract the interpreter and we don't need a lot other fields that ruby implementation extracts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants