Skip to content

Commit e45f1ef

Browse files
committed
fix: build cli with prebuilt openssl (#2316)
1 parent 6c5a8eb commit e45f1ef

File tree

7 files changed

+51
-15
lines changed

7 files changed

+51
-15
lines changed

.github/workflows/insider-linux.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
compile:
7575
needs:
7676
- check
77-
runs-on: ubuntu-20.04
77+
runs-on: ubuntu-22.04
7878
env:
7979
MS_COMMIT: ${{ needs.check.outputs.MS_COMMIT }}
8080
MS_TAG: ${{ needs.check.outputs.MS_TAG }}
@@ -221,6 +221,9 @@ jobs:
221221
run: sudo apt-get update -y && sudo apt-get install -y libkrb5-dev
222222
if: env.DISABLED != 'yes' && env.SHOULD_BUILD == 'yes'
223223

224+
- uses: actions-rust-lang/setup-rust-toolchain@v1
225+
if: env.DISABLED != 'yes' && env.SHOULD_BUILD == 'yes'
226+
224227
- name: Download vscode artifact
225228
uses: actions/download-artifact@v4
226229
with:
@@ -268,7 +271,7 @@ jobs:
268271
needs:
269272
- check
270273
- compile
271-
runs-on: ubuntu-20.04
274+
runs-on: ubuntu-22.04
272275
strategy:
273276
fail-fast: false
274277
matrix:
@@ -383,7 +386,7 @@ jobs:
383386
needs:
384387
- check
385388
- compile
386-
runs-on: ubuntu-20.04
389+
runs-on: ubuntu-22.04
387390
strategy:
388391
fail-fast: false
389392
matrix:

.github/workflows/insider-windows.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
compile:
7373
needs:
7474
- check
75-
runs-on: ubuntu-20.04
75+
runs-on: ubuntu-22.04
7676
env:
7777
MS_COMMIT: ${{ needs.check.outputs.MS_COMMIT }}
7878
MS_TAG: ${{ needs.check.outputs.MS_TAG }}

.github/workflows/stable-linux.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
compile:
7474
needs:
7575
- check
76-
runs-on: ubuntu-20.04
76+
runs-on: ubuntu-22.04
7777
env:
7878
MS_COMMIT: ${{ needs.check.outputs.MS_COMMIT }}
7979
MS_TAG: ${{ needs.check.outputs.MS_TAG }}
@@ -222,6 +222,9 @@ jobs:
222222
run: sudo apt-get update -y && sudo apt-get install -y libkrb5-dev
223223
if: env.DISABLED != 'yes' && env.SHOULD_BUILD == 'yes'
224224

225+
- uses: actions-rust-lang/setup-rust-toolchain@v1
226+
if: env.DISABLED != 'yes' && env.SHOULD_BUILD == 'yes'
227+
225228
- name: Download vscode artifact
226229
uses: actions/download-artifact@v4
227230
with:
@@ -269,7 +272,7 @@ jobs:
269272
needs:
270273
- check
271274
- compile
272-
runs-on: ubuntu-20.04
275+
runs-on: ubuntu-22.04
273276
strategy:
274277
fail-fast: false
275278
matrix:
@@ -384,7 +387,7 @@ jobs:
384387
needs:
385388
- check
386389
- compile
387-
runs-on: ubuntu-20.04
390+
runs-on: ubuntu-22.04
388391
strategy:
389392
fail-fast: false
390393
matrix:

.github/workflows/stable-windows.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
compile:
7272
needs:
7373
- check
74-
runs-on: ubuntu-20.04
74+
runs-on: ubuntu-22.04
7575
env:
7676
MS_COMMIT: ${{ needs.check.outputs.MS_COMMIT }}
7777
MS_TAG: ${{ needs.check.outputs.MS_TAG }}

build/linux/package_bin.sh

+2
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,6 @@ fi
136136

137137
find "../VSCode-linux-${VSCODE_ARCH}" -print0 | xargs -0 touch -c
138138

139+
. ../build_cli.sh
140+
139141
cd ..

build/windows/package.sh

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ node build/azure-pipelines/distro/mixin-npm
2626

2727
npm run gulp "vscode-win32-${VSCODE_ARCH}-min-ci"
2828

29+
. ../build_cli.sh
30+
2931
if [[ "${VSCODE_ARCH}" == "x64" ]]; then
3032
if [[ "${SHOULD_BUILD_REH}" != "no" ]]; then
3133
echo "Building REH"

build_cli.sh

+33-7
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,20 @@ export VSCODE_CLI_BINARY_NAME="$( node -p "require(\"../product.json\").serverAp
1111
TUNNEL_APPLICATION_NAME="$( node -p "require(\"../product.json\").tunnelApplicationName" )"
1212
NAME_SHORT="$( node -p "require(\"../product.json\").nameShort" )"
1313

14+
npm pack @vscode/openssl-prebuilt@0.0.11
15+
mkdir openssl
16+
tar -xvzf vscode-openssl-prebuilt-0.0.11.tgz --strip-components=1 --directory=openssl
17+
1418
if [[ "${OS_NAME}" == "osx" ]]; then
1519
if [[ "${VSCODE_ARCH}" == "arm64" ]]; then
1620
VSCODE_CLI_TARGET="aarch64-apple-darwin"
1721
else
1822
VSCODE_CLI_TARGET="x86_64-apple-darwin"
1923
fi
2024

25+
export OPENSSL_LIB_DIR="$( pwd )/openssl/out/${VSCODE_ARCH}-osx/lib"
26+
export OPENSSL_INCLUDE_DIR="$( pwd )/openssl/out/${VSCODE_ARCH}-osx/include"
27+
2128
cargo build --release --target "${VSCODE_CLI_TARGET}" --bin=code
2229

2330
cp "target/${VSCODE_CLI_TARGET}/release/code" "../../VSCode-darwin-${VSCODE_ARCH}/${NAME_SHORT}.app/Contents/Resources/app/bin/${TUNNEL_APPLICATION_NAME}"
@@ -29,29 +36,48 @@ elif [[ "${OS_NAME}" == "windows" ]]; then
2936
VSCODE_CLI_TARGET="x86_64-pc-windows-msvc"
3037
export VSCODE_CLI_RUSTFLAGS="-Ctarget-feature=+crt-static -Clink-args=/guard:cf -Clink-args=/CETCOMPAT"
3138
fi
39+
3240
export VSCODE_CLI_CFLAGS="/guard:cf /Qspectre"
41+
export OPENSSL_LIB_DIR="$( pwd )/openssl/out/${VSCODE_ARCH}-windows-static/lib"
42+
export OPENSSL_INCLUDE_DIR="$( pwd )/openssl/out/${VSCODE_ARCH}-windows-static/include"
3343

34-
rustup target add x86_64-pc-windows-msvc
44+
rustup target add "${VSCODE_CLI_TARGET}"
3545

3646
cargo build --release --target "${VSCODE_CLI_TARGET}" --bin=code
3747

3848
cp "target/${VSCODE_CLI_TARGET}/release/code.exe" "../../VSCode-win32-${VSCODE_ARCH}/bin/${TUNNEL_APPLICATION_NAME}.exe"
3949
else
50+
export OPENSSL_LIB_DIR="$( pwd )/openssl/out/${VSCODE_ARCH}-linux/lib"
51+
export OPENSSL_INCLUDE_DIR="$( pwd )/openssl/out/${VSCODE_ARCH}-linux/include"
52+
export VSCODE_SYSROOT_DIR="../.build/sysroots"
53+
4054
if [[ "${VSCODE_ARCH}" == "arm64" ]]; then
4155
VSCODE_CLI_TARGET="aarch64-unknown-linux-gnu"
56+
57+
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc
58+
export CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc
59+
export CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++
60+
export PKG_CONFIG_ALLOW_CROSS=1
61+
62+
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu crossbuild-essential-arm64
4263
elif [[ "${VSCODE_ARCH}" == "armhf" ]]; then
4364
VSCODE_CLI_TARGET="armv7-unknown-linux-gnueabihf"
65+
66+
export OPENSSL_LIB_DIR="$( pwd )/openssl/out/arm-linux/lib"
67+
export OPENSSL_INCLUDE_DIR="$( pwd )/openssl/out/arm-linux/include"
68+
export CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc
69+
export CC_armv7_unknown_linux_gnueabihf=arm-linux-gnueabihf-gcc
70+
export CXX_armv7_unknown_linux_gnueabihf=arm-linux-gnueabihf-g++
71+
export PKG_CONFIG_ALLOW_CROSS=1
72+
73+
sudo apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf crossbuild-essential-armhf
4474
elif [[ "${VSCODE_ARCH}" == "x64" ]]; then
4575
VSCODE_CLI_TARGET="x86_64-unknown-linux-gnu"
46-
elif [[ "${VSCODE_ARCH}" == "ppc64le" ]]; then
47-
VSCODE_CLI_TARGET="powerpc64-unknown-linux-gnu"
48-
elif [[ "${VSCODE_ARCH}" == "riscv64" ]]; then
49-
VSCODE_CLI_TARGET="riscv64-unknown-linux-gnu"
50-
elif [[ "${VSCODE_ARCH}" == "loong64" ]]; then
51-
VSCODE_CLI_TARGET="loongarch64-unknown-linux-gnu"
5276
fi
5377

5478
if [[ -n "${VSCODE_CLI_TARGET}" ]]; then
79+
rustup target add "${VSCODE_CLI_TARGET}"
80+
5581
cargo build --release --target "${VSCODE_CLI_TARGET}" --bin=code
5682

5783
cp "target/${VSCODE_CLI_TARGET}/release/code" "../../VSCode-linux-${VSCODE_ARCH}/bin/${TUNNEL_APPLICATION_NAME}"

0 commit comments

Comments
 (0)