Skip to content

Commit c474d3d

Browse files
authored
Install gcc-10/g++-10 to match sysroot
1 parent 6fe1bbd commit c474d3d

File tree

3 files changed

+31
-6
lines changed

3 files changed

+31
-6
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,13 @@ jobs:
2525
- name: Install sysroot
2626
if: runner.os == 'Linux'
2727
run: |
28+
sudo apt-get update -qq
29+
sudo apt-get install -y gcc-10 g++-10
2830
SYSROOT_PATH=$(node scripts/linux/install-sysroot.js x64 | grep "SYSROOT_PATH=" | cut -d= -f2)
2931
echo "SYSROOT_PATH=$SYSROOT_PATH" >> $GITHUB_ENV
3032
echo "Sysroot path set to: $SYSROOT_PATH"
33+
echo "CC=gcc-10" >> $GITHUB_ENV
34+
echo "CXX=g++-10" >> $GITHUB_ENV
3135
3236
- name: Install dependencies and build
3337
run: npm ci

binding.gyp

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,24 +97,39 @@
9797
},
9898
'conditions': [
9999
['sysroot!=""', {
100+
'variables': {
101+
'gcc_include%': '<!(${CXX:-g++} -print-file-name=include)',
102+
},
100103
'conditions': [
101104
['target_arch=="x64"', {
102105
'cflags': [
103106
'--sysroot=<(sysroot)',
107+
'-nostdinc',
108+
'-isystem<(gcc_include)',
109+
'-isystem<(sysroot)/usr/include',
110+
'-isystem<(sysroot)/usr/include/x86_64-linux-gnu'
111+
],
112+
'cflags_cc': [
104113
'-nostdinc++',
105-
'-isystem<(sysroot)/usr/include/c++/10',
106-
'-isystem<(sysroot)/usr/include/x86_64-linux-gnu/c++/10',
107-
'-isystem<(sysroot)/usr/include/c++/10/backward'
114+
'-isystem<(sysroot)/../include/c++/10.5.0',
115+
'-isystem<(sysroot)/../include/c++/10.5.0/x86_64-linux-gnu',
116+
'-isystem<(sysroot)/../include/c++/10.5.0/backward'
108117
],
109118
'ldflags': ['--sysroot=<(sysroot)'],
110119
}],
111120
['target_arch=="arm64"', {
112121
'cflags': [
113122
'--sysroot=<(sysroot)',
123+
'-nostdinc',
124+
'-isystem<(gcc_include)',
125+
'-isystem<(sysroot)/usr/include',
126+
'-isystem<(sysroot)/usr/include/aarch64-linux-gnu'
127+
],
128+
'cflags_cc': [
114129
'-nostdinc++',
115-
'-isystem<(sysroot)/usr/include/c++/10',
116-
'-isystem<(sysroot)/usr/include/aarch64-linux-gnu/c++/10',
117-
'-isystem<(sysroot)/usr/include/c++/10/backward'
130+
'-isystem<(sysroot)/../include/c++/10.5.0',
131+
'-isystem<(sysroot)/../include/c++/10.5.0/aarch64-linux-gnu',
132+
'-isystem<(sysroot)/../include/c++/10.5.0/backward'
118133
],
119134
'ldflags': ['--sysroot=<(sysroot)'],
120135
}]

pipelines/build.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@ steps:
1515

1616
- bash: |
1717
if [ "$(uname)" = "Linux" ]; then
18+
sudo apt-get update -qq
19+
sudo apt-get install -y gcc-10 g++-10
1820
SYSROOT_PATH=$(node scripts/linux/install-sysroot.js ${{ parameters.arch }} | grep "SYSROOT_PATH=" | cut -d= -f2)
1921
echo "##vso[task.setvariable variable=SYSROOT_PATH]$SYSROOT_PATH"
22+
echo "##vso[task.setvariable variable=CC]gcc-10"
23+
echo "##vso[task.setvariable variable=CXX]g++-10"
2024
echo "Sysroot path set to: $SYSROOT_PATH"
2125
fi
2226
displayName: 'Install sysroot (Linux only)'
@@ -27,3 +31,5 @@ steps:
2731
ARCH: ${{ parameters.arch }}
2832
npm_config_arch: ${{ parameters.arch }}
2933
SYSROOT_PATH: $(SYSROOT_PATH)
34+
CC: $(CC)
35+
CXX: $(CXX)

0 commit comments

Comments
 (0)