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

mozjpeg not support on centos 7 #78

Open
liudonghua123 opened this issue Feb 16, 2023 · 1 comment
Open

mozjpeg not support on centos 7 #78

liudonghua123 opened this issue Feb 16, 2023 · 1 comment

Comments

@liudonghua123
Copy link

I tried to install mozjpeg on centos 7 via npm install mozjpeg -g, the installation is successfully, but the binary could not run.

[root@localhost lib64]# mozjpeg --version
/usr/lib/node_modules/mozjpeg/vendor/cjpeg: /lib64/libz.so.1: version `ZLIB_1.2.9' not found (required by /usr/lib/node_modules/mozjpeg/vendor/cjpeg)
[root@localhost lib64]# ldd /usr/lib/node_modules/mozjpeg/vendor/cjpeg
/usr/lib/node_modules/mozjpeg/vendor/cjpeg: /lib64/libz.so.1: version `ZLIB_1.2.9' not found (required by /usr/lib/node_modules/mozjpeg/vendor/cjpeg)
	linux-vdso.so.1 =>  (0x00007ffc035fd000)
	libz.so.1 => /lib64/libz.so.1 (0x00007f5b6d993000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f5b6d691000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f5b6d2c3000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f5b6dba9000)
[root@localhost lib64]# ll /lib64/libz.so*
lrwxrwxrwx. 1 root root    13 Nov 21 16:52 /lib64/libz.so -> libz.so.1.2.7
lrwxrwxrwx. 1 root root    13 Feb 16 10:49 /lib64/libz.so.1 -> libz.so.1.2.7
-rwxr-xr-x. 1 root root 90160 May 12  2022 /lib64/libz.so.1.2.7
[root@localhost lib64]# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

[root@localhost lib64]#
@liudonghua123
Copy link
Author

liudonghua123 commented Feb 16, 2023

However, if I replace /usr/lib/node_modules/mozjpeg/vendor/cjpeg with the previous version of cjpeg, then it seems worked.

[root@localhost ~]# ldd cjpeg_1
	linux-vdso.so.1 =>  (0x00007ffcb3f4d000)
	libz.so.1 => /lib64/libz.so.1 (0x00007f6530d26000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f6530a24000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f6530656000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f6530f3c000)
[root@localhost ~]#
[root@localhost ~]# ./cjpeg_1 -version
mozjpeg version 3.3.1 (build 20180508)
[root@localhost ~]#
[root@localhost ~]# cp ~/cjpeg_1 /usr/lib/node_modules/mozjpeg/vendor/cjpeg 
cp: overwrite ‘/usr/lib/node_modules/mozjpeg/vendor/cjpeg’? y
[root@localhost ~]# mozjpeg --version
/usr/lib/node_modules/mozjpeg/vendor/cjpeg: unknown option '-version'
usage: /usr/lib/node_modules/mozjpeg/vendor/cjpeg [switches] [inputfile]
Switches (names may be abbreviated):
  -quality N[,...]   Compression quality (0..100; 5-95 is most useful range,
                     default is 75)
  -grayscale     Create monochrome JPEG file
  -rgb           Create RGB JPEG file
  -optimize      Optimize Huffman table (smaller file, but slow compression, enabled by default)
  -progressive   Create progressive JPEG file (enabled by default)
  -baseline      Create baseline JPEG file (disable progressive coding)
  -targa         Input file is Targa format (usually not needed)
  -revert        Revert to standard defaults (instead of mozjpeg defaults)
  -fastcrush     Disable progressive scan optimization
  -dc-scan-opt   DC scan optimization mode
                 - 0 One scan for all components
                 - 1 One scan per component (default)
                 - 2 Optimize between one scan for all components and one scan for 1st component
                     plus one scan for remaining components
  -notrellis     Disable trellis optimization
  -trellis-dc    Enable trellis optimization of DC coefficients (default)
  -notrellis-dc  Disable trellis optimization of DC coefficients
  -tune-psnr     Tune trellis optimization for PSNR
  -tune-hvs-psnr Tune trellis optimization for PSNR-HVS (default)
  -tune-ssim     Tune trellis optimization for SSIM
  -tune-ms-ssim  Tune trellis optimization for MS-SSIM
