Skip to content

Commit 07d66da

Browse files
committed
Auto-detect C++11 ABI version, remove --sharp-cxx11 flag
1 parent 28ce33f commit 07d66da

3 files changed

Lines changed: 17 additions & 19 deletions

File tree

binding.gyp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
],
5252
# Nested variables "pattern" borrowed from http://src.chromium.org/viewvc/chrome/trunk/src/build/common.gypi
5353
'variables': {
54-
'sharp_cxx11%': '0',
5554
'variables': {
5655
'variables': {
5756
'conditions': [
@@ -92,10 +91,6 @@
9291
'src/sharp.cc',
9392
'src/utilities.cc'
9493
],
95-
'defines': [
96-
'_GLIBCXX_USE_CXX11_ABI=<(sharp_cxx11)',
97-
'_ALLOW_KEYWORD_MACROS'
98-
],
9994
'include_dirs': [
10095
'<!(node -e "require(\'nan\')")'
10196
],
@@ -109,6 +104,10 @@
109104
}, {
110105
'libraries': ['<!@(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --libs vips-cpp)']
111106
}]
107+
],
108+
'defines': [
109+
# Inspect libvips-cpp.so to determine which C++11 ABI version was used and set _GLIBCXX_USE_CXX11_ABI accordingly. This is quite horrible.
110+
'_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)'
112111
]
113112
}, {
114113
# Attempt to download pre-built libvips and install locally within node_modules
@@ -119,6 +118,9 @@
119118
],
120119
'conditions': [
121120
['OS == "win"', {
121+
'defines': [
122+
'_ALLOW_KEYWORD_MACROS'
123+
],
122124
'libraries': [
123125
'../lib/libvips.lib',
124126
'../lib/libglib-2.0.lib',
@@ -142,6 +144,9 @@
142144
'variables': {
143145
'download_vips': '<!(LDD_VERSION="<!(ldd --version 2>&1 || true)" node -e "require(\'./binding\').download_vips()")'
144146
},
147+
'defines': [
148+
'_GLIBCXX_USE_CXX11_ABI=0'
149+
],
145150
'libraries': [
146151
'../lib/libvips-cpp.so',
147152
'../lib/libvips.so',

docs/changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Requires libvips v8.3.3
66

77
#### v0.16.1 - TBD
88

9+
* C++11 ABI version is now auto-detected, remove sharp-cxx11 installation flag.
10+
911
* Ensure convolution kernel scale is clamped to a minimum value of 1.
1012
[#561](https://github.com/lovell/sharp/issues/561)
1113
[@abagshaw](https://github.com/abagshaw)

docs/install.md

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,15 @@ Most recent Linux-based operating systems with glibc running on x64 and ARMv6+ C
2222
* Debian 7, 8
2323
* Ubuntu 12.04, 14.04, 16.04
2424
* Centos 7
25-
* Fedora 22, 23
25+
* Fedora 23, 24
2626
* openSUSE 13.2
2727
* Archlinux
2828
* Raspbian Jessie
29-
* Amazon Linux 2016.03
29+
* Amazon Linux 2016.03, 2016.09
3030

31-
To use your own version of libvips instead of the provided binaries, make sure it is
32-
at least the version listed under `config.libvips` in the `package.json` file and
33-
that it can be located using `pkg-config --modversion vips-cpp`.
34-
35-
There are [changes in the C++11 ABI](https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html)
36-
when using v5.1+ of the `g++` compiler.
37-
If you have installed `libvips-dev` via package manager on an OS such as Debian testing/unstable,
38-
you can pass the required value of the `_GLIBCXX_USE_CXX11_ABI` macro using the `--sharp-cxx11` flag.
39-
40-
```sh
41-
npm install --sharp-cxx11=1
42-
```
31+
To use a globally-installed version of libvips instead of the provided binaries,
32+
make sure it is at least the version listed under `config.libvips` in the `package.json` file
33+
and that it can be located using `pkg-config --modversion vips-cpp`.
4334

4435
If you are using non-stadard paths (anything other than `/usr` or `/usr/local`),
4536
you might need to set `PKG_CONFIG_PATH` during `npm install`

0 commit comments

Comments
 (0)