Open sethsamuel opened 2 years ago
I am also seeing segfaults, but when running parcel build on RHEL 7. The build produces usable and working files, but then instead of a normal exit it segfaults.
I'm experiencing this as well.
My Dockerfile
is based on: FROM python:3.9-alpine3.14
The project's package.json
uses "parcel": "^2.0.1"
.
Since this is a blocker, I'm going to just have to switch to something other than Parcel for now, unless someone knows of a workaround.
Please try the nightly. I fixed some seg faults recently
I had a little journey trying to make parcel work within a docker container on m1 mac. First of all, I tried to migrate an existing project from v1 to v2 (2.0.1
), but when I ran yarn build index.html
I had this segfault error. The binary seemed to work partially since I was able to run yarn parcel --help
and yarn parcel --version
. Also tried parcel@2.0.0-nightly.949
and parcel@2.0.0-nightly.951
versions without any luck.
After experimenting with project changes, I started trying to make it work inside a container for a new empty project which was set as described at https://parceljs.org/getting-started/webapp/
Finally I was able to run parcel build
successfully within node:12.7-alpine3.12
image from https://hub.docker.com/_/node (no luck with arm64v8/node
containers)
I also set up a new project inside Ubuntu Arm virtual machine and built it without any issues both with 16 and 17 node versions.
uname -m
output inside every container I ran and inside Ubuntu vm was aarch64
Please try the nightly. I fixed some seg faults recently
Still getting segmentation fault with the above Dockerfile and parcel@2.0.0-nightly.957+13649c36
Segfaults are fixed as of 2.2.1 for base parcel, but now having a problem with parcel-image:
Error: Error relocating
/app/node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node:
__crc32w: symbol not found
This still occurs on 2.0.0-nightly.984.
FYI, we're seeing the same issue as @sethsamuel. We were initially seeing segfaults when trying to run on M1 macs, and now encountering the same error.
Any updates or known workarounds here?
Does it help to set the environment variable PARCEL_WORKER_BACKEND=process
?
On 2.2.1 setting that env var doesn't have any affect. If I upgrade to 2.3.2, I hit #7234 and can't test this issue.
I was able to workaround the latest iteration of this issue by disabling the image optimizer, since we aren't using it, but for those who need it the crash is still occurring in 2.3.2 with or without PARCEL_WORKER_BACKEND=process
Still occurring in 2.4.1 with or without PARCEL_WORKER_BACKEND=process
and like you I've also disabled image optimiser for now.
/node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: __crc32w: symbol not found
any update on this ?
Still happening with:
Host: Apple M1 Mac Monterey Parcel: 2.7.0 Container from: node:18-alpine3.16 Docker version 20.10.17, build 100c701
I'm going to use node:18-slim, can't find any solution to the issue :-(
FYI, I'm on parcel 2.7.0 (building from node:16-alpine
) and still getting segfaults
Trying to recreate this
I'm on an M1 MacBook running docker 20.10.20, installing Parcel version 2.8.0. Building the image with docker and running the parcel CLI against a project mounted in a volume works without issue.
Command list
# Environment details
uname -mor
# Create Dockerfile
echo "FROM node:alpine" > dockerfile
echo "RUN apk add --no-cache build-base python3 && apk add --no-cache gcc g++" >> dockerfile
echo "RUN npm i -g parcel" >> dockerfile
echo "CMD parcel" >> dockerfile
# Build image
docker build -t parcel-cli .
docker run --rm -v $PWD:/app -w /app parcel-cli parcel --version
# Create bundle and build it
echo "console.log('foo')" > index.js
docker run --rm -v $PWD:/app -w /app parcel-cli parcel build index.js
# Output
ls
Result
$ uname -mor
Darwin 22.1.0 arm64
$ echo "FROM node:alpine" > dockerfile
$ echo "RUN apk add --no-cache build-base python3 && apk add --no-cache gcc g++" >> dockerfile
$ echo "RUN npm i -g parcel" >> dockerfile
$ echo "CMD parcel" >> dockerfile
$ docker build -t parcel-cli .
Sending build context to Docker daemon 2.048kB
Step 1/4 : FROM node:alpine
---> 13abfa428daf
Step 2/4 : RUN apk add --no-cache build-base python3 && apk add --no-cache gcc g++
[ ... redacted ]
Successfully built cc6ac558e5f2
Successfully tagged parcel-cli:latest
$ docker run --rm -v $PWD:/app -w /app parcel-cli parcel --version
2.8.0
$ echo "console.log('foo')" > index.js
$ docker run --rm -v $PWD:/app -w /app parcel-cli parcel build index.js
^[[55;214RBuilding...
Bundling...
Packaging & Optimizing...
✨ Built in 565ms
dist/index.js 54 B 71ms;214Rll
$ ls
dist dockerfile index.js
$ ls dist
index.js index.js.map
$ node dist/index.js
foo
I also tried this on a linux-arm64
VM and it also worked fine
FROM node:18.12.1-alpine3.16 ... Parcel 2.8 ...
@drmax24 Same FROM - during parcel build
inside the Dockerfile - during docker build
- same symbol not found
#42 32.18 Error: Error relocating
#42 32.18 /project/clients/frontends/node_modules/.pnpm/@parcel+optimizer-image@2.8.0_@parcel+core@2.8.0/node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node:
#42 32.18 __crc32w: symbol not found
#42 32.18
#42 32.18 Error: Error relocating
#42 32.18 /proeject/clients/frontends/node_modules/.pnpm/@parcel+optimizer-image@2.8.0_@parcel+core@2.8.0/node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node:
#42 32.18 __crc32w: symbol not found
And also tried node:18.12.1-alpine3.17 - same there
parcel build
OUTSIDE the docker build
on the zsh works perfect on Silicon
I'm commenting here because #8790 is closed by @mischnic, instructing to follow here.
After resolving a failing build on ARM64 Graviton2 caused by huge memory usage (see comment at #5072), we had "the symbol not found" error as stated before.
node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: __crc32w: symbol not found
Disabling image optimization works-around the issue, but of course is not desired as permanent. It smells like something is wrong with the parcel arm64-musl build. After some research, I've found an interesting QA on SO:
Q: Does Clang lack CRC32 for ARMv8/Aarch64?
A: (...) According to ARM's document ("ARM® Architecture Reference Manual ARMv8, for ARMv8-A architecture profile" DDI0487B_a_armv8_arm.pdf: page A1-58), crc32 instructions are optional for v8 and mandatory for v8.1. (...)
For me, it seems some ARM flag is need at compile time. I would like to dive into, but would help some guidance about parcel's internals so I can compile optimizer-image by my own means. Are there any docs where I can research further?
@lorenzogrv
Clone the repo, run yarn
in the root, go into this directory https://github.com/parcel-bundler/parcel/tree/v2/packages/optimizers/image, and run yarn build
or yarn build-release
. That will create the file parcel-image.darwin-x64.node
(or whatever target you're on).
The napi
CLI will internally call cargo build
(or some version of that), so you'll need to figure out how to set these ARM flags for Rust. Maybe something like https://rust-lang.github.io/packed_simd/perf-guide/target-feature/rustflags.html
If you have figured out what has to be set, we can see how to set that flag conditionally only on ARM.
I dived a bit today.
I could setup a dev environment for amd64 following your tips with success, but still need to figure out how to set up some of your dependencies within the native arm64 environment.
Sharing here the build PoC I've used for future visitors. Infra summary (docker buildx ls
):
NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
buildx * docker-container
buildx0 unix:///var/run/docker.sock running v0.11.2 linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/386
buildx1 ssh://[MASKED] running v0.11.2 linux/arm64*, linux/arm/v7, linux/arm/v6
default docker
default default running 20.10.22 linux/amd64, linux/386
Build log from docker build --progress=plain --platform arm64 .
(Note: buildx as default build engine)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs.
@mischnic Please reopen. Did not have time to dive more
It's dynamically depends on some libs.
/app # ldd node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node
/lib/ld-musl-aarch64.so.1 (0xffff89b2d000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0xffff899bb000)
libc.so => /lib/ld-musl-aarch64.so.1 (0xffff89b2d000)
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_get_global: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_get_value_string_utf8: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: __crc32w: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_get_cb_info: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_create_object: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_get_undefined: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_create_buffer: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_call_threadsafe_function: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_set_named_property: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_get_named_property: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_coerce_to_string: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_create_error: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_create_buffer_copy: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_create_external_buffer: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: __crc32d: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: __crc32b: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: __crc32h: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_get_buffer_info: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_add_env_cleanup_hook: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_throw_error: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_typeof: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_delete_reference: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_call_function: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: __crc32cw: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_create_string_utf8: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_throw: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_create_function: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_get_reference_value: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_get_and_clear_last_exception: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_define_class: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_create_threadsafe_function: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_create_reference: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_reference_unref: symbol not found
Error relocating node_modules/@parcel/optimizer-image/parcel-image.linux-arm64-musl.node: napi_unref_threadsafe_function: symbol not found
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs.
🐛 bug report
Running parcel in an alpine Docker container on an M1 Mac results in a Segmentation Fault.
🎛 Configuration (.babelrc, package.json, cli command)
🤔 Expected Behavior
Parcel should run without crashing.
😯 Current Behavior
Parcel segfaults.
Running gdb:
💁 Possible Solution
Possibly the prebuilt binary isn't M1 compatible.
🔦 Context
💻 Code Sample
🌍 Your Environment