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

Could not open '/lib64/ld-linux-x86-64.so.2' #208

Closed
jd-carroll opened this issue Dec 15, 2022 · 3 comments · Fixed by #215
Closed

Could not open '/lib64/ld-linux-x86-64.so.2' #208

jd-carroll opened this issue Dec 15, 2022 · 3 comments · Fixed by #215

Comments

@jd-carroll
Copy link

If you're looking at this issue, it likely means you are on an M1 architecture (or at least not x86-64).

The problem is that the prebuild-wasm script defined in the package.json is not platform agnostic. The default (presumably from Docker) is to use an x86-64 architecture. Meaning, if you are not on an x86-64 architecture you'll likely end up with an error like this:

> llhttp@8.1.0 build /home/node/llhttp
> ts-node bin/generate.ts

qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory
Error: Command failed: /home/node/wasi-sdk-12.0/bin/clang  --sysroot=/home/node/wasi-sdk-12.0/share/wasi-sysroot  -target wasm32-unknown-wasi  -Ofast  -fno-exceptions  -fvisibility=hidden  -mexec-model=reactor  -Wl,-error-limit=0  -Wl,-O3  -Wl,--lto-O3  -Wl,--strip-all  -Wl,--allow-undefined  -Wl,--export-dynamic  -Wl,--export-table  -Wl,--export=malloc  -Wl,--export=free  /home/node/llhttp/build/c/*.c  /home/node/llhttp/src/native/*.c  -I/home/node/llhttp/build  -o /home/node/llhttp/build/wasm/llhttp.wasm
    at checkExecSyncError (child_process.js:616:11)
    at Object.execSync (child_process.js:652:15)
    at Object.<anonymous> (/home/node/llhttp/bin/build_wasm.ts:53:1)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    ...

Solution

For me on an M1 mac, the solution was to change the package.json
from:
"prebuild-wasm": "docker build -t llhttp_wasm_builder . && npm run wasm -- --setup",
to:
"prebuild-wasm": "docker build --platform=linux/amd64 -t llhttp_wasm_builder . && npm run wasm -- --setup",

If you are not on an M1 mac, you'll need to specify the correct architecture for yourself

@ShogunPanda
Copy link
Contributor

Hello! I would love to fix this, but I'm not sure how.
I'm not sure how we can reliably detect this, so the user will have to enter this anyway I guess.
I'm leaning towards a script which will run the current command with an additional CLI and/or prompt option.

@mcollina @RafaelGSS WDYT?

@RafaelGSS
Copy link
Member

Well, it seems we need to adjust it in the nodejs build pipeline, to call the generate based on the binary platform, and in this repository always wait for a platform input.

Maybe, to avoid breaking change, use --platform=linux/amd64 by default.

@ShogunPanda
Copy link
Contributor

@jd-carroll I've created #215 to give a workaround for this. Can you try it and tell me if it makes easier to fix your problem?

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 a pull request may close this issue.

3 participants