imagemin / jpegtran-bin

jpegtran bin-wrapper that makes it seamlessly available as a local dependency
http://libjpeg-turbo.virtualgl.org
MIT License
93 stars 47 forks source link

Compilation fails #83

Open armpogart opened 7 years ago

armpogart commented 7 years ago

We are using gulp-imagemin but this issue is related exactly to jpegtran. We have a build system running in docker container and base on node:alpine, recently it started to fail. The minimal case to replicate the problem.

  1. docker run -it node:alpine /bin/sh Install some build dependencies
  2. apk add --update --no-cache make g++ automake autoconf libtool nasm libjpeg-turbo-dev
  3. npm install jpegtran-bin

We get following output that is worth mentioning

jpegtran-bin@3.2.0 postinstall /node_modules/jpegtran-bin
node lib/install.js
spawn /node_modules/jpegtran-bin/vendor/jpegtran ENOENT
jpegtran pre-build test failed
compiling from source
Error: touch configure.ac aclocal.m4 configure Makefile.am Makefile.in && ./configure --disable-shared --prefix="/node_modules/jpegtran-bin/vendor" --bindir="/node_modules/jpegtran-bin/vendor" && make install
Command failed: ./configure --disable-shared --prefix="/node_modules/jpegtran-bin/vendor" --bindir="/node_modules/jpegtran-bin/vendor"
/bin/sh: ./configure: Permission denied

    at ChildProcess.exithandler (child_process.js:270:12)
    at emitTwo (events.js:125:13)
    at ChildProcess.emit (events.js:213:7)
    at maybeClose (internal/child_process.js:927:16)
    at Socket.stream.socket.on (internal/child_process.js:348:11)
    at emitOne (events.js:115:13)
    at Socket.emit (events.js:210:7)
    at Pipe._handle.close [as _onclose] (net.js:545:12)

Previously it was running ok on the same build system. I can't say exactly when it first started to fail as I was using cache and I have noticed the problem after cleaning the cache.

ArtNattapat commented 6 years ago

i found this too. i think it happened because download server is down. when it happened, i tried to download with command download (using package download-cli like bin-build use)

download https://downloads.sourceforge.net/project/libjpeg-turbo/1.5.1/libjpeg-turbo-1.5.1.tar.gz

and result is

<html><head>
<title>SourceForge</title>
<!-- <script src="/js/jquery.com/jquery-1.11.0.min.js"></script> -->
<script src="https://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="https://sourceforge.net/js/mirrors.js"></script>
<script src="/js/sf.js"></script>
<script>
var DR_loc = DR_parse_hash_url();
if (DR_loc) {
    DR_sf_main(DR_loc);
} else {
    window.location.href = 'https://sourceforge.net/home.html';
}
</script>
</head><body>
<noscript>
We're sorry -- the Sourceforge site is currently in Disaster Recovery mode, and currently requires
the use of javascript to function.  Please check back later.
</noscript>
</body></html>

however i can download directly by chrome browser.

then 10 hours later i tried to install jpegtran-bin again and compile from source is successful. i think it should unable to install when have some error.

GabLeRoux commented 5 years ago

I can confirm the following Dockerfile works right now:

FROM node:alpine
RUN apk add --update --no-cache \
  make \
  g++ \
  automake \
  autoconf \
  libtool \
  nasm \
  libjpeg-turbo-dev
RUN npm install jpegtran-bin
docker build . -t gableroux/jpegtran-bin
Sending build context to Docker daemon  2.048kB
Step 1/3 : FROM node:alpine
 ---> 1df31d366c81
Step 2/3 : RUN apk add --update --no-cache   make   g++   automake   autoconf   libtool   nasm   libjpeg-turbo-dev
 ---> Running in 93d3b96f8746
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
(1/28) Installing m4 (1.4.18-r1)
(2/28) Installing libbz2 (1.0.6-r6)
(3/28) Installing perl (5.26.3-r0)
(4/28) Installing autoconf (2.69-r2)
(5/28) Installing automake (1.16.1-r0)
(6/28) Installing binutils (2.30-r5)
(7/28) Installing gmp (6.1.2-r1)
(8/28) Installing isl (0.18-r0)
(9/28) Installing libgomp (6.4.0-r9)
(10/28) Installing libatomic (6.4.0-r9)
(11/28) Installing pkgconf (1.5.3-r0)
(12/28) Installing mpfr3 (3.1.5-r1)
(13/28) Installing mpc1 (1.0.3-r1)
(14/28) Installing gcc (6.4.0-r9)
(15/28) Installing musl-dev (1.1.19-r10)
(16/28) Installing libc-dev (0.7.1-r0)
(17/28) Installing g++ (6.4.0-r9)
(18/28) Installing libjpeg-turbo (1.5.3-r3)
(19/28) Installing libjpeg-turbo-dev (1.5.3-r3)
(20/28) Installing ncurses-terminfo-base (6.1_p20180818-r1)
(21/28) Installing ncurses-terminfo (6.1_p20180818-r1)
(22/28) Installing ncurses-libs (6.1_p20180818-r1)
(23/28) Installing readline (7.0.003-r0)
(24/28) Installing bash (4.4.19-r1)
Executing bash-4.4.19-r1.post-install
(25/28) Installing libltdl (2.4.6-r5)
(26/28) Installing libtool (2.4.6-r5)
(27/28) Installing make (4.2.1-r2)
(28/28) Installing nasm (2.13.03-r0)
Executing busybox-1.28.4-r1.trigger
OK: 216 MiB in 43 packages
Removing intermediate container 93d3b96f8746
 ---> abdca257d685
Step 3/3 : RUN npm install jpegtran-bin
 ---> Running in d78899f4ab70

> jpegtran-bin@4.0.0 postinstall /node_modules/jpegtran-bin
> node lib/install.js

  ⚠ spawn /node_modules/jpegtran-bin/vendor/jpegtran ENOENT
  ⚠ jpegtran pre-build test failed
  ℹ compiling from source
  ✔ jpegtran built successfully
npm WARN saveError ENOENT: no such file or directory, open '/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/package.json'
npm WARN !invalid#1 No description
npm WARN !invalid#1 No repository field.
npm WARN !invalid#1 No README data
npm WARN !invalid#1 No license field.

+ jpegtran-bin@4.0.0
added 212 packages from 70 contributors and audited 713 packages in 75.041s
found 0 vulnerabilities

Removing intermediate container d78899f4ab70
 ---> b140aab5a66e
Successfully built b140aab5a66e
Successfully tagged gableroux/jpegtran-bin:latest

👍