Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Commit b2c1398

Browse files
authored
Fix crash on some linux environment (#229)
* Fix crash caused by incorrect symbol pickup * set non-lazy binding * Update build matrix * Update g++ version in comments
1 parent 0ebf6d5 commit b2c1398

File tree

3 files changed

+45
-30
lines changed

3 files changed

+45
-30
lines changed

.travis.yml

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ matrix:
55
# Disable the default build and use customized matrix only.
66
- compiler: default
77
include:
8-
# Node 6.x Linux (Precise) G++5.4.1
8+
# Node 6.x Linux (Precise) G++5.4.1
99
- os: linux
1010
dist: precise
1111
node_js: '6'
@@ -23,46 +23,31 @@ matrix:
2323
- cmake
2424
env:
2525
- COMPILER_OVERRIDE="CXX=g++-5 CC=gcc-5"
26-
# Node 6.x OS X (Yosemite) AppleClang 6.1
26+
# Node 6.x OS X (Yosemite) AppleClang 6.1
2727
- os: osx
2828
node_js: '6'
2929
osx_image: xcode6.4
30-
# Node LTS (8.x) Linux (Trusty) G++6.3.0
31-
# 2018-03-12 : There is a compability issue for the following platform/environment combination:
32-
# - Ubuntu 14.04
33-
# - Node 8.10.0 or later
34-
# - Node 9.3.0 or later
35-
# This issue causes a crash on Napa.js.
36-
# Issue detail: https://github.com/nodejs/node/issues/17817
37-
#
38-
# Current available workaround:
39-
# 1: Use Node 8.9.1 or 9.2.1
40-
# 2: Use binaries (libnapa.so and napa-binding.node) that compiled in Ubuntu 16.04
41-
#
42-
# Since travis-CI does not support Ubuntu 16.04 yet, we locked Node version to 8.9.1
43-
# for now.
44-
# - fs-eire
30+
# Node LTS (8.x) Linux (Trusty) G++6.4.0
4531
- os: linux
4632
dist: trusty
47-
node_js: '8.9.1'
33+
node_js: '8'
4834
compiler: g++-6
4935
addons:
5036
apt:
5137
sources:
5238
- ubuntu-toolchain-r-test
5339
packages:
54-
- g++-5
40+
- g++-6
5541
env:
56-
- COMPILER_OVERRIDE="CXX=g++-5 CC=gcc-5"
57-
# Node LTS (8.x) OS X (El Capitan) AppleClang 7.3
42+
- COMPILER_OVERRIDE="CXX=g++-6 CC=gcc-6"
43+
# Node LTS (8.x) OS X (El Capitan) AppleClang 7.3
5844
- os: osx
5945
node_js: '8'
6046
osx_image: xcode7.3
61-
# Node Stable (9.x) Linux (Trusty) G++6.3.0
62-
# 2017-12-18 : Locked node.js version to 9.2.1. See above.
47+
# Node (9.x) Linux (Trusty) G++6.4.0
6348
- os: linux
6449
dist: trusty
65-
node_js: '9.2.1'
50+
node_js: '9'
6651
compiler: g++-6
6752
addons:
6853
apt:
@@ -72,10 +57,27 @@ matrix:
7257
- g++-6
7358
env:
7459
- COMPILER_OVERRIDE="CXX=g++-6 CC=gcc-6"
75-
# Node Stable (9.x) macOS (Sierra) AppleClang 8.1
60+
# Node (9.x) macOS (Sierra) AppleClang 8.1
7661
- os: osx
7762
node_js: '9'
7863
osx_image: xcode8.3
64+
# Node Current (10.x) Linux (Trusty) G++7.3.0
65+
- os: linux
66+
dist: trusty
67+
node_js: '10'
68+
compiler: g++-7
69+
addons:
70+
apt:
71+
sources:
72+
- ubuntu-toolchain-r-test
73+
packages:
74+
- g++-7
75+
env:
76+
- COMPILER_OVERRIDE="CXX=g++-7 CC=gcc-7"
77+
# Node Current (10.x) macOS (High Sierra) AppleClang 9.1
78+
- os: osx
79+
node_js: '10'
80+
osx_image: xcode9.3
7981

8082
before_install:
8183
- |

CMakeLists.txt

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,21 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJECT_SOURCE_DIR}/bin)
1313
set(CMAKE_CXX_STANDARD 14)
1414
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1515

16-
# Set symbol visibility to hidden by default.
17-
# Napa shared library shares a few classes with napa-binding.node with different compile definition,
18-
# exposing the same symbols from both shared libraries may cause improper behaviors under gcc.
19-
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
20-
set(CMAKE_VISIBILITY_INLINES_HIDDEN)
16+
if (NOT WIN32 AND NOT APPLE)
17+
# Set symbol visibility to hidden by default.
18+
# Napa shared library shares a few classes with napa-binding.node with different compile definition,
19+
# exposing the same symbols from both shared libraries may cause improper behaviors under gcc.
20+
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
21+
set(CMAKE_VISIBILITY_INLINES_HIDDEN)
22+
23+
# Prevent symbol relocations internal to our wrapper library to be overwritten by the application.
24+
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-Bsymbolic -Wl,-Bsymbolic-functions")
25+
set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-Bsymbolic -Wl,-Bsymbolic-functions")
26+
27+
# Mark object non-lazy runtime binding.
28+
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,now")
29+
set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-z,now")
30+
endif ()
2131

2232
# Build napa shared library.
2333
add_subdirectory(src)

appveyor.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ environment:
99
# Windows Server 2016 Visual C++ Build Tools 2017
1010
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
1111
nodejs_version: 9
12+
# Windows Server 2016 Visual C++ Build Tools 2017
13+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
14+
nodejs_version: 10
1215

1316
platform:
1417
- x64

0 commit comments

Comments
 (0)