Auto-detect C++11 ABI version, remove --sharp-cxx11 flag

This commit is contained in:
Lovell Fuller 2016-09-28 21:40:30 +01:00
parent 28ce33feb3
commit 07d66da57b
3 changed files with 17 additions and 19 deletions

View File

@ -51,7 +51,6 @@
], ],
# Nested variables "pattern" borrowed from http://src.chromium.org/viewvc/chrome/trunk/src/build/common.gypi # Nested variables "pattern" borrowed from http://src.chromium.org/viewvc/chrome/trunk/src/build/common.gypi
'variables': { 'variables': {
'sharp_cxx11%': '0',
'variables': { 'variables': {
'variables': { 'variables': {
'conditions': [ 'conditions': [
@ -92,10 +91,6 @@
'src/sharp.cc', 'src/sharp.cc',
'src/utilities.cc' 'src/utilities.cc'
], ],
'defines': [
'_GLIBCXX_USE_CXX11_ABI=<(sharp_cxx11)',
'_ALLOW_KEYWORD_MACROS'
],
'include_dirs': [ 'include_dirs': [
'<!(node -e "require(\'nan\')")' '<!(node -e "require(\'nan\')")'
], ],
@ -109,6 +104,10 @@
}, { }, {
'libraries': ['<!@(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --libs vips-cpp)'] 'libraries': ['<!@(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --libs vips-cpp)']
}] }]
],
'defines': [
# Inspect libvips-cpp.so to determine which C++11 ABI version was used and set _GLIBCXX_USE_CXX11_ABI accordingly. This is quite horrible.
'_GLIBCXX_USE_CXX11_ABI=<!(if readelf -Ws "$(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --libs-only-L vips-cpp | cut -c 3-)/libvips-cpp.so" | c++filt | grep -qF __cxx11;then echo "1";else echo "0";fi)'
] ]
}, { }, {
# Attempt to download pre-built libvips and install locally within node_modules # Attempt to download pre-built libvips and install locally within node_modules
@ -119,6 +118,9 @@
], ],
'conditions': [ 'conditions': [
['OS == "win"', { ['OS == "win"', {
'defines': [
'_ALLOW_KEYWORD_MACROS'
],
'libraries': [ 'libraries': [
'../lib/libvips.lib', '../lib/libvips.lib',
'../lib/libglib-2.0.lib', '../lib/libglib-2.0.lib',
@ -142,6 +144,9 @@
'variables': { 'variables': {
'download_vips': '<!(LDD_VERSION="<!(ldd --version 2>&1 || true)" node -e "require(\'./binding\').download_vips()")' 'download_vips': '<!(LDD_VERSION="<!(ldd --version 2>&1 || true)" node -e "require(\'./binding\').download_vips()")'
}, },
'defines': [
'_GLIBCXX_USE_CXX11_ABI=0'
],
'libraries': [ 'libraries': [
'../lib/libvips-cpp.so', '../lib/libvips-cpp.so',
'../lib/libvips.so', '../lib/libvips.so',

View File

@ -6,6 +6,8 @@ Requires libvips v8.3.3
#### v0.16.1 - TBD #### v0.16.1 - TBD
* C++11 ABI version is now auto-detected, remove sharp-cxx11 installation flag.
* Ensure convolution kernel scale is clamped to a minimum value of 1. * Ensure convolution kernel scale is clamped to a minimum value of 1.
[#561](https://github.com/lovell/sharp/issues/561) [#561](https://github.com/lovell/sharp/issues/561)
[@abagshaw](https://github.com/abagshaw) [@abagshaw](https://github.com/abagshaw)

View File

@ -22,24 +22,15 @@ Most recent Linux-based operating systems with glibc running on x64 and ARMv6+ C
* Debian 7, 8 * Debian 7, 8
* Ubuntu 12.04, 14.04, 16.04 * Ubuntu 12.04, 14.04, 16.04
* Centos 7 * Centos 7
* Fedora 22, 23 * Fedora 23, 24
* openSUSE 13.2 * openSUSE 13.2
* Archlinux * Archlinux
* Raspbian Jessie * Raspbian Jessie
* Amazon Linux 2016.03 * Amazon Linux 2016.03, 2016.09
To use your own version of libvips instead of the provided binaries, make sure it is To use a globally-installed version of libvips instead of the provided binaries,
at least the version listed under `config.libvips` in the `package.json` file and make sure it is at least the version listed under `config.libvips` in the `package.json` file
that it can be located using `pkg-config --modversion vips-cpp`. and that it can be located using `pkg-config --modversion vips-cpp`.
There are [changes in the C++11 ABI](https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html)
when using v5.1+ of the `g++` compiler.
If you have installed `libvips-dev` via package manager on an OS such as Debian testing/unstable,
you can pass the required value of the `_GLIBCXX_USE_CXX11_ABI` macro using the `--sharp-cxx11` flag.
```sh
npm install --sharp-cxx11=1
```
If you are using non-stadard paths (anything other than `/usr` or `/usr/local`), If you are using non-stadard paths (anything other than `/usr` or `/usr/local`),
you might need to set `PKG_CONFIG_PATH` during `npm install` you might need to set `PKG_CONFIG_PATH` during `npm install`