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

Doesn't work on new Apple M1 chip #21

Open
cimmwolf opened this issue Feb 22, 2021 · 6 comments
Open

Doesn't work on new Apple M1 chip #21

cimmwolf opened this issue Feb 22, 2021 · 6 comments

Comments

@cimmwolf
Copy link

Hello. I have an error when install package. How can I use it on Apple Silicone?

yarn add v1.22.10
info No lockfile found.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...
error /Users/denis/Projects/Jpegoptim/node_modules/jpegoptim-bin: Command failed.
Exit code: 1
Command: node lib/install.js
Arguments: 
Directory: /Users/denis/Projects/Jpegoptim/node_modules/jpegoptim-bin
Output:
⚠ Command failed: /Users/denis/Projects/Jpegoptim/node_modules/jpegoptim-bin/vendor/jpegoptim --version
dyld: Library not loaded: /usr/local/opt/jpeg/lib/libjpeg.9.dylib
  Referenced from: /Users/denis/Projects/Jpegoptim/node_modules/jpegoptim-bin/vendor/jpegoptim
  Reason: no suitable image found.  Did find:
	/usr/local/opt/jpeg/lib/libjpeg.9.dylib: mach-o, but wrong architecture
	/opt/homebrew/Cellar/jpeg/9d/lib/libjpeg.9.dylib: mach-o, but wrong architecture


  ⚠ jpegoptim pre-build test failed
  ℹ compiling from source
  ✖ Error: Command failed: /bin/sh -c ./configure --prefix="/Users/denis/Projects/Jpegoptim/node_modules/jpegoptim-bin/vendor" --bindir="/Users/denis/Projects/Jpegoptim/node_modules/jpegoptim-bin/vendor"

checking build system type... arm-apple-darwin20.3.0
checking host system type... arm-apple-darwin20.3.0
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for a BSD-compatible install... /usr/bin/install -c
checking whether make sets $(MAKE)... yes
checking for jpeg_read_header in -ljpeg... no
Cannot find libjpeg or you have too old version (v6 or later required).

    at /Users/denis/Projects/Jpegoptim/node_modules/execa/index.js:231:11
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Promise.all (index 0)
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
@1000ch
Copy link
Member

1000ch commented Feb 28, 2021

@cimmwolf Would you try brew reinstall jpeg before installing jpegoptim-bin?

@Golmote
Copy link

Golmote commented Mar 4, 2021

Hello, I'm encountering the same issue. brew reinstall jpeg did not fix the issue for me.

@Golmote
Copy link

Golmote commented Mar 5, 2021

Hello again, thanks to help from the jpegoptim owner, I managed to install jpegoptim-bin but I had to set flags first:

CPPFLAGS="-I /opt/homebrew/Cellar/jpeg/9d/include" LDFLAGS="-L /opt/homebrew/Cellar/jpeg/9d/lib" npm install --save-dev jpegoptim-bin

This works, but any chance it could be detected and applied automatically?

@ramonfritsch
Copy link

Hello again, thanks to help from the jpegoptim owner, I managed to install jpegoptim-bin but I had to set flags first:

CPPFLAGS="-I /opt/homebrew/Cellar/jpeg/9d/include" LDFLAGS="-L /opt/homebrew/Cellar/jpeg/9d/lib" npm install --save-dev jpegoptim-bin

This works, but any chance it could be detected and applied automatically?

This helped me, changing 9d to 9e (probably a newer jpeg version) did the trick. Thanks!

@rynop
Copy link

rynop commented May 12, 2022

 CPPFLAGS="-I /opt/homebrew/Cellar/jpeg/9e/include" LDFLAGS="-L /opt/homebrew/Cellar/jpeg/9e/lib/" yarn add -DT jpegoptim-bin

^ works to get the package installed on my arm64 M1 (and into package.json), however other developers that come do a yarn install it fails with the same error.

The work-around I came up with is to run the following in an .*rc/bootstrap:

    export LDFLAGS="-L $(brew --prefix jpeg)/lib/"
    export CPPFLAGS="-I $(brew --prefix jpeg)/include"

Note: this accounts for brew version upgrades (9 d/e discrepancy that @ramonfritsch mentions)

Not ideal obviously.

@toFrankie
Copy link

👀

neilblair added a commit to dof-dss/nicsdru_nidirect_theme that referenced this issue Jul 14, 2023
To get theme running on new mac (M2), see:
imagemin/jpegoptim-bin#21
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

6 participants