From f8e9393c3566a6f59c9ba3e6d9a36197c7e574de Mon Sep 17 00:00:00 2001 From: Kevin Mas Ruiz Date: Thu, 4 Jul 2024 16:40:04 +0200 Subject: [PATCH 01/13] chore: remove safety for older archs --- .../nodejs-patches/004-build-fix-arm64-cross-compilation.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch b/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch index a104d8edf9..c6af978ba6 100644 --- a/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch +++ b/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch @@ -6,7 +6,7 @@ index f189ba2bf0..2602f6403e 100755 o['variables']['want_separate_host_toolset'] = int(cross_compiling) if target_arch == 'arm64': -+ o['cflags']+=['-msign-return-address=all'] ++ o['cflags']+=[] o['variables']['arm_fpu'] = options.arm_fpu or 'neon' if options.node_snapshot_main is not None: From a2ab3f225e94e887e5f99387b60d38122d3ee7b1 Mon Sep 17 00:00:00 2001 From: Kevin Mas Ruiz Date: Thu, 4 Jul 2024 17:46:24 +0200 Subject: [PATCH 02/13] chore: revert --- .../nodejs-patches/004-build-fix-arm64-cross-compilation.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch b/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch index c6af978ba6..a104d8edf9 100644 --- a/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch +++ b/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch @@ -6,7 +6,7 @@ index f189ba2bf0..2602f6403e 100755 o['variables']['want_separate_host_toolset'] = int(cross_compiling) if target_arch == 'arm64': -+ o['cflags']+=[] ++ o['cflags']+=['-msign-return-address=all'] o['variables']['arm_fpu'] = options.arm_fpu or 'neon' if options.node_snapshot_main is not None: From f0dc1e3cfe268522931e97625cab24480386f903 Mon Sep 17 00:00:00 2001 From: Kevin Mas Ruiz Date: Thu, 4 Jul 2024 18:54:59 +0200 Subject: [PATCH 03/13] chore: patch only non-leaf, rollback behaviour --- .../nodejs-patches/004-build-fix-arm64-cross-compilation.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch b/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch index a104d8edf9..9cd48555cb 100644 --- a/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch +++ b/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch @@ -6,7 +6,7 @@ index f189ba2bf0..2602f6403e 100755 o['variables']['want_separate_host_toolset'] = int(cross_compiling) if target_arch == 'arm64': -+ o['cflags']+=['-msign-return-address=all'] ++ o['cflags']+=['-msign-return-address=non-leaf'] o['variables']['arm_fpu'] = options.arm_fpu or 'neon' if options.node_snapshot_main is not None: From 25e406aea6a2b129053e25c63410ae9b0b357979 Mon Sep 17 00:00:00 2001 From: Kevin Mas Ruiz Date: Thu, 4 Jul 2024 18:58:53 +0200 Subject: [PATCH 04/13] chore: specify target arch --- .../nodejs-patches/004-build-fix-arm64-cross-compilation.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch b/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch index 9cd48555cb..1d0677c73e 100644 --- a/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch +++ b/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch @@ -6,7 +6,7 @@ index f189ba2bf0..2602f6403e 100755 o['variables']['want_separate_host_toolset'] = int(cross_compiling) if target_arch == 'arm64': -+ o['cflags']+=['-msign-return-address=non-leaf'] ++ o['cflags']+=['-msign-return-address=all','-march=armv8'] o['variables']['arm_fpu'] = options.arm_fpu or 'neon' if options.node_snapshot_main is not None: From 2e7c9dce311974c81af0d1dda9a4e9fbbdcf5fb3 Mon Sep 17 00:00:00 2001 From: Kevin Mas Ruiz Date: Thu, 4 Jul 2024 19:20:45 +0200 Subject: [PATCH 05/13] chore: typo --- .../nodejs-patches/004-build-fix-arm64-cross-compilation.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch b/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch index 1d0677c73e..9d4efd21ee 100644 --- a/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch +++ b/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch @@ -6,7 +6,7 @@ index f189ba2bf0..2602f6403e 100755 o['variables']['want_separate_host_toolset'] = int(cross_compiling) if target_arch == 'arm64': -+ o['cflags']+=['-msign-return-address=all','-march=armv8'] ++ o['cflags']+=['-msign-return-address=all','-march=armv8-a'] o['variables']['arm_fpu'] = options.arm_fpu or 'neon' if options.node_snapshot_main is not None: From b903c08ae2148af86a21e0caac81ba9483cb9c60 Mon Sep 17 00:00:00 2001 From: Kevin Mas Ruiz Date: Fri, 5 Jul 2024 11:49:40 +0200 Subject: [PATCH 06/13] chore: try only with the arch limitation --- .../nodejs-patches/004-build-fix-arm64-cross-compilation.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch b/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch index 9d4efd21ee..65bcda5821 100644 --- a/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch +++ b/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch @@ -6,7 +6,7 @@ index f189ba2bf0..2602f6403e 100755 o['variables']['want_separate_host_toolset'] = int(cross_compiling) if target_arch == 'arm64': -+ o['cflags']+=['-msign-return-address=all','-march=armv8-a'] ++ o['cflags']+=['-march=armv8-a'] o['variables']['arm_fpu'] = options.arm_fpu or 'neon' if options.node_snapshot_main is not None: From 7ee9d2b240e86d9ca28d58f2c6fc5a053b11f566 Mon Sep 17 00:00:00 2001 From: Kevin Mas Ruiz Date: Fri, 5 Jul 2024 13:11:43 +0200 Subject: [PATCH 07/13] chore: try force mcpu too --- .../nodejs-patches/004-build-fix-arm64-cross-compilation.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch b/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch index 65bcda5821..44991da2ef 100644 --- a/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch +++ b/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch @@ -6,7 +6,7 @@ index f189ba2bf0..2602f6403e 100755 o['variables']['want_separate_host_toolset'] = int(cross_compiling) if target_arch == 'arm64': -+ o['cflags']+=['-march=armv8-a'] ++ o['cflags']+=['-msign-return-address=all','-march=armv8-a','-mcpu=cortex_a53'] o['variables']['arm_fpu'] = options.arm_fpu or 'neon' if options.node_snapshot_main is not None: From a2abe07500e18149215e7f8d8bd8e4d988ee1ad5 Mon Sep 17 00:00:00 2001 From: Kevin Mas Ruiz Date: Fri, 5 Jul 2024 13:34:23 +0200 Subject: [PATCH 08/13] chore: typo, it uses a dash not a underscore --- .../nodejs-patches/004-build-fix-arm64-cross-compilation.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch b/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch index 44991da2ef..f11a6cb67c 100644 --- a/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch +++ b/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch @@ -6,7 +6,7 @@ index f189ba2bf0..2602f6403e 100755 o['variables']['want_separate_host_toolset'] = int(cross_compiling) if target_arch == 'arm64': -+ o['cflags']+=['-msign-return-address=all','-march=armv8-a','-mcpu=cortex_a53'] ++ o['cflags']+=['-msign-return-address=all','-march=armv8-a','-mcpu=cortex-a53'] o['variables']['arm_fpu'] = options.arm_fpu or 'neon' if options.node_snapshot_main is not None: From b1d2d5ec0d8555bcd4a648d50cd7e17bd7d768ba Mon Sep 17 00:00:00 2001 From: Kevin Mas Ruiz Date: Fri, 5 Jul 2024 17:46:24 +0200 Subject: [PATCH 09/13] chore: try to make it work for cortex a53 --- .../nodejs-patches/004-build-fix-arm64-cross-compilation.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch b/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch index f11a6cb67c..30bd006f4d 100644 --- a/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch +++ b/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch @@ -7,7 +7,7 @@ index f189ba2bf0..2602f6403e 100755 if target_arch == 'arm64': + o['cflags']+=['-msign-return-address=all','-march=armv8-a','-mcpu=cortex-a53'] - o['variables']['arm_fpu'] = options.arm_fpu or 'neon' + o['variables']['arm_fpu'] = options.arm_fpu or 'crypto-neon-fp-armv8' if options.node_snapshot_main is not None: diff --git a/node.gyp b/node.gyp From ae6988541e830b912e1806e7989e41b0ad470a72 Mon Sep 17 00:00:00 2001 From: Kevin Mas Ruiz Date: Fri, 5 Jul 2024 17:54:54 +0200 Subject: [PATCH 10/13] chore: try to fix patch --- .../004-build-fix-arm64-cross-compilation.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch b/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch index 30bd006f4d..cebff5ee95 100644 --- a/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch +++ b/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch @@ -7,9 +7,9 @@ index f189ba2bf0..2602f6403e 100755 if target_arch == 'arm64': + o['cflags']+=['-msign-return-address=all','-march=armv8-a','-mcpu=cortex-a53'] - o['variables']['arm_fpu'] = options.arm_fpu or 'crypto-neon-fp-armv8' +- o['variables']['arm_fpu'] = options.arm_fpu or 'neon' ++ o['variables']['arm_fpu'] = options.arm_fpu or 'crypto-neon-fp-armv8' - if options.node_snapshot_main is not None: diff --git a/node.gyp b/node.gyp index 67909bdeb8..b38250a8cc 100644 --- node.gyp 2024-06-28 10:58:19 From e0841162bfeecca1faa54b4e3885a3de9bcae5a3 Mon Sep 17 00:00:00 2001 From: Kevin Mas Ruiz Date: Mon, 8 Jul 2024 11:45:58 +0200 Subject: [PATCH 11/13] chore: downgrade toolchain, might not be necessary --- .evergreen/install-node-source.sh | 12 +----------- .evergreen/setup-env.sh | 13 +------------ .../004-build-fix-arm64-cross-compilation.patch | 6 +++--- 3 files changed, 5 insertions(+), 26 deletions(-) diff --git a/.evergreen/install-node-source.sh b/.evergreen/install-node-source.sh index b7fb0262f6..62a3ef0633 100755 --- a/.evergreen/install-node-source.sh +++ b/.evergreen/install-node-source.sh @@ -7,17 +7,7 @@ EVGDIR="$ROOT_DIR/.evergreen" NVM_DIR="$EVGDIR/.nvm" ORIGINAL_PATH="${PATH}" -OS_ARCH="$(uname "-m")" - -if [ "$OS_ARCH" = "aarch64" ] || [ "$OS_ARCH" = "arm64" ] ; then - echo "[INFO] Choosing v4 because OS_ARCH is $OS_ARCH" - export TOOLCHAIN_PATH='/opt/mongodbtoolchain/v4/bin' -else - echo "[INFO] Choosing v3 because OS_ARCH is $OS_ARCH" - export TOOLCHAIN_PATH='/opt/mongodbtoolchain/v3/bin' -fi - -export PATH="$TOOLCHAIN_PATH:/opt/mongodbtoolchain/v4/bin:/opt/mongodbtoolchain/v3/bin:${ORIGINAL_PATH}" +export PATH="/opt/mongodbtoolchain/v4/bin:/opt/mongodbtoolchain/v3/bin:${ORIGINAL_PATH}" export CC=gcc export CXX=g++ diff --git a/.evergreen/setup-env.sh b/.evergreen/setup-env.sh index 1b6a88930a..a8ab652a08 100755 --- a/.evergreen/setup-env.sh +++ b/.evergreen/setup-env.sh @@ -1,18 +1,7 @@ set -e set -x -OS_ARCH="$(uname "-m")" - -if [ "$OS_ARCH" = "aarch64" ] || [ "$OS_ARCH" = "arm64" ] ; then - echo "[INFO] Choosing v4 because OS_ARCH is $OS_ARCH" - export TOOLCHAIN_PATH='/opt/mongodbtoolchain/v4/bin' -else - echo "[INFO] Choosing v3 because OS_ARCH is $OS_ARCH" - export TOOLCHAIN_PATH='/opt/mongodbtoolchain/v3/bin' -fi - -export BASEDIR="$PWD/.evergreen" -export PATH="/cygdrive/c/python/Python311/Scripts:/cygdrive/c/python/Python311:/cygdrive/c/Python311/Scripts:/cygdrive/c/Python311:/opt/python/3.6/bin:$BASEDIR/mingit/cmd:$BASEDIR/mingit/mingw64/libexec/git-core:$BASEDIR/git-2:$BASEDIR/npm-10/node_modules/.bin:$BASEDIR/node-v$NODE_JS_VERSION-win-x64:/opt/java/jdk16/bin:/opt/chefdk/gitbin:/cygdrive/c/cmake/bin:$TOOLCHAIN_PATH:$PATH" +export PATH="/cygdrive/c/python/Python311/Scripts:/cygdrive/c/python/Python311:/cygdrive/c/Python311/Scripts:/cygdrive/c/Python311:/opt/python/3.6/bin:$BASEDIR/mingit/cmd:$BASEDIR/mingit/mingw64/libexec/git-core:$BASEDIR/git-2:$BASEDIR/npm-10/node_modules/.bin:$BASEDIR/node-v$NODE_JS_VERSION-win-x64:/opt/java/jdk16/bin:/opt/chefdk/gitbin:/cygdrive/c/cmake/bin:$PATH" export IS_MONGOSH_EVERGREEN_CI=1 export DEBUG="mongodb*,$DEBUG" diff --git a/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch b/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch index cebff5ee95..a104d8edf9 100644 --- a/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch +++ b/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch @@ -6,10 +6,10 @@ index f189ba2bf0..2602f6403e 100755 o['variables']['want_separate_host_toolset'] = int(cross_compiling) if target_arch == 'arm64': -+ o['cflags']+=['-msign-return-address=all','-march=armv8-a','-mcpu=cortex-a53'] -- o['variables']['arm_fpu'] = options.arm_fpu or 'neon' -+ o['variables']['arm_fpu'] = options.arm_fpu or 'crypto-neon-fp-armv8' ++ o['cflags']+=['-msign-return-address=all'] + o['variables']['arm_fpu'] = options.arm_fpu or 'neon' + if options.node_snapshot_main is not None: diff --git a/node.gyp b/node.gyp index 67909bdeb8..b38250a8cc 100644 --- node.gyp 2024-06-28 10:58:19 From ed764d88048cec1f36607bdfd3c4ebea369c11c2 Mon Sep 17 00:00:00 2001 From: Kevin Mas Ruiz Date: Mon, 8 Jul 2024 11:53:52 +0200 Subject: [PATCH 12/13] chore: add v3 toolchain --- .evergreen/setup-env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.evergreen/setup-env.sh b/.evergreen/setup-env.sh index a8ab652a08..4eadab0876 100755 --- a/.evergreen/setup-env.sh +++ b/.evergreen/setup-env.sh @@ -1,7 +1,7 @@ set -e set -x -export PATH="/cygdrive/c/python/Python311/Scripts:/cygdrive/c/python/Python311:/cygdrive/c/Python311/Scripts:/cygdrive/c/Python311:/opt/python/3.6/bin:$BASEDIR/mingit/cmd:$BASEDIR/mingit/mingw64/libexec/git-core:$BASEDIR/git-2:$BASEDIR/npm-10/node_modules/.bin:$BASEDIR/node-v$NODE_JS_VERSION-win-x64:/opt/java/jdk16/bin:/opt/chefdk/gitbin:/cygdrive/c/cmake/bin:$PATH" +export PATH="/cygdrive/c/python/Python311/Scripts:/cygdrive/c/python/Python311:/cygdrive/c/Python311/Scripts:/cygdrive/c/Python311:/opt/python/3.6/bin:$BASEDIR/mingit/cmd:$BASEDIR/mingit/mingw64/libexec/git-core:$BASEDIR/git-2:$BASEDIR/npm-10/node_modules/.bin:$BASEDIR/node-v$NODE_JS_VERSION-win-x64:/opt/java/jdk16/bin:/opt/chefdk/gitbin:/cygdrive/c/cmake/bin:/opt/mongodbtoolchain/v3/bin:$PATH" export IS_MONGOSH_EVERGREEN_CI=1 export DEBUG="mongodb*,$DEBUG" From ff49f6ac0480ce2ca686bda4206ebff0cff35f28 Mon Sep 17 00:00:00 2001 From: Kevin Mas Ruiz Date: Mon, 8 Jul 2024 13:20:58 +0200 Subject: [PATCH 13/13] chore: setup PATH --- .evergreen/setup-env.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.evergreen/setup-env.sh b/.evergreen/setup-env.sh index 4eadab0876..3263e5ea36 100755 --- a/.evergreen/setup-env.sh +++ b/.evergreen/setup-env.sh @@ -1,7 +1,9 @@ set -e set -x +export BASEDIR="$PWD/.evergreen" export PATH="/cygdrive/c/python/Python311/Scripts:/cygdrive/c/python/Python311:/cygdrive/c/Python311/Scripts:/cygdrive/c/Python311:/opt/python/3.6/bin:$BASEDIR/mingit/cmd:$BASEDIR/mingit/mingw64/libexec/git-core:$BASEDIR/git-2:$BASEDIR/npm-10/node_modules/.bin:$BASEDIR/node-v$NODE_JS_VERSION-win-x64:/opt/java/jdk16/bin:/opt/chefdk/gitbin:/cygdrive/c/cmake/bin:/opt/mongodbtoolchain/v3/bin:$PATH" + export IS_MONGOSH_EVERGREEN_CI=1 export DEBUG="mongodb*,$DEBUG"