Add libvips version number to shared library SONAME and filename#252
Merged
Add libvips version number to shared library SONAME and filename#252
Conversation
This should help improve support for multiple versions of sharp that use multiple versions of libvips running within the same process by ensuring dlopen accesses the relevant shared library.
kleisauke
approved these changes
Oct 9, 2024
Collaborator
kleisauke
left a comment
There was a problem hiding this comment.
LGTM! Tested with:
Details
$ readelf -d node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.42 | grep SONAME
0x000000000000000e (SONAME) Library soname: [libvips-cpp.so.42]
$ patchelf --set-soname libvips-cpp.so.8.15.2 node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.42
$ mv node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.42 node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.8.15.2
$ readelf -d node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.8.15.2 | grep SONAME
0x000000000000000e (SONAME) Library soname: [libvips-cpp.so.8.15.2]
$ readelf -d node_modules/@img/sharp-linux-x64/lib/sharp-linux-x64.node | grep libvips-cpp.so
0x0000000000000001 (NEEDED) Shared library: [libvips-cpp.so.42]
$ patchelf --replace-needed libvips-cpp.so.42 libvips-cpp.so.8.15.2 node_modules/@img/sharp-linux-x64/lib/sharp-linux-x64.node
$ node index
8.15.2
{ semver: '8.15.2', isGlobal: false, isWasm: false }
$ LD_DEBUG=libs node index 2>&1 | grep "libvips-cpp.so"
10200: find library=libvips-cpp.so.42 [0]; searching
10200: trying file=/redacted/node_modules/fast-average-color-node/node_modules/@img/sharp-linux-x64/lib/../../sharp-libvips-linux-x64/lib/glibc-hwcaps/x86-64-v4/libvips-cpp.so.42
10200: trying file=/redacted/node_modules/fast-average-color-node/node_modules/@img/sharp-linux-x64/lib/../../sharp-libvips-linux-x64/lib/glibc-hwcaps/x86-64-v3/libvips-cpp.so.42
10200: trying file=/redacted/node_modules/fast-average-color-node/node_modules/@img/sharp-linux-x64/lib/../../sharp-libvips-linux-x64/lib/glibc-hwcaps/x86-64-v2/libvips-cpp.so.42
10200: trying file=/redacted/node_modules/fast-average-color-node/node_modules/@img/sharp-linux-x64/lib/../../sharp-libvips-linux-x64/lib/libvips-cpp.so.42
10200: calling init: /redacted/node_modules/fast-average-color-node/node_modules/@img/sharp-linux-x64/lib/../../sharp-libvips-linux-x64/lib/libvips-cpp.so.42
10200: find library=libvips-cpp.so.8.15.2 [0]; searching
10200: trying file=/redacted/node_modules/@img/sharp-linux-x64/lib/../../sharp-libvips-linux-x64/lib/glibc-hwcaps/x86-64-v4/libvips-cpp.so.8.15.2
10200: trying file=/redacted/node_modules/@img/sharp-linux-x64/lib/../../sharp-libvips-linux-x64/lib/glibc-hwcaps/x86-64-v3/libvips-cpp.so.8.15.2
10200: trying file=/redacted/node_modules/@img/sharp-linux-x64/lib/../../sharp-libvips-linux-x64/lib/glibc-hwcaps/x86-64-v2/libvips-cpp.so.8.15.2
10200: trying file=/redacted/node_modules/@img/sharp-linux-x64/lib/../../sharp-libvips-linux-x64/lib/libvips-cpp.so.8.15.2
10200: calling init: /redacted/node_modules/@img/sharp-linux-x64/lib/../../sharp-libvips-linux-x64/lib/libvips-cpp.so.8.15.2
10200: calling fini: /redacted/node_modules/fast-average-color-node/node_modules/@img/sharp-linux-x64/lib/../../sharp-libvips-linux-x64/lib/libvips-cpp.so.42 [0]
10200: calling fini: /redacted/node_modules/@img/sharp-linux-x64/lib/../../sharp-libvips-linux-x64/lib/libvips-cpp.so.8.15.2 [0]Of course, running two (or more) instances of libvips in the same process might degrade performance, but that might be better than having version mismatches.
Note that I'm unsure if we should apply the same approach to Windows builds, as these C++ DLLs are also used by projects other than sharp.
Owner
Author
|
Thanks Kleis, I agree we should not apply this to the Windows builds. (For sharp the C++ DLL is built/named via gyp.) |
akash-akya
added a commit
to akash-akya/sharp-libvips
that referenced
this pull request
Oct 25, 2024
…ame (lovell#252)" This reverts commit 1210419.
megantaite
pushed a commit
to animoto/sharp-libvips
that referenced
this pull request
Apr 16, 2025
…ell#252) This should help improve support for multiple versions of sharp that use differing versions of libvips running within the same process by ensuring dlopen accesses the relevant shared library.
5 tasks
akash-akya
added a commit
to akash-akya/sharp-libvips
that referenced
this pull request
Jul 12, 2025
…ame (lovell#252)" This reverts commit 1210419.
akash-akya
added a commit
to akash-akya/sharp-libvips
that referenced
this pull request
Jan 3, 2026
…ame (lovell#252)" This reverts commit 1210419.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This should help improve support for multiple versions of sharp that use differing versions of libvips running within the same process by ensuring
dlopenaccesses the relevant shared library.Before:
After:
Relates to lovell/sharp#4095