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

Fails to build on Apple Silicon devices (Arm64) #36

Open
john-terrell opened this issue Dec 29, 2021 · 4 comments
Open

Fails to build on Apple Silicon devices (Arm64) #36

john-terrell opened this issue Dec 29, 2021 · 4 comments

Comments

@john-terrell
Copy link

On an Apple Silicon Mac:

$ npm install imagemin-optipng --save-dev

...

Undefined symbols for architecture arm64:
npm ERR! "_png_init_filter_functions_neon", referenced from:
npm ERR! _png_read_filter_row in libpng.a(pngrutil.o)
npm ERR! ld: symbol(s) not found for architecture arm64

@rubnogueira
Copy link

rubnogueira commented Dec 6, 2022

@john-terrell
Running with the following env variable made the trick for me.
export CPPFLAGS="-DPNG_ARM_NEON_OPT=0"
or
CPPFLAGS="-DPNG_ARM_NEON_OPT=0" npm install imagemin-optipng --save-dev

For reference, I was able to install v6.0.0 without this flag.

@stevethemacguy
Copy link

Is this something that can be integrated into imagemin-optipng so devs don't have to figure this out the hard way? Several of our devs lost hours on this. A normal npm install worked on my M1 mac without any flags, but not on theirs. Thank you.

@luizfm
Copy link

luizfm commented Sep 6, 2023

@john-terrell Running with the following env variable made the trick for me. export CPPFLAGS="-DPNG_ARM_NEON_OPT=0" or CPPFLAGS="-DPNG_ARM_NEON_OPT=0" npm install imagemin-optipng --save-dev

For reference, I was able to install v6.0.0 without this flag.

This one worked for me as well. I needed to run with the flag on my M1 in the lib version 8.0.0, using Node.js 14.20.0 on an application. Thanks!

@pboling
Copy link

pboling commented Dec 24, 2024

The solution above worked for me, building the package in Docker on Apple Silicon.

export CPPFLAGS="-DPNG_ARM_NEON_OPT=0"

Node v22.12.0

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

No branches or pull requests

5 participants