mozjpeg pre-build test failed
not sure if I should be posting this here or in mozjpeg but mozjpeg is failing for me on OS X 10.11:
[email protected] postinstall /Users/xxx/Sites/white-label/node_modules/gulp-imagemin/node_modules/imagemin-optipng/node_modules/optipng-bin
> node lib/install.js
✔ optipng pre-build test passed successfully
> [email protected] postinstall /Users/xxx/Sites/white-label/node_modules/gulp-imagemin/node_modules/imagemin-mozjpeg/node_modules/mozjpeg
> node lib/install.js
⚠ The `/Users/xxx/Sites/white-label/node_modules/gulp-imagemin/node_modules/imagemin-mozjpeg/node_modules/mozjpeg/vendor/cjpeg` binary doesn't seem to work correctly
⚠ mozjpeg pre-build test failed
ℹ compiling from source
✖ Error: autoreconf -fiv && ./configure --disable-shared --prefix="/Users/xxx/Sites/white-label/node_modules/gulp-imagemin/node_modules/imagemin-mozjpeg/node_modules/mozjpeg/vendor" --bindir="/Users/xxx/Sites/white-label/node_modules/gulp-imagemin/node_modules/imagemin-mozjpeg/node_modules/mozjpeg/vendor" --libdir="/Users/xxx/Sites/white-label/node_modules/gulp-imagemin/node_modules/imagemin-mozjpeg/node_modules/mozjpeg/vendor" && make --jobs=8 && make install --jobs=8
Command failed: /bin/sh -c autoreconf -fiv
/bin/sh: autoreconf: command not found
at ChildProcess.exithandler (child_process.js:213:12)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:827:16)
at Socket.<anonymous> (internal/child_process.js:319:11)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at Pipe._onclose (net.js:477:12)
> [email protected] postinstall /Users/xxx/Sites/white-label/node_modules/gulp-imagemin/node_modules/imagemin-gifsicle/node_modules/gifsicle
> node lib/install.js
✔ gifsicle pre-build test passed successfully
$ nasm -v
NASM version 0.98.40 (Apple Computer, Inc. build 11) compiled on Feb 10 2016
https://github.com/mozilla/mozjpeg/blob/da75d56d6c71fcf33cca2118065af13409fe35d4/BUILDING.txt#L21-L22
Can you update NASM and try installation again?
NASM version 2.12.01 compiled on Mar 23 2016
✔ optipng pre-build test passed successfully
> [email protected] postinstall /Users/billshackelford/Sites/white-label/node_modules/gulp-imagemin/node_modules/imagemin-mozjpeg/node_modules/mozjpeg
> node lib/install.js
⚠ The `/Users/billshackelford/Sites/white-label/node_modules/gulp-imagemin/node_modules/imagemin-mozjpeg/node_modules/mozjpeg/vendor/cjpeg` binary doesn't seem to work correctly
⚠ mozjpeg pre-build test failed
ℹ compiling from source
✖ Error: autoreconf -fiv && ./configure --disable-shared --prefix="/Users/billshackelford/Sites/white-label/node_modules/gulp-imagemin/node_modules/imagemin-mozjpeg/node_modules/mozjpeg/vendor" --bindir="/Users/billshackelford/Sites/white-label/node_modules/gulp-imagemin/node_modules/imagemin-mozjpeg/node_modules/mozjpeg/vendor" --libdir="/Users/billshackelford/Sites/white-label/node_modules/gulp-imagemin/node_modules/imagemin-mozjpeg/node_modules/mozjpeg/vendor" && make --jobs=8 && make install --jobs=8
Command failed: /bin/sh -c autoreconf -fiv
/bin/sh: autoreconf: command not found
at ChildProcess.exithandler (child_process.js:213:12)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:827:16)
at Socket.<anonymous> (internal/child_process.js:319:11)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at Pipe._onclose (net.js:477:12)
> [email protected] postinstall /Users/billshackelford/Sites/white-label/node_modules/gulp-imagemin/node_modules/imagemin-gifsicle/node_modules/gifsicle
> node lib/install.js
✔ gifsicle pre-build test passed successfully
/bin/sh: autoreconf: command not found
http://stackoverflow.com/questions/9575989/install-autoreconf-on-osx-lion
Anyway, the prebuilt binary should work. In my OS X 10.11.4 (15E65) npm install mozjpeg shows the message "optipng pre-build test passed successfully" as I expected. I don't know the root cause of the installation failure in your OS.
Mine is a fresh install of os x 10.11.4
I also have the latest Xcode updates
Hi - I'm getting exactly the same error on OS X 10.11.4, with NASM version 2.12.01.
@bshack @nathangaw Could you try to build mozjpeg from the v3.1 source in your OS https://github.com/mozilla/mozjpeg/releases/tag/v3.1, then provide me the built binary?
If you successfully build the mozjpeg binary and it works on both my Mac and yours, I'll replace the current binary with the newly built one.
I'm having the same error, it used to work fine, but after the Xcode Update this got broken 😢
@shinnn are you able to reproduce this issue after installing all the latest xcode updates?
@bshack No.
Also I added OSX test to the mozjpeg npm package in https://github.com/imagemin/mozjpeg-bin/commit/b0bd5cdd7fc276891701642584ad9bb2422178a0. It runs with OSX v10.11 and Xcode v7.3 and, in contrast to @mike3run's comment https://github.com/imagemin/imagemin/issues/168#issuecomment-217732098, it passes the build test.
hmm.. not sure what is up. I am rolling back to 2.x.x for my stuff.
I can tell you what was the difference with mine a probably the OP.
I always npm-cache install to help with load times, but this time besides the xcode update i had deleted all of my node projects so the install was made from scratch and no catching was done.
Then I think that's where the problem is, try running that without having any other functional imagemin on your computer :)
Try running also node node_modules/mozjpeg/lib/install.js to try the build manually
I got a similar error. Here's what I did to fix it; hopefully this helps someone else!
- Update Xcode command line tools to latest release
-
brew install nasm(I was using the bundled OS X version 0.98.40, now using 2.11.08) -
npm cache clean -
npm install
Still getting an error with the cjpeg binary, but the build from source works now.
What @chrisvanpatten did worked for me as well.
The binary fails but then the build from source works. :)
How do you build from source on OS X?
I'm still getting - /node_modules/imagemin-mozjpeg/node_modules/mozjpeg/vendor/cjpeg` binary doesn't seem to work correctly
node node_modules/imagemin-mozjpeg/node_modules/mozjpeg/lib/install.js
⚠ mozjpeg pre-build test failed ℹ compiling from source ✖ Error: autoreconf -fiv && ./configure --disable-shared --prefix=/node_modules/imagemin-mozjpeg/node_modules/mozjpeg/vendor" --bindir="/node_modules/imagemin-mozjpeg/node_modules/mozjpeg/vendor" --libdir="./node_modules/imagemin-mozjpeg/node_modules/mozjpeg/vendor" && make --jobs=8 && make install --jobs=8 Command failed: /bin/sh -c autoreconf -fiv autoreconf: Entering directory `.' autoreconf: configure.ac: not using Gettext autoreconf: running: aclocal --output=aclocal.m4t Can't exec "aclocal": No such file or directory at /usr/local/Cellar/autoconf/2.69/share/autoconf/Autom4te/FileUtils.pm line 326. autoreconf: failed to run aclocal: No such file or directory
at ChildProcess.exithandler (child_process.js:213:12)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:827:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
You can try what @chrisvanpatten said 2 comments above yours or you could also use node LTS version which is 4.4.5
Apparently there are tons of bugs running Node 6.0 +
So unless you're an active node dev you should stay on 4.4.5 :)
Already did what @chrisvanpatten said and my node version is 4.4.4.
Chris also says to do build from source. How do you do that?
Okay so just try to npm install imagemin again :)
That worked for me but you could also cd into node_modules > mozjpeg > test and run node test
That should try to build it but you need to have done what @chrisvanpatten said
cjpeg managed to build from source after I installed a newer version of nasm via MacPorts. However, cjpeg now exits with a segmentation fault when invoked from a parent dir, or is unable to process a JPEG file when invoked from its dir:
$ ./node_modules/imagemin-mozjpeg/node_modules/mozjpeg/vendor/cjpeg ~/Downloads/test.jpg
Segmentation fault: 11
$ cd node_modules/imagemin-mozjpeg/node_modules/mozjpeg/vendor
$ ./cjpeg ~/Downloads/test.jpg
Unrecognized input file format --- perhaps you need -targa
Any suggestions please? OS X 10.12 here.
Update: Installing mozjpeg first via npm install mozjpeg also leads to building from source but seems to produce a non-faulty cjpeg.
I don't know if @bshack is still having problems with that, but I was struggling with the same problem yesterday and I think that I've found a solution.
My Scenario: building a project that uses imagemin inside a docker container using alpine linux.
Solution: install the following alpine packages:
- libpng-dev
- autoconf
- automake
- make
- g++
- libtool
- nasm
After installing that, I was able to compile the binaries.
I don't know if it helps, but I'm adding it here, so anyone can try this when having same problems.
This bug reproduced on CentOS 6.8 witn node.js v6.9.4.
But when I install yum install wget autoconf automake gcc nasm libtool, I successfully compiled mozjpeg
[email protected] postinstall /home/bitrix/serv_opti/node_modules/mozjpeg node lib/install.js
⚠ The /home/bitrix/serv_opti/node_modules/mozjpeg/vendor/cjpeg binary doesn't seem to work correctly
⚠ mozjpeg pre-build test failed
ℹ compiling from source
✔ mozjpeg built successfully
This fixed the source build for me on Mac Sierra:
sudo port install automake autoconf libtool dpkg pkgconfig nasm
On Ubuntu 16.04, sudo apt install nasm worked for me!
hey guys did you try this ? https://github.com/mozilla/mozjpeg/issues/99#issuecomment-52628719
On MacOS 10.11.6, I did this
brew install automake autoconf libtool dpkg pkgconfig nasm libpng