Switches for advanced users:
  -noovershoot   Disable black-on-white deringing via overshoot
  -arithmetic    Use arithmetic coding
  -dct int       Use integer DCT method (default)
  -dct fast      Use fast integer DCT (less accurate)
  -dct float     Use floating-point DCT method
  -quant-baseline Use 8-bit quantization table entries for baseline JPEG compatibility
  -quant-table N Use predefined quantization table N:
                 - 0 JPEG Annex K
                 - 1 Flat
                 - 2 Custom, tuned for MS-SSIM
                 - 3 ImageMagick table by N. Robidoux
                 - 4 Custom, tuned for PSNR-HVS
                 - 5 Table from paper by Klein, Silverstein and Carney
  -restart N     Set restart interval in rows, or in blocks with B
  -smooth N      Smooth dithered input (N=1..100 is strength)
  -maxmemory N   Maximum memory to use (in kbytes)
  -outfile name  Specify name for output file
  -memdst        Compress to memory instead of file (useful for benchmarking)
  -verbose  or  -debug   Emit debug output
  -version       Print version information and exit
Switches for wizards:
  -qtables FILE  Use quantization tables given in FILE
  -qslots N[,...]    Set component quantization tables
  -sample HxV[,...]  Set component sampling factors
  -scans FILE    Create multi-scan JPEG per script FILE
[root@localhost ~]#

If you try to build from source, it will failed.

[root@localhost jeecgboot-vue3]# pnpm install
Lockfile is up to date, resolution step is skipped
Packages: +1565
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Packages are copied from the content-addressable store to the virtual store.
  Content-addressable store is at: /root/.local/share/pnpm/store/v3
  Virtual store is at:             node_modules/.pnpm
