Skip to content

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

@jd-carroll

Description

@jd-carroll

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:

> [email protected] 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions