You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Provide artifacts with libtool and pkg-config files聽#36
Thanks for maintaining sharp and these native libraries for libvips! They're a great help to get started. 馃槂
I'd like to use the native libraries provided by this project in https://github.com/criteo/JVips instead of building the libraries and maintaining their build scripts in JVips, too.
Since it's a Java project using JNI to interface with the native libraries, I need to compile a small wrapper which requires the pkg-config (*.pc) and libtool (*.la) files in order to be build.
Unfortunately, those files are removed at the end of the Linux build script:
@lovell Do you think it would be possible and sensible to provider an additional artifact with just these files for people to use the pre-built libraries of sharp-libvips and link them to their own C wrappers?
This should be much easier now that we are building a single shared library with all its dependencies statically linked. You only have to include vips-cpp.pc, for example:
prefix=${pcfiledir}/../..
libdir=${prefix}/lib
includedir=${prefix}/include
Name: vips-cpp
Description: C++ API for vips8 image processing library
Version: 8.15.3
Requires:
Libs: -L${libdir} -l:libvips-cpp.so.42
Cflags: -I${includedir} -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include -D_GLIBCXX_USE_CXX11_ABI=0
# Download pre-built libvips binaries
mkdir -p /opt/libvips &&cd /opt/libvips
curl -Ls https://github.com/lovell/sharp-libvips/releases/download/v8.15.3/libvips-8.15.3-linux-x64.tar.gz | tar -xzC .# Download pkgconfig file
mkdir -p lib/pkgconfig &&cd lib/pkgconfig
curl -OLs https://gist.github.com/kleisauke/8d93635010b371e154275e376272f8d4/raw/vips-cpp.pc
# Update the PKG_CONFIG_PATH environment variable,# since libvips is installed in a non-standard prefixexport PKG_CONFIG_PATH=/opt/libvips/lib/pkgconfig
# Ensure dynamic linker finds the pre-built libvips binariesexport LD_LIBRARY_PATH=/opt/libvips/lib
Note that if you need to use the string overload of VImage::new_from_buffer, you must compile your project with -D_GLIBCXX_USE_CXX11_ABI=0. The pre-built binaries were compiled with the devtoolset packages on RHEL/CentOS 7 which forcefully disabled the -D_GLIBCXX_USE_CXX11_ABI=1 compiler flag, see: https://stackoverflow.com/a/52611576.
$ readelf -Ws /opt/libvips/lib/libvips-cpp.so.42 | c++filt | grep -qF "new_from_buffer(std::__cxx11::"&&echo"C++11 ABI used"||echo"C++03 ABI used"
C++03 ABI used
$ readelf -Ws /usr/lib64/libvips-cpp.so.42 | c++filt | grep -qF "new_from_buffer(std::__cxx11::"&&echo"C++11 ABI used"||echo"C++03 ABI used"
C++11 ABI used
Activity
lovell commentedon Jan 21, 2020
Is this for Linux only? Is it a problem that the
.lafiles might contain hard-coded paths from the build machine?These files are very small so we could put them in the main tarballs, i.e. not delete them. Happy to accept a PR if you're able.
kleisauke commentedon Apr 7, 2022
This should be much easier now that we are building a single shared library with all its dependencies statically linked. You only have to include
vips-cpp.pc, for example:Note that if you need to use the string overload of
VImage::new_from_buffer, you must compile your project with-D_GLIBCXX_USE_CXX11_ABI=0. The pre-built binaries were compiled with the devtoolset packages on RHEL/CentOS 7 which forcefully disabled the-D_GLIBCXX_USE_CXX11_ABI=1compiler flag, see: https://stackoverflow.com/a/52611576.lovell commentedon Aug 13, 2024
Is this still something that might be useful? I guess the
vips-cpp.pcfile could be published in the@img/sharp-libvips-devpackage.kleisauke commentedon Aug 13, 2024
It could still be useful, I think.
FWIW, I just updated https://gist.github.com/kleisauke/8d93635010b371e154275e376272f8d4 to make
vips-cpp.pcrelocatable, similar to what is done when you build with Meson'spkgconfig.relocatableoption.