Closed IgorKowalczyk closed 1 month ago
$ cat /proc/cpuinfo
processor : 0
vendor_id : AuthenticAMD
cpu family : 20
model : 2
model name : AMD G-T56N Processor
stepping : 0
microcode : 0x5000101
cpu MHz : 1646.337
cache size : 512 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 6
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf pni monitor ssse3 cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch ibs skinit wdt hw_pstate vmmcall arat npt lbrv svm_lock nrip_save pausefilter
bugs : fxsave_leak sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass
bogomips : 3292.64
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management: ts ttp tm stc 100mhzsteps hwpstate
processor : 1
vendor_id : AuthenticAMD
cpu family : 20
model : 2
model name : AMD G-T56N Processor
stepping : 0
microcode : 0x5000101
cpu MHz : 1655.916
cache size : 512 KB
physical id : 0
siblings : 2
core id : 1
cpu cores : 2
apicid : 1
initial apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 6
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf pni monitor ssse3 cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch ibs skinit wdt hw_pstate vmmcall arat npt lbrv svm_lock nrip_save pausefilter
bugs : fxsave_leak sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass
bogomips : 3292.64
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management: ts ttp tm stc 100mhzsteps hwpstate
Please see https://github.com/lovell/sharp/issues/2723
I built libvips from source
$ pkg-config --modversion vips-cpp
8.15.3
and added
“config": {
“libvips": “8.15.3”
}
to package.json
and still node -e “require(‘sharp’)”
returns the same error.
Please see https://sharp.pixelplumbing.com/install#building-from-source and ensure all additional dependencies are made available at install time. Use the npm install --foreground-scripts
flag to force npm to display all decisions being taken.
$ npm install --foreground-scripts
(##################) ⠦ reify:@img/sharp-libvips-linux-x64: timing reifyNode:node_modules/node-gyp Completed in 3770ms
> sharp@0.33.5 install
> node install/check
sharp: Detected globally-installed libvips v8.15.3nux-x64: timing reifyNode:node_modules/node-gyp Completed in 3770ms
sharp: Attempting to build from source via node-gyp
sharp: Found node-addon-api 8.1.0
sharp: Found node-gyp 10.2.0:@img/sharp-libvips-linux-x64: timing reifyNode:node_modules/node-gyp Completed in 3770ms
sharp: See https://sharp.pixelplumbing.com/install#building-from-source
gyp info it worked if it ends with okrp-libvips-linux-x64: timing reifyNode:node_modules/node-gyp Completed in 3770ms
gyp info using node-gyp@10.2.0
gyp info using node@20.12.0 | linux | x64
gyp info chdir src
gyp info find Python using Python version 3.12.6 found at "/usr/bin/python3"node_modules/node-gyp Completed in 3770ms
(##################) ⠦ reify:@img/sharp-libvips-linux-x64: timing reifyNode:node_modules/node-gyp Completed in 3770ms
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args '/root/sharp/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/root/sharp/node_modules/sharp/src/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/root/sharp/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/root/.cache/node-gyp/20.12.0/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/20.12.0',
gyp info spawn args '-Dnode_gyp_dir=/root/sharp/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/20.12.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/root/sharp/node_modules/sharp/src',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
<string>:114: SyntaxWarning: invalid escape sequence '\/': timing reifyNode:node_modules/node-gyp Completed in 3770ms
gyp info spawn make) ⠦ reify:@img/sharp-libvips-linux-x64: timing reifyNode:node_modules/node-gyp Completed in 3770ms
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/root/sharp/node_modules/sharp/src/build'
CC(target) Release/obj.target/nothing/../../node-addon-api/nothing.o
rm -f Release/obj.target/../../node-addon-api/nothing.a Release/obj.target/../../node-addon-api/nothing.a.ar-file-list; mkdir -p `dirname Release/obj.target/../../node-addon-api/nothing.a`
ar crs Release/obj.target/../../node-addon-api/nothing.a @Release/obj.target/../../node-addon-api/nothing.a.ar-file-list
COPY Release/nothing.aeify:@img/sharp-libvips-linux-x64: timing reifyNode:node_modules/node-gyp Completed in 3770ms
TOUCH Release/obj.target/libvips-cpp.stamp
CXX(target) Release/obj.target/sharp-linux-x64/common.o: timing reifyNode:node_modules/node-gyp Completed in 3770ms
CXX(target) Release/obj.target/sharp-linux-x64/metadata.otiming reifyNode:node_modules/node-gyp Completed in 3770ms
CXX(target) Release/obj.target/sharp-linux-x64/stats.o4: timing reifyNode:node_modules/node-gyp Completed in 3770ms
CXX(target) Release/obj.target/sharp-linux-x64/operations.oming reifyNode:node_modules/node-gyp Completed in 3770ms
CXX(target) Release/obj.target/sharp-linux-x64/pipeline.otiming reifyNode:node_modules/node-gyp Completed in 3770ms
CXX(target) Release/obj.target/sharp-linux-x64/utilities.oiming reifyNode:node_modules/node-gyp Completed in 3770ms
CXX(target) Release/obj.target/sharp-linux-x64/sharp.o4: timing reifyNode:node_modules/node-gyp Completed in 3770ms
SOLINK_MODULE(target) Release/obj.target/sharp-linux-x64.nodeng reifyNode:node_modules/node-gyp Completed in 3770ms
COPY Release/sharp-linux-x64.nodeharp-libvips-linux-x64: timing reifyNode:node_modules/node-gyp Completed in 3770ms
TOUCH Release/obj.target/copy-dll.stamp
make: Leaving directory '/root/sharp/node_modules/sharp/src/build'reifyNode:node_modules/node-gyp Completed in 3770ms
gyp info ok
added 110 packages, and audited 111 packages in 2m
17 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
$ node -e "require('sharp')"
[1] 263242 illegal hardware instruction (core dumped) node -e "require('sharp')"
The displayed code is different this time.
What's the output of ldd node_modules/sharp/src/build/Release/sharp-linux-x64.node
?
linux-vdso.so.1 (0x00007f75b0563000)
libvips-cpp.so.42 => not found
libvips.so.42 => not found
libgio-2.0.so.0 => /lib64/libgio-2.0.so.0 (0x00007f75b0330000)
libgobject-2.0.so.0 => /lib64/libgobject-2.0.so.0 (0x00007f75b02d0000)
libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00007f75b0186000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f75afe00000)
libm.so.6 => /lib64/libm.so.6 (0x00007f75b00a3000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f75b007e000)
libc.so.6 => /lib64/libc.so.6 (0x00007f75afc1e000)
/lib64/ld-linux-x86-64.so.2 (0x00007f75b0565000)
libgmodule-2.0.so.0 => /lib64/libgmodule-2.0.so.0 (0x00007f75b0077000)
libz.so.1 => /lib64/libz.so.1 (0x00007f75b005d000)
libmount.so.1 => /lib64/libmount.so.1 (0x00007f75afbcd000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f75afba0000)
libffi.so.8 => /lib64/libffi.so.8 (0x00007f75afb90000)
libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007f75afaf5000)
libblkid.so.1 => /lib64/libblkid.so.1 (0x00007f75afab9000)
also
$ where vips
/usr/local/bin/vips
$ vips --version
vips: error while loading shared libraries: libvips.so.42: cannot open shared object file: No such file or directory
It seems that the files libvips-cpp.so.42
and libvips.so.42
do not exist where they should.
I think the missing files are:
/usr/local/lib64/libvips.so.42.17.3
/usr/local/lib64/libvips-cpp.so.42.17.3
or in the directory where I previously installed sharp
/root/sharp/node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.42
/root/sharp/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/libvips-cpp.so.42
So, I copied these files:
/usr/local/lib64/libvips.so.42.17.3
/usr/local/lib64/libvips-cpp.so.42.17.3
into /lib64/
keeping their original names. Nothing has changed.
Then I tried renaming them by deleting the version in the filename? E.g. libvips.so.42.17.3
-> libvips.so.42
. This worked. So
$ vips --version
vips-8.15.3
and
$ node -e “require(‘sharp’)”
work without any problems. So I consider the problem solved.
I also discovered one thing - pnpm very much dislikes to build sharp from the source. Despite installing node-addon-api node-gyp
pnpm does not build sharp, it just installs the pre-built versions. This can be fixed by using pnpm rebuild
. If I find another solution in the pnpm documentation, I will let you know about it, and I will try to improve the documentation about the installation from the source.
Rather than manually copy files around, when building libvips with Meson, its --prefix
flag can be used to set the installation directory, e.g. you might want to try meson configure --prefix /usr/lib64
.
Installing symlink pointing to libvips.so.42.17.3 to /usr/lib64/lib64/libvips.so.42
Installing symlink pointing to libvips.so.42 to /usr/lib64/lib64/libvips.so
Installing symlink pointing to libvips-cpp.so.42.17.3 to /usr/lib64/lib64/libvips-cpp.so.42
Installing symlink pointing to libvips-cpp.so.42 to /usr/lib64/lib64/libvips-cpp.so
It doesn't look very good
Sorry, I meant --prefix /usr
updated comment... 0.27.2 works with E5310, but not upper
Possible install-time or require-time problem
Are you using the latest version of sharp?
sharp
as reported bynpm view sharp dist-tags.latest
.Are you using a supported runtime?
^18.17.0 || ^20.3.0 || >=21.0.0
Are you using a supported package manager and installing optional dependencies?
--include=optional
--no-optional=false
What is the complete error message, including the full stack trace?
What is the complete output of running
npm install --verbose --foreground-scripts sharp
in an empty directory?What is the output of running
npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp
?