Progress: resolved 1565, reused 1561, downloaded 0, added 1, done
node_modules/.pnpm/registry.npmmirror.com+mozjpeg@7.1.1/node_modules/mozjpeg: Running postinstall script, failed in 15.8s
.../node_modules/mozjpeg postinstall$ node lib/install.js
│ Command failed: /root/device_reservation_mgmt/jeecgboot-vue3/node_modules/.pnpm/registry.npmmirror.com+mozjpeg@7.1.1/node_modules/mozjpeg/vendor/cjpeg -version
│ /root/device_reservation_mgmt/jeecgboot-vue3/node_modules/.pnpm/registry.npmmirror.com+mozjpeg@7.1.1/node_modules/mozjpeg/vendor/cjpeg: /lib64/libz.so.1: version `ZLIB_1.2.9' not found (required by /root/device_reservation_mgmt/j
│ mozjpeg pre-build test failed
│ compiling from source
│ Error: Command failed: /bin/sh -c ./configure --enable-static --disable-shared --disable-dependency-tracking --with-jpeg8  --prefix="/root/device_reservation_mgmt/jeecgboot-vue3/node_modules/.pnpm/registry.npmmirror.com+mozjpeg@7
│ configure: error: no nasm (Netwide Assembler) found
│ checking for a BSD-compatible install... /usr/bin/install -c
│ checking whether build environment is sane... yes
│ checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
│ checking for gawk... gawk
│ checking whether make sets $(MAKE)... yes
│ checking whether make supports nested variables... yes
│ checking whether make supports nested variables... (cached) yes
│ checking for style of include used by make... GNU
│ 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 whether gcc understands -c and -o together... yes
│ checking dependency style of gcc... none
│ checking how to run the C preprocessor... gcc -E
│ checking for gcc... (cached) gcc
│ checking whether we are using the GNU C compiler... (cached) yes
│ checking whether gcc accepts -g... (cached) yes
│ checking for gcc option to accept ISO C89... (cached) none needed
│ checking whether gcc understands -c and -o together... (cached) yes
│ checking dependency style of gcc... (cached) none
│ checking for ar... ar
│ checking the archiver (ar) interface... ar
│ checking dependency style of gcc... none
│ checking the archiver (ar) interface... (cached) ar
│ checking build system type... x86_64-unknown-linux-gnu
│ checking host system type... x86_64-unknown-linux-gnu
│ checking how to print strings... printf
│ checking for a sed that does not truncate output... /usr/bin/sed
│ checking for grep that handles long lines and -e... /usr/bin/grep
│ checking for egrep... /usr/bin/grep -E
│ checking for fgrep... /usr/bin/grep -F
│ checking for ld used by gcc... /usr/bin/ld
│ checking if the linker (/usr/bin/ld) is GNU ld... yes
│ checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
│ checking the name lister (/usr/bin/nm -B) interface... BSD nm
│ checking whether ln -s works... yes
│ checking the maximum length of command line arguments... 1572864
│ checking whether the shell understands some XSI constructs... yes
│ checking whether the shell understands "+="... yes
│ checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
│ checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
│ checking for /usr/bin/ld option to reload object files... -r
│ checking for objdump... objdump
│ checking how to recognize dependent libraries... pass_all
│ checking for dlltool... no
│ checking how to associate runtime and link libraries... printf %s\n
│ checking for archiver @FILE support... @
│ checking for strip... strip
│ checking for ranlib... ranlib
│ checking command to parse /usr/bin/nm -B output from gcc object... ok
│ checking for sysroot... no
│ checking for mt... no
│ checking if : is a manifest tool... no
│ checking for ANSI C header files... yes
│ checking for sys/types.h... yes
│ checking for sys/stat.h... yes
│ checking for stdlib.h... yes
│ checking for string.h... yes
│ checking for memory.h... yes
│ checking for strings.h... yes
│ checking for inttypes.h... yes
│ checking for stdint.h... yes
│ checking for unistd.h... yes
│ checking for dlfcn.h... yes
│ checking for objdir... .libs
│ checking if gcc supports -fno-rtti -fno-exceptions... no
│ checking for gcc option to produce PIC... -fPIC -DPIC
│ checking if gcc PIC flag -fPIC -DPIC works... yes
│ checking if gcc static flag -static works... no
│ checking if gcc supports -c -o file.o... yes
│ checking if gcc supports -c -o file.o... (cached) yes
│ checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
│ checking dynamic linker characteristics... GNU/Linux ld.so
│ checking how to hardcode library paths into programs... immediate
│ checking whether stripping libraries is possible... yes
│ checking if libtool supports shared libraries... yes
│ checking whether to build shared libraries... no
│ checking whether to build static libraries... yes
│ checking whether ln -s works... yes
│ checking for pkg-config... /usr/bin/pkg-config
│ checking pkg-config is at least version 0.9.0... yes
│ checking size of size_t... 8
│ checking whether compiler supports pointers to undefined structures... yes
│ checking whether __SUNPRO_C is declared... no
│ checking for pow in -lm... yes
│ checking for libpng... yes
│ checking for ANSI C header files... (cached) yes
│ checking stddef.h usability... yes
│ checking stddef.h presence... yes
│ checking for stddef.h... yes
│ checking for stdlib.h... (cached) yes
│ checking locale.h usability... yes
│ checking locale.h presence... yes
│ checking for locale.h... yes
│ checking for string.h... (cached) yes
│ checking for sys/types.h... (cached) yes
│ checking for an ANSI C-conforming const... yes
│ checking whether char is unsigned... no
│ checking for inline... inline
│ checking for size_t... yes
│ checking for unsigned char... yes
│ checking for unsigned short... yes
│ checking if right shift is signed... yes
│ checking for memset... yes
│ checking for memcpy... yes
│ checking libjpeg API version... 8.0
│ checking libjpeg shared library version... 8.1.2
│ checking whether the linker supports version scripts... yes (GNU style)
│ checking whether to use version script when building mozjpeg... yes
│ checking for inline... inline __attribute__((always_inline))
│ checking whether to include arithmetic encoding support... yes
│ checking whether to include arithmetic decoding support... yes
│ checking whether to use 12-bit samples... no
│ checking whether to build TurboJPEG C wrapper... yes
│ checking whether to build TurboJPEG Java wrapper... no
│ checking if we have SIMD optimisations for cpu type... yes (x86_64)
│ checking for nasm... no
│ checking for nasmw... no
│ checking for yasm... no
│     at /root/device_reservation_mgmt/jeecgboot-vue3/node_modules/.pnpm/registry.npmmirror.com+execa@0.7.0/node_modules/execa/index.js:231:11
│     at runMicrotasks (<anonymous>)
│     at processTicksAndRejections (internal/process/task_queues.js:93:5)
│     at async Promise.all (index 0)
└─ Failed in 15.8s at /root/device_reservation_mgmt/jeecgboot-vue3/node_modules/.pnpm/registry.npmmirror.com+mozjpeg@7.1.1/node_modules/mozjpeg
 ELIFECYCLE  Command failed with exit code 1.
[root@localhost jeecgboot-vue3]# 

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

1 participant