Closed dsimunic closed 2 years ago
Hi @dsimunic,
Sorry for the delay. The pre-built binaries in the kleisauke/libvips-packaging
repository 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.
You can verify this with the readelf utility:
$ readelf -Ws libvips-cpp.so.42 | c++filt | grep -qF "::__cxx11::" && echo "C++11 ABI used" || echo "C++03 ABI used"
C++03 ABI used
So, to take advantage of these pre-built binaries, you should build this project with:
CFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0"
CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0"
This will fix the linker errors about undefined references to symbols that involve types in the std::__cxx11
namespace.
Here is an sample Dockerfile that seems to work for me:
Thinking about this further, we can also avoid calling the string overload of VImage::new_from_buffer
, so that mixed C++ ABIs will work without any issues.
I just did this with commit https://github.com/weserv/images/commit/2b51dd828c220f2b5fed010b6fabca5757f03117, so please ignore the above comment. Thanks for reporting this!
Didn't know that compilation output can differ between distributions. TIL a lot.
Thanks so much for taking the time to look into this and sorting it out. And thanks for the awesome plugin.
I'm trying to build weserv module on Debian 11 and link it against the pre-built
libvips-cpp.so
from kleisauke/libvips-packaging.The build succeeds, but linking fails with
A simple example .c file linked against that same libvips setup works, so I presume the library and paths are correct. Building against libvips-dev from apt also works, but that version depends on hundreds of files, not fun to copy around.
I made my own pkg-config for vips and vips-cpp, the files are here: https://gist.github.com/dsimunic/1d4bc350191505595071ebd7cdbc3d74, and the build script is here.
What do I need to change to successfully build weserv nginx module with the packaged libvips?