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

不支持 centos 7 打包 #6614

Closed
liudonghua123 opened this issue Feb 16, 2023 · 4 comments
Closed

不支持 centos 7 打包 #6614

liudonghua123 opened this issue Feb 16, 2023 · 4 comments

Comments

@liudonghua123
Copy link
Contributor

版本号:

v3.4.4

问题描述:

在 Centos 7 上对前端项目执行 pnpm install 的时候报错,mozjpeg 安装失败

截图&代码:
[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/[email protected]/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/[email protected]/node_modules/mozjpeg/vendor/cjpeg -version
│ /root/device_reservation_mgmt/jeecgboot-vue3/node_modules/.pnpm/[email protected]/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/[email protected]/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/[email protected]/node_modules/mozjpeg
 ELIFECYCLE  Command failed with exit code 1.
[root@localhost jeecgboot-vue3]#
@liudonghua123
Copy link
Contributor Author

经过一些hacks,现在可以了,详情可以参考 imagemin/mozjpeg-bin#78

处理的方式

  1. replace /usr/lib/node_modules/mozjpeg/vendor/cjpeg with the previous version of https://raw.githubusercontent.com/imagemin/mozjpeg-bin/a4da0ca764ebf61cfc1b4a2a70efb779bc3b4395/vendor/linux/cjpeg

  2. vim node_modules/.pnpm/[email protected]/node_modules/mozjpeg/lib/index.js
    add {skipCheck: true} to BinWrapper()

[root@localhost jeecgboot-vue3]# pnpm why mozjpeg
Legend: production dependency, optional only, dev only

[email protected] /root/device_reservation_mgmt/jeecgboot-vue3

devDependencies:
vite-plugin-imagemin 0.6.1
└─┬ imagemin-mozjpeg 9.0.0
  └── mozjpeg 7.1.1
[root@localhost jeecgboot-vue3]#

@flowerburied
Copy link

这样搞不麻烦吗?瞎动依赖包,就没解决问题

@liudonghua123
Copy link
Contributor Author

liudonghua123 commented Mar 29, 2023

这样搞不麻烦吗?瞎动依赖包,就没解决问题

新的 cjpeg 已经不能在 centos 7 上编译/运行了,只能使用旧版的,这里也没有用到新版本的一些特性

这只是提供了一种解决我自己问题的方法,如果你有更好的方法,也可以pr

@kajweb
Copy link

kajweb commented Jul 5, 2023

升级ZLIB试过吗……

@zhangdaiscott zhangdaiscott transferred this issue from jeecgboot/JeecgBoot-vue3 Jun 21, 2024
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

3 participants