Properly bundle in libstdc++

This commit is contained in:
Anmol Sethi 2020-05-21 19:18:50 -04:00
parent f117475970
commit ac9b57c07e
No known key found for this signature in database
GPG Key ID: 8CEF1878FF10ADEB
2 changed files with 13 additions and 2 deletions

View File

@ -16,8 +16,11 @@ main() {
mkdir -p "$RELEASE_PATH/bin"
rsync ./ci/build/code-server.sh "$RELEASE_PATH/bin/code-server"
g++ -Wl,--allow-multiple-definition "$node_path" -static-libstdc++ -static-libgcc -o "$RELEASE_PATH/lib/node"
rsync "$node_path" "$RELEASE_PATH/lib/node"
if [[ $OS == "linux" ]]; then
bundle_dynamic_lib libstdc++
bundle_dynamic_lib libgcc_s
fi
ln -s "./bin/code-server" "$RELEASE_PATH/code-server"
ln -s "./lib/node" "$RELEASE_PATH/node"
@ -26,4 +29,11 @@ main() {
yarn --production --frozen-lockfile
}
bundle_dynamic_lib() {
lib_name="$1"
lib_path="$(ldd "$RELEASE_PATH/lib/node" | grep "$lib_name" | awk '{print $3 }')"
cp "$lib_path" "$RELEASE_PATH/lib/"
}
main "$@"

View File

@ -17,4 +17,5 @@ bin_dir() {
}
BIN_DIR=$(bin_dir)
export LD_LIBRARY_PATH="$BIN_DIR/../lib${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}"
exec "$BIN_DIR/../lib/node" "$BIN_DIR/.." "$@"