Skip to content

Provide artifacts with libtool and pkg-config files聽#36

Open

Description

@joschi

Hi!

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:

sharp-libvips/build/lin.sh

Lines 284 to 285 in 5007da5

cd ${TARGET}/lib
rm -rf pkgconfig .libs *.la libvipsCC* cmake

@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?

Activity

  1. lovell commented on Jan 21, 2020

    @lovell
    Owner

    Is this for Linux only? Is it a problem that the .la files 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.

  2. kleisauke commented on Apr 7, 2022

    @kleisauke
    Collaborator

    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 prefix
    export PKG_CONFIG_PATH=/opt/libvips/lib/pkgconfig
    
    # Ensure dynamic linker finds the pre-built libvips binaries
    export 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
  3. lovell commented on Aug 13, 2024

    @lovell
    Owner

    Is this still something that might be useful? I guess the vips-cpp.pc file could be published in the @img/sharp-libvips-dev package.

  4. kleisauke commented on Aug 13, 2024

    @kleisauke
    Collaborator

    It could still be useful, I think.

    FWIW, I just updated https://gist.github.com/kleisauke/8d93635010b371e154275e376272f8d4 to make vips-cpp.pc relocatable, similar to what is done when you build with Meson's pkgconfig.relocatable option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions