一、服务器情况
- 4vCPU、16GB
- 华为云运行
- 操作系统版本:
Linux ecs-70a2 4.19.90-17.5.ky10.aarch64 #1 SMP Fri Aug 7 13:35:33 CST 2020 aarch64 aarch64 aarch64 GNU/Linux
二、需要升级的组件
- node.js版本
- python版本
- gcc版本
2.1. 安装Node.js
- 按照官方的操作方法:
shell
# 下载并安装 nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
# 代替重启 shell
\. "$HOME/.nvm/nvm.sh"
# 下载并安装 Node.js:
nvm install 22
# 验证 Node.js 版本:
node -v # Should print "v22.21.1".
# 验证 npm 版本:
npm -v # Should print "10.9.4".
-
nvm顺利安装
shell[root@ecs-70a2 ~]# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 16631 100 16631 0 0 3629 0 0:00:04 0:00:04 --:--:-- 4918 => Downloading nvm from git to '/root/.nvm' => Cloning into '/root/.nvm'... remote: Enumerating objects: 384, done. remote: Counting objects: 100% (384/384), done. remote: Compressing objects: 100% (328/328), done. remote: Total 384 (delta 42), reused 182 (delta 28), pack-reused 0 (from 0) Receiving objects: 100% (384/384), 392.50 KiB | 44.00 KiB/s, done. Resolving deltas: 100% (42/42), done. * (HEAD detached at FETCH_HEAD) master => Compressing and cleaning up git repository => Appending nvm source string to /root/.bashrc => Appending bash_completion source string to /root/.bashrc => Close and reopen your terminal to start using nvm or run the following to use it now: export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion -
安装 Node.js的时候跪了,一直卡着不动,然后结束
shell[root@ecs-70a2 ~]# nvm install 22 Downloading and installing node v22.21.1... Downloading https://nodejs.org/dist/v22.21.1/node-v22.21.1-linux-arm64.tar.xz...在服务器上配置网络,配置好了之后下载还是奇慢无比
shell[root@ecs-70a2 ~]# nvm install 22 Downloading and installing node v22.21.1... Local cache found: ${NVM_DIR}/.cache/bin/node-v22.21.1-linux-arm64/node-v22.21.1-linux-arm64.tar.xz Computing checksum with sha256sum Checksums do not match: 'aef9c8fb3c1a290ab1deed5e2e3755d408b19627c1bcfb9b0c7fb86951e8f8ba' found, 'e660365729b434af422bcd2e8e14228637ecf24a1de2cd7c916ad48f2a0521e1' expected. Checksum check failed! Removing the broken local cache... Downloading https://nodejs.org/dist/v22.21.1/node-v22.21.1-linux-arm64.tar.xz... ### 2.1%^C看到读了cache目录
${NVM_DIR}/.cache/bin/node-v22.21.1-linux-arm64/,所以自己从https://nodejs.org/dist/v22.21.1/node-v22.21.1-linux-arm64.tar.xz下载了一个文件放到上述目录,终于正常安装完Node.jsshell[root@ecs-70a2 ~]# nvm install 22 Downloading and installing node v22.21.1... Local cache found: ${NVM_DIR}/.cache/bin/node-v22.21.1-linux-arm64/node-v22.21.1-linux-arm64.tar.xz Checksums match! Using existing downloaded archive ${NVM_DIR}/.cache/bin/node-v22.21.1-linux-arm64/node-v22.21.1-linux-arm64.tar.xz Now using node v22.21.1 (npm v10.9.4) Creating default alias: default -> 22 (-> v22.21.1) [root@ecs-70a2 ~]# node -v v22.21.1 [root@ecs-70a2 ~]# npm -v 10.9.4
2.2. 安装编译是操作系统需要的各种依赖
shell
[root@ecs-70a2 vscode]# yum groupinstall "Development Tools" && sudo yum install libX11-devel libxkbfile-devel libsecret-devel krb5-devel
Last metadata expiration check: 0:36:33 ago on Thu 08 Jan 2026 03:43:07 PM CST.
No match for group package "pkgconf-pkg-config"
No match for group package "huaweijdk-8"
No match for group package "pkgconf-m4"
No match for group package "rpm-sign"
Dependencies resolved.
===============================================================================================================================================================================================
Package Architecture Version Repository Size
===============================================================================================================================================================================================
Upgrading:
glibc aarch64 2.28-36.1.p03.01.ky10 ks10-adv-os 3.1 M
glibc-common aarch64 2.28-36.1.p03.01.ky10 ks10-adv-os 26 M
glibc-devel aarch64 2.28-36.1.p03.01.ky10 ks10-adv-os 2.6 M
Installing group/module packages:
asciidoc noarch 8.6.10-3.ky10 ks10-adv-os 250 k
autoconf noarch 2.69-30.ky10 ks10-adv-os 610 k
automake noarch 1.16.1-6.ky10 ks10-adv-os 453 k
bison aarch64 3.5-2.ky10 ks10-adv-os 318 k
byacc aarch64 1.9.20170709-9.ky10 ks10-adv-os 61 k
ctags aarch64 5.8-27.ky10 ks10-adv-os 112 k
diffstat aarch64 1.62-3.ky10 ks10-adv-os 32 k
flex aarch64 2.6.1-13.ky10 ks10-adv-os 299 k
gcc-gfortran aarch64 7.3.0-20190804.h30.ky10 ks10-adv-os 6.4 M
intltool noarch 0.51.0-14.ky10 ks10-adv-os 50 k
libtool aarch64 2.4.6-32.ky10 ks10-adv-os 583 k
ltrace aarch64 0.7.91-29.ky10 ks10-adv-os 118 k
patch aarch64 2.7.6-12.ky10 ks10-adv-os 118 k
patchutils aarch64 0.3.4-13.ky10 ks10-adv-os 61 k
perl-Fedora-VSP noarch 0.001-10.ky10 ks10-adv-os 21 k
perl-generators noarch 1.10-8.ky10 ks10-adv-os 15 k
pesign aarch64 0.113-1.ky10 ks10-adv-os 122 k
rpm-build aarch64 4.15.1-12.ky10 ks10-adv-os 94 k
source-highlight aarch64 3.1.8-23.ky10 ks10-adv-os 372 k
valgrind aarch64 1:3.13.0-29.ky10 ks10-adv-os 4.4 M
valgrind-devel aarch64 1:3.13.0-29.ky10 ks10-adv-os 44 k
Installing dependencies:
adobe-mappings-cmap noarch 20190730-2.ky10 ks10-adv-os 14 k
adobe-mappings-cmap-lang noarch 20190730-2.ky10 ks10-adv-os 2.5 M
adobe-mappings-pdf noarch 20190401-1.ky10 ks10-adv-os 755 k
boost-regex aarch64 1.66.0-18.ky10 ks10-adv-os 260 k
dejavu-fonts noarch 2.35-8.ky10 ks10-adv-os 4.7 M
desktop-file-utils aarch64 0.24-1.ky10 ks10-adv-os 55 k
docbook-dtds noarch 1.0-78.ky10 ks10-adv-os 365 k
docbook-style-xsl noarch 1.79.2-9.ky10 ks10-adv-os 1.6 M
emacs aarch64 1:26.1-12.p01.ky10 ks10-adv-os 1.1 M
emacs-common aarch64 1:26.1-12.p01.ky10 ks10-adv-os 38 M
emacs-filesystem noarch 1:26.1-12.p01.ky10 ks10-adv-os 7.8 k
gd aarch64 2.2.5-6.ky10 ks10-adv-os 140 k
gettext-devel aarch64 0.20.1-2.ky10 ks10-adv-os 665 k
ghostscript aarch64 9.27-8.ky10 ks10-adv-os 2.9 M
giflib aarch64 5.1.4-6.ky10 ks10-adv-os 81 k
google-droid-sans-fonts noarch 20120715-15.ky10 ks10-adv-os 2.5 M
graphviz aarch64 2.40.1-38.ky10 ks10-adv-os 5.1 M
jbig2dec aarch64 0.16-2.ky10 ks10-adv-os 70 k
libgfortran aarch64 7.3.0-20190804.h30.ky10 ks10-adv-os 287 k
libidn aarch64 1.35-8.ky10 ks10-adv-os 180 k
libijs aarch64 0.35-9.ky10 ks10-adv-os 27 k
libpaper aarch64 1.1.24-25.ky10 ks10-adv-os 34 k
openjpeg2 aarch64 2.3.1-2.ky10 ks10-adv-os 189 k
perl-XML-Parser aarch64 1:2.44-3.ky10 ks10-adv-os 191 k
urw-base35-bookman-fonts noarch 20170801-11.ky10 ks10-adv-os 854 k
urw-base35-c059-fonts noarch 20170801-11.ky10 ks10-adv-os 881 k
urw-base35-d050000l-fonts noarch 20170801-11.ky10 ks10-adv-os 76 k
urw-base35-fonts noarch 20170801-11.ky10 ks10-adv-os 9.1 k
urw-base35-fonts-common noarch 20170801-11.ky10 ks10-adv-os 20 k
urw-base35-gothic-fonts noarch 20170801-11.ky10 ks10-adv-os 651 k
urw-base35-nimbus-mono-ps-fonts noarch 20170801-11.ky10 ks10-adv-os 798 k
urw-base35-nimbus-roman-fonts noarch 20170801-11.ky10 ks10-adv-os 862 k
urw-base35-nimbus-sans-fonts noarch 20170801-11.ky10 ks10-adv-os 1.3 M
urw-base35-p052-fonts noarch 20170801-11.ky10 ks10-adv-os 979 k
urw-base35-standard-symbols-ps-fonts noarch 20170801-11.ky10 ks10-adv-os 41 k
urw-base35-z003-fonts noarch 20170801-11.ky10 ks10-adv-os 276 k
xorg-x11-fonts noarch 7.5-24.ky10 ks10-adv-os 15 M
Installing Groups:
Development Tools
Transaction Summary
===============================================================================================================================================================================================
Install 58 Packages
Upgrade 3 Packages
按照VSCode官方手册说法,还有几个依赖必须安装,确认全部安装。
shell
[root@ecs-70a2 vscode]# yum install make pkg-config gcc
2.3. 开始第一次编译,环境参数错误,导致编译失败
shell
[root@ecs-70a2 vscode]# npm install
npm warn skipping integrity check for git dependency ssh://git@github.com/parcel-bundler/watcher.git
npm warn deprecated rimraf@2.6.3: Rimraf versions prior to v4 are no longer supported
npm warn deprecated asar@3.0.3: Please use @electron/asar moving forward. There is no API change, just a package name change
npm error code 1
npm error git dep preparation failed
npm error command /root/.nvm/versions/node/v22.21.1/bin/node /root/.nvm/versions/node/v22.21.1/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/root/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm error > @parcel/watcher@2.5.1 install
npm error > node scripts/build-from-source.js
npm error npm warn using --force Recommended protections disabled.
npm error npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm error npm warn deprecated glob@7.1.7: Glob versions prior to v9 are no longer supported
npm error gyp info it worked if it ends with ok
npm error gyp info using node-gyp@11.2.0
npm error gyp info using node@22.21.1 | linux | arm64
npm error gyp info find Python using Python version 3.7.4 found at "/usr/bin/python3"
npm error gyp http GET https://npmmirror.com/mirrors/electron/v37.7.0/node-v37.7.0-headers.tar.gz
npm error gyp http 404 https://cdn.npmmirror.com/binaries/electron/v37.7.0/node-v37.7.0-headers.tar.gz
npm error gyp WARN install got an error, rolling back install
npm error gyp ERR! configure error
npm error gyp ERR! stack Error: 404 response downloading https://npmmirror.com/mirrors/electron/v37.7.0/node-v37.7.0-headers.tar.gz
npm error gyp ERR! stack at go (/root/.nvm/versions/node/v22.21.1/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:223:21)
npm error gyp ERR! stack at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
npm error gyp ERR! stack at async install (/root/.nvm/versions/node/v22.21.1/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:63:18)
npm error gyp ERR! stack at async getNodeDir (/root/.nvm/versions/node/v22.21.1/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:79:7)
npm error gyp ERR! stack at async run (/root/.nvm/versions/node/v22.21.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js:81:18)
npm error gyp ERR! System Linux 4.19.90-17.5.ky10.aarch64
npm error gyp ERR! command "/root/.nvm/versions/node/v22.21.1/bin/node" "/root/.nvm/versions/node/v22.21.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm error gyp ERR! cwd /root/.npm/_cacache/tmp/git-cloneEgkQ56
npm error gyp ERR! node -v v22.21.1
npm error gyp ERR! node-gyp -v v11.2.0
npm error gyp ERR! not ok
npm error npm error code 1
npm error npm error path /root/.npm/_cacache/tmp/git-cloneEgkQ56
npm error npm error command failed
npm error npm error command sh -c node scripts/build-from-source.js
npm error npm error A complete log of this run can be found in: /root/.npm/_logs/2026-01-08T08_33_34_953Z-debug-0.log
npm error A complete log of this run can be found in: /root/.npm/_logs/2026-01-08T08_32_15_336Z-debug-0.log
设置以下编译参数
shell
[root@ecs-70a2 vscode]# export npm_config_target="37.7.0"
[root@ecs-70a2 vscode]# export npm_config_arch="arm64"
[root@ecs-70a2 vscode]# export npm_config_target_arch="arm64"
[root@ecs-70a2 vscode]# export npm_config_disturl="https://electronjs.org/headers"
[root@ecs-70a2 vscode]# export npm_config_runtime="electron"
[root@ecs-70a2 vscode]# export npm_config_build_from_source="true"
删除缓存重新构建
shell
[root@ecs-70a2 vscode]# rm -rf node_modules
[root@ecs-70a2 vscode]# npm install
npm warn skipping integrity check for git dependency ssh://git@github.com/parcel-bundler/watcher.git
npm warn deprecated osenv@0.1.5: This package is no longer supported.
npm warn deprecated is-data-descriptor@1.0.0: Please upgrade to v1.0.1
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated is-accessor-descriptor@1.0.0: Please upgrade to v1.0.1
npm warn deprecated is-data-descriptor@0.1.4: Please upgrade to v0.1.5
npm warn deprecated is-accessor-descriptor@0.1.6: Please upgrade to v0.1.7
npm warn deprecated is-data-descriptor@0.1.4: Please upgrade to v0.1.5
npm warn deprecated is-accessor-descriptor@0.1.6: Please upgrade to v0.1.7
npm warn deprecated is-data-descriptor@0.1.4: Please upgrade to v0.1.5
npm warn deprecated is-accessor-descriptor@0.1.6: Please upgrade to v0.1.7
npm warn deprecated is-data-descriptor@0.1.4: Please upgrade to v0.1.5
npm warn deprecated is-accessor-descriptor@0.1.6: Please upgrade to v0.1.7
npm warn deprecated is-accessor-descriptor@0.1.6: Please upgrade to v0.1.7
npm warn deprecated is-data-descriptor@0.1.4: Please upgrade to v0.1.5
npm warn deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm warn deprecated rimraf@2.6.3: Rimraf versions prior to v4 are no longer supported
npm warn deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm warn deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
npm warn deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm warn deprecated glob@5.0.15: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@8.1.0: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.1.6: Glob versions prior to v9 are no longer supported
npm warn deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm warn deprecated glob@7.1.7: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.1.7: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.1.6: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.1.6: Glob versions prior to v9 are no longer supported
npm warn deprecated source-map-url@0.4.0: See https://github.com/lydell/source-map-url#deprecated
npm warn deprecated asar@3.0.3: Please use @electron/asar moving forward. There is no API change, just a package name change
npm warn deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm warn deprecated gulp-vinyl-zip@2.1.2: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm warn deprecated fstream@1.0.12: This package is no longer supported.
npm warn deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm warn deprecated sinon@12.0.1: 16.1.1
npm warn deprecated @azure/core-http@2.3.2: This package is no longer supported. Please migrate to use @azure/core-rest-pipeline
npm error code 1
npm error git dep preparation failed
npm error command /root/.nvm/versions/node/v22.21.1/bin/node /root/.nvm/versions/node/v22.21.1/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/root/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm error > @parcel/watcher@2.5.1 install
npm error > node scripts/build-from-source.js
npm error npm warn using --force Recommended protections disabled.
npm error npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm error npm warn deprecated glob@7.1.7: Glob versions prior to v9 are no longer supported
npm error gyp info it worked if it ends with ok
npm error gyp info using node-gyp@11.2.0
npm error gyp info using node@22.21.1 | linux | arm64
npm error gyp info find Python using Python version 3.7.4 found at "/usr/bin/python3"
npm error gyp http GET https://electronjs.org/headers/v37.7.0/node-v37.7.0-headers.tar.gz
npm error gyp http 200 https://artifacts.electronjs.org/headers/dist/v37.7.0/node-v37.7.0-headers.tar.gz
npm error gyp http GET https://electronjs.org/headers/v37.7.0/SHASUMS256.txt
npm error gyp http 200 https://artifacts.electronjs.org/headers/dist/v37.7.0/SHASUMS256.txt
npm error gyp info spawn /usr/bin/python3
npm error gyp info spawn args [
npm error gyp info spawn args '/root/.nvm/versions/node/v22.21.1/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm error gyp info spawn args 'binding.gyp',
npm error gyp info spawn args '-f',
npm error gyp info spawn args 'make',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/root/.npm/_cacache/tmp/git-clone6z1Rhd/build/config.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/root/.nvm/versions/node/v22.21.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/root/.cache/node-gyp/37.7.0/include/node/common.gypi',
npm error gyp info spawn args '-Dlibrary=shared_library',
npm error gyp info spawn args '-Dvisibility=default',
npm error gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/37.7.0',
npm error gyp info spawn args '-Dnode_gyp_dir=/root/.nvm/versions/node/v22.21.1/lib/node_modules/npm/node_modules/node-gyp',
npm error gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/37.7.0/<(target_arch)/node.lib',
npm error gyp info spawn args '-Dmodule_root_dir=/root/.npm/_cacache/tmp/git-clone6z1Rhd',
npm error gyp info spawn args '-Dnode_engine=v8',
npm error gyp info spawn args '--depth=.',
npm error gyp info spawn args '--no-parallel',
npm error gyp info spawn args '--generator-output',
npm error gyp info spawn args 'build',
npm error gyp info spawn args '-Goutput_dir=.'
npm error gyp info spawn args ]
npm error Traceback (most recent call last):
npm error File "/root/.nvm/versions/node/v22.21.1/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 42, in <module>
npm error import gyp # noqa: E402
npm error File "/root/.nvm/versions/node/v22.21.1/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 209
npm error if flags := os.environ.get(env_name) or []:
npm error ^
npm error SyntaxError: invalid syntax
npm error gyp ERR! configure error
npm error gyp ERR! stack Error: `gyp` failed with exit code: 1
npm error gyp ERR! stack at ChildProcess.<anonymous> (/root/.nvm/versions/node/v22.21.1/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:317:18)
npm error gyp ERR! stack at ChildProcess.emit (node:events:519:28)
npm error gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm error gyp ERR! System Linux 4.19.90-17.5.ky10.aarch64
npm error gyp ERR! command "/root/.nvm/versions/node/v22.21.1/bin/node" "/root/.nvm/versions/node/v22.21.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm error gyp ERR! cwd /root/.npm/_cacache/tmp/git-clone6z1Rhd
npm error gyp ERR! node -v v22.21.1
npm error gyp ERR! node-gyp -v v11.2.0
npm error gyp ERR! not ok
npm error npm error code 1
npm error npm error path /root/.npm/_cacache/tmp/git-clone6z1Rhd
npm error npm error command failed
npm error npm error command sh -c node scripts/build-from-source.js
npm error npm error A complete log of this run can be found in: /root/.npm/_logs/2026-01-08T08_43_22_227Z-debug-0.log
npm error A complete log of this run can be found in: /root/.npm/_logs/2026-01-08T08_43_10_381Z-debug-0.log
提示 if flags := os.environ.get(env_name) or []: 语法错误是Python版本不对,继续解决Python版本的问题。
2.4. Python版本问题导致构建失败,通过MiniConda创建Python 3.10版本环境
试过从仓库安装,没有对应版本;也试过从源码构建,configure 环节就过不去,会提示错误 configure: error: C compiler cannot create executables:
shell
[root@ecs-70a2 Python-3.10.13]# ./configure \
> --prefix=/opt/python310 \
> --enable-shared \
> LDFLAGS="-Wl,-rpath /opt/python310/lib"
checking build system type... aarch64-unknown-linux-gnu
checking host system type... aarch64-unknown-linux-gnu
checking for python3.10... no
checking for python3... python3
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... "linux"
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/root/Python-3.10.13':
configure: error: C compiler cannot create executables
下载MiniConda安装脚本,初始化MiniConda环境
shell
[root@ecs-70a2 ~]# bash Miniconda3-latest-Linux-aarch64.sh -b -p $HOME/miniconda3
PREFIX=/root/miniconda3
Unpacking bootstrapper...
Unpacking payload...
Installing base environment...
Preparing transaction: ...working... done
Executing transaction: ...working... done
installation finished.
[root@ecs-70a2 ~]# $HOME/miniconda3/bin/conda init bash
no change /root/miniconda3/condabin/conda
no change /root/miniconda3/bin/conda
no change /root/miniconda3/bin/conda-env
no change /root/miniconda3/bin/activate
no change /root/miniconda3/bin/deactivate
no change /root/miniconda3/etc/profile.d/conda.sh
no change /root/miniconda3/etc/fish/conf.d/conda.fish
no change /root/miniconda3/shell/condabin/Conda.psm1
no change /root/miniconda3/shell/condabin/conda-hook.ps1
no change /root/miniconda3/lib/python3.13/site-packages/xontrib/conda.xsh
no change /root/miniconda3/etc/profile.d/conda.csh
modified /root/.bashrc
==> For changes to take effect, close and re-open your current shell. <==
[root@ecs-70a2 ~]#
[root@ecs-70a2 ~]# source ~/.bashrc
创建Python3.10环境
shell
(base) [root@ecs-70a2 ~]# conda create -n vscode-build python=3.10 -y
CondaToSNonInteractiveError: Terms of Service have not been accepted for the following channels. Please accept or remove them before proceeding:
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
To accept these channels' Terms of Service, run the following commands:
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r
For information on safely removing channels from your conda configuration,
please see the official documentation:
https://www.anaconda.com/docs/tools/working-with-conda/channels
得先接受MiniConda的两个授权,才能创建成功,执行下来两行命令
shell
(base) [root@ecs-70a2 ~]# conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main
accepted Terms of Service for https://repo.anaconda.com/pkgs/main
(base) [root@ecs-70a2 ~]# conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r
accepted Terms of Service for https://repo.anaconda.com/pkgs/r
再次创建Python3.10环境
shell
(base) [root@ecs-70a2 ~]# conda create -n vscode-build python=3.10 -y
2 channel Terms of Service accepted
Retrieving notices: done
Channels:
- defaults
Platform: linux-aarch64
Collecting package metadata (repodata.json): done
Solving environment: done
## Package Plan ##
environment location: /root/miniconda3/envs/vscode-build
added / updated specs:
- python=3.10
The following packages will be downloaded:
package | build
---------------------------|-----------------
libnsl-2.0.0 | h998d150_0 32 KB
python-3.10.19 | h81fb49f_0 12.5 MB
setuptools-80.9.0 | py310hd43f75c_0 1.4 MB
sqlite-3.51.1 | hcfd1b6d_0 1.2 MB
wheel-0.45.1 | py310hd43f75c_0 115 KB
------------------------------------------------------------
Total: 15.3 MB
The following NEW packages will be INSTALLED:
_libgcc_mutex pkgs/main/linux-aarch64::_libgcc_mutex-0.1-main
_openmp_mutex pkgs/main/linux-aarch64::_openmp_mutex-5.1-51_gnu
bzip2 pkgs/main/linux-aarch64::bzip2-1.0.8-h998d150_6
ca-certificates pkgs/main/linux-aarch64::ca-certificates-2025.12.2-hd43f75c_0
expat pkgs/main/linux-aarch64::expat-2.7.3-h5b11e9f_4
ld_impl_linux-aar~ pkgs/main/linux-aarch64::ld_impl_linux-aarch64-2.44-h4e4ac68_2
libexpat pkgs/main/linux-aarch64::libexpat-2.7.3-h5b11e9f_4
libffi pkgs/main/linux-aarch64::libffi-3.4.4-h419075a_1
libgcc pkgs/main/linux-aarch64::libgcc-15.2.0-hc18542e_7
libgcc-ng pkgs/main/linux-aarch64::libgcc-ng-15.2.0-h51576c1_7
libgomp pkgs/main/linux-aarch64::libgomp-15.2.0-hf47c802_7
libnsl pkgs/main/linux-aarch64::libnsl-2.0.0-h998d150_0
libstdcxx pkgs/main/linux-aarch64::libstdcxx-15.2.0-h9538471_7
libstdcxx-ng pkgs/main/linux-aarch64::libstdcxx-ng-15.2.0-h719ae8e_7
libuuid pkgs/main/linux-aarch64::libuuid-1.41.5-h998d150_0
libxcb pkgs/main/linux-aarch64::libxcb-1.17.0-hf66535e_0
libzlib pkgs/main/linux-aarch64::libzlib-1.3.1-h998d150_0
ncurses pkgs/main/linux-aarch64::ncurses-6.5-h419075a_0
openssl pkgs/main/linux-aarch64::openssl-3.0.18-h8a9c3cf_0
pip pkgs/main/noarch::pip-25.3-pyhc872135_0
pthread-stubs pkgs/main/linux-aarch64::pthread-stubs-0.3-hfd63f10_1
python pkgs/main/linux-aarch64::python-3.10.19-h81fb49f_0
readline pkgs/main/linux-aarch64::readline-8.3-h886d1d0_0
setuptools pkgs/main/linux-aarch64::setuptools-80.9.0-py310hd43f75c_0
sqlite pkgs/main/linux-aarch64::sqlite-3.51.1-hcfd1b6d_0
tk pkgs/main/linux-aarch64::tk-8.6.15-h987d8db_0
tzdata pkgs/main/noarch::tzdata-2025b-h04d1e81_0
wheel pkgs/main/linux-aarch64::wheel-0.45.1-py310hd43f75c_0
xorg-libx11 pkgs/main/linux-aarch64::xorg-libx11-1.8.12-hf66535e_1
xorg-libxau pkgs/main/linux-aarch64::xorg-libxau-1.0.12-hf66535e_0
xorg-libxdmcp pkgs/main/linux-aarch64::xorg-libxdmcp-1.1.5-hf66535e_0
xorg-xorgproto pkgs/main/linux-aarch64::xorg-xorgproto-2024.1-h998d150_1
xz pkgs/main/linux-aarch64::xz-5.6.4-h998d150_1
zlib pkgs/main/linux-aarch64::zlib-1.3.1-h998d150_0
Downloading and Extracting Packages:
python-3.10.19 | 12.5 MB | #1 | 1% Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLEOFError(8, '[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1032)')': /pkgs/main/linux-aarch64/setuptools-80.9.0-py310hd43f75c_0.conda | 1%
wheel-0.45.1 | 115 KB | #############################################################8 | 42%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
# $ conda activate vscode-build
#
# To deactivate an active environment, use
#
# $ conda deactivate
激活环境
shell
(base) [root@ecs-70a2 ~]# conda activate vscode-build
(vscode-build) [root@ecs-70a2 ~]# python --version
Python 3.10.19
2.5. gcc版本问题导致构建失败,从源代码编译gcc11.4
解决Python版本问题后,设置环境变量,准备构建。最重要的是加了第一句 export npm_config_python="$(which python)",使用当前虚拟环境的Python版本构建VSCode
shell
(vscode-build) [root@ecs-70a2 vscode]# export npm_config_python="$(which python)"
(vscode-build) [root@ecs-70a2 vscode]# export npm_config_target="37.7.0"
(vscode-build) [root@ecs-70a2 vscode]# export npm_config_arch="arm64"
(vscode-build) [root@ecs-70a2 vscode]# export npm_config_target_arch="arm64"
(vscode-build) [root@ecs-70a2 vscode]# export npm_config_disturl="https://electronjs.org/headers"
(vscode-build) [root@ecs-70a2 vscode]# export npm_config_runtime="electron"
(vscode-build) [root@ecs-70a2 vscode]# export npm_config_build_from_source="true"
执行构建
shell
(vscode-build) [root@ecs-70a2 vscode]# npm install
npm warn skipping integrity check for git dependency ssh://git@github.com/parcel-bundler/watcher.git
npm warn deprecated osenv@0.1.5: This package is no longer supported.
npm warn deprecated is-data-descriptor@1.0.0: Please upgrade to v1.0.1
npm warn deprecated is-accessor-descriptor@1.0.0: Please upgrade to v1.0.1
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated is-accessor-descriptor@0.1.6: Please upgrade to v0.1.7
npm warn deprecated is-data-descriptor@0.1.4: Please upgrade to v0.1.5
npm warn deprecated is-data-descriptor@0.1.4: Please upgrade to v0.1.5
npm warn deprecated is-accessor-descriptor@0.1.6: Please upgrade to v0.1.7
npm warn deprecated is-data-descriptor@0.1.4: Please upgrade to v0.1.5
npm warn deprecated is-accessor-descriptor@0.1.6: Please upgrade to v0.1.7
npm warn deprecated is-data-descriptor@0.1.4: Please upgrade to v0.1.5
npm warn deprecated is-accessor-descriptor@0.1.6: Please upgrade to v0.1.7
npm warn deprecated is-data-descriptor@0.1.4: Please upgrade to v0.1.5
npm warn deprecated is-accessor-descriptor@0.1.6: Please upgrade to v0.1.7
npm warn deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm warn deprecated rimraf@2.6.3: Rimraf versions prior to v4 are no longer supported
npm warn deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm warn deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
npm warn deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm warn deprecated glob@5.0.15: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@8.1.0: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.1.6: Glob versions prior to v9 are no longer supported
npm warn deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm warn deprecated glob@7.1.7: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.1.7: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.1.6: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.1.6: Glob versions prior to v9 are no longer supported
npm warn deprecated source-map-url@0.4.0: See https://github.com/lydell/source-map-url#deprecated
npm warn deprecated asar@3.0.3: Please use @electron/asar moving forward. There is no API change, just a package name change
npm warn deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm warn deprecated gulp-vinyl-zip@2.1.2: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm warn deprecated fstream@1.0.12: This package is no longer supported.
npm warn deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm warn deprecated sinon@12.0.1: 16.1.1
npm warn deprecated @azure/core-http@2.3.2: This package is no longer supported. Please migrate to use @azure/core-rest-pipeline
⠋
⠹
⠼
npm error code 1
npm error git dep preparation failed
npm error command /root/.nvm/versions/node/v22.21.1/bin/node /root/.nvm/versions/node/v22.21.1/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/root/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm error > @parcel/watcher@2.5.1 install
npm error > node scripts/build-from-source.js
npm error
npm error
npm error make: Entering directory '/root/.npm/_cacache/tmp/git-clone2sHztq/build'
npm error CXX(target) Release/obj.target/watcher/src/binding.o
npm error make: Leaving directory '/root/.npm/_cacache/tmp/git-clone2sHztq/build'
npm error npm warn using --force Recommended protections disabled.
npm error npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm error npm warn deprecated glob@7.1.7: Glob versions prior to v9 are no longer supported
npm error gyp info it worked if it ends with ok
npm error gyp info using node-gyp@11.2.0
npm error gyp info using node@22.21.1 | linux | arm64
npm error gyp info find Python using Python version 3.10.19 found at "/root/miniconda3/envs/vscode-build/bin/python"
npm error gyp info spawn /root/miniconda3/envs/vscode-build/bin/python
npm error gyp info spawn args [
npm error gyp info spawn args '/root/.nvm/versions/node/v22.21.1/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm error gyp info spawn args 'binding.gyp',
npm error gyp info spawn args '-f',
npm error gyp info spawn args 'make',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/root/.npm/_cacache/tmp/git-clone2sHztq/build/config.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/root/.nvm/versions/node/v22.21.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/root/.cache/node-gyp/37.7.0/include/node/common.gypi',
npm error gyp info spawn args '-Dlibrary=shared_library',
npm error gyp info spawn args '-Dvisibility=default',
npm error gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/37.7.0',
npm error gyp info spawn args '-Dnode_gyp_dir=/root/.nvm/versions/node/v22.21.1/lib/node_modules/npm/node_modules/node-gyp',
npm error gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/37.7.0/<(target_arch)/node.lib',
npm error gyp info spawn args '-Dmodule_root_dir=/root/.npm/_cacache/tmp/git-clone2sHztq',
npm error gyp info spawn args '-Dnode_engine=v8',
npm error gyp info spawn args '--depth=.',
npm error gyp info spawn args '--no-parallel',
npm error gyp info spawn args '--generator-output',
npm error gyp info spawn args 'build',
npm error gyp info spawn args '-Goutput_dir=.'
npm error gyp info spawn args ]
npm error gyp info spawn make
npm error gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm error g++: error: unrecognized command line option '-std=gnu++20'; did you mean '-std=gnu++03'?
npm error make: *** [watcher.target.mk:140: Release/obj.target/watcher/src/binding.o] Error 1
npm error gyp ERR! build error
npm error gyp ERR! stack Error: `make` failed with exit code: 2
npm error gyp ERR! stack at ChildProcess.<anonymous> (/root/.nvm/versions/node/v22.21.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:219:23)
npm error gyp ERR! System Linux 4.19.90-17.5.ky10.aarch64
npm error gyp ERR! command "/root/.nvm/versions/node/v22.21.1/bin/node" "/root/.nvm/versions/node/v22.21.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm error gyp ERR! cwd /root/.npm/_cacache/tmp/git-clone2sHztq
npm error gyp ERR! node -v v22.21.1
npm error gyp ERR! node-gyp -v v11.2.0
npm error gyp ERR! not ok
npm error npm error code 1
npm error npm error path /root/.npm/_cacache/tmp/git-clone2sHztq
npm error npm error command failed
npm error npm error command sh -c node scripts/build-from-source.js
npm error npm error A complete log of this run can be found in: /root/.npm/_logs/2026-01-09T02_05_45_095Z-debug-0.log
npm error A complete log of this run can be found in: /root/.npm/_logs/2026-01-09T02_04_28_015Z-debug-0.log
然后就看到了错误 npm error g++: error: unrecognized command line option '-std=gnu++20'; did you mean '-std=gnu++03'?,同样是操作系统仓库里没有新的版本,从源码构建吧。
shell
(vscode-build) [root@ecs-70a2 ~]# tar -xf gcc-11.4.0.tar.xz
(vscode-build) [root@ecs-70a2 ~]# cd gcc-11.4.0
(vscode-build) [root@ecs-70a2 gcc-11.4.0]# ./contrib/download_prerequisites
https://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2:
2026-01-09 10:33:13 ERROR 403: Forbidden.
error: Cannot download gmp-6.1.0.tar.bz2 from http://gcc.gnu.org/pub/gcc/infrastructure/
按照标准流程构建失败,gmp-6.1.0.tar.bz2: 确实下载不到。按照Sonnet的建议来操作,手动下载各个依赖。
shell
(vscode-build) [root@ecs-70a2 vscode]# cd /root/gcc-11.4.0
(vscode-build) [root@ecs-70a2 gcc-11.4.0]# wget https://mirrors.aliyun.com/gnu/gmp/gmp-6.1.0.tar.bz2
--2026-01-09 10:42:02-- https://mirrors.aliyun.com/gnu/gmp/gmp-6.1.0.tar.bz2
Connecting to 127.0.0.1:1080... connected.
Proxy request sent, awaiting response... 200 OK
Length: 2383840 (2.3M) [application/x-bzip]
Saving to: 'gmp-6.1.0.tar.bz2'
gmp-6.1.0.tar.bz2 100%[======================================================================================================>] 2.27M --.-KB/s in 0.1s
2026-01-09 10:42:03 (15.2 MB/s) - 'gmp-6.1.0.tar.bz2' saved [2383840/2383840]
(vscode-build) [root@ecs-70a2 gcc-11.4.0]# wget https://mirrors.aliyun.com/gnu/mpfr/mpfr-3.1.6.tar.bz2
--2026-01-09 10:42:06-- https://mirrors.aliyun.com/gnu/mpfr/mpfr-3.1.6.tar.bz2
Connecting to 127.0.0.1:1080... connected.
Proxy request sent, awaiting response... 200 OK
Length: 1287202 (1.2M) [application/x-bzip]
Saving to: 'mpfr-3.1.6.tar.bz2'
mpfr-3.1.6.tar.bz2 100%[======================================================================================================>] 1.23M --.-KB/s in 0.1s
2026-01-09 10:42:07 (9.21 MB/s) - 'mpfr-3.1.6.tar.bz2' saved [1287202/1287202]
(vscode-build) [root@ecs-70a2 gcc-11.4.0]#
(vscode-build) [root@ecs-70a2 gcc-11.4.0]# wget https://mirrors.aliyun.com/gnu/mpc/mpc-1.0.3.tar.gz
--2026-01-09 10:42:10-- https://mirrors.aliyun.com/gnu/mpc/mpc-1.0.3.tar.gz
Connecting to 127.0.0.1:1080... connected.
Proxy request sent, awaiting response... 200 OK
Length: 669925 (654K) [application/octet-stream]
Saving to: 'mpc-1.0.3.tar.gz'
mpc-1.0.3.tar.gz 100%[======================================================================================================>] 654.22K --.-KB/s in 0.02s
2026-01-09 10:42:10 (25.7 MB/s) - 'mpc-1.0.3.tar.gz' saved [669925/669925]
(vscode-build) [root@ecs-70a2 gcc-11.4.0]#
(vscode-build) [root@ecs-70a2 gcc-11.4.0]# wget https://libisl.sourceforge.io/isl-0.18.tar.bz2
--2026-01-09 10:42:13-- https://libisl.sourceforge.io/isl-0.18.tar.bz2
Connecting to 127.0.0.1:1080... connected.
Proxy request sent, awaiting response... 200 OK
Length: 1658291 (1.6M) [application/x-bzip2]
Saving to: 'isl-0.18.tar.bz2'
isl-0.18.tar.bz2 100%[======================================================================================================>] 1.58M 151KB/s in 36s
2026-01-09 10:42:58 (45.3 KB/s) - 'isl-0.18.tar.bz2' saved [1658291/1658291]
(vscode-build) [root@ecs-70a2 gcc-11.4.0]#
(vscode-build) [root@ecs-70a2 gcc-11.4.0]# tar -xf gmp-6.1.0.tar.bz2 && ln -sf gmp-6.1.0 gmp
(vscode-build) [root@ecs-70a2 gcc-11.4.0]# tar -xf mpfr-3.1.6.tar.bz2 && ln -sf mpfr-3.1.6 mpfr
(vscode-build) [root@ecs-70a2 gcc-11.4.0]# tar -xf mpc-1.0.3.tar.gz && ln -sf mpc-1.0.3 mpc
(vscode-build) [root@ecs-70a2 gcc-11.4.0]# tar -xf isl-0.18.tar.bz2 && ln -sf isl-0.18 isl
检查依赖准备完毕
shell
(vscode-build) [root@ecs-70a2 gcc-11.4.0]# ls gmp mpfr mpc isl
gmp:
acinclude.m4 compat.c config.sub COPYINGv3 gen-bases.c gmp-h.in invalid.c mini-gmp mp_get_fns.c NEWS scanf tune
aclocal.m4 compile configure cxx gen-fac.c gmp-impl.h longlong.h missing mp_minv_tab.c nextprime.c tal-debug.c version.c
assert.c configfsf.guess configure.ac demos gen-fib.c gmpxx.h ltmain.sh mp_bpl.c mpn primesieve.c tal-notreent.c ylwrap
AUTHORS configfsf.sub COPYING doc gen-jacobitab.c INSTALL Makefile.am mp_clz_tab.c mpq printf tal-reent.c
bootstrap.c config.guess COPYING.LESSERv3 errno.c gen-psqr.c INSTALL.autoconf Makefile.in mp_dv_tab.c mp_set_fns.c rand test-driver
ChangeLog config.in COPYINGv2 extract-dbl.c gen-trialdivtab.c install-sh memory.c mpf mpz README tests
isl:
aclocal.m4 isl_ast_graft_private.h isl_id_to_ast_expr.c isl_multi_floor.c isl_schedule_node.c isl_val_imath.c
AUTHORS isl_ast_int.c isl_id_to_id.c isl_multi_gist.c isl_schedule_node_private.h isl_val_private.h
basis_reduction_tab.c isl_ast_private.h isl_id_to_pw_aff.c isl_multi_hash.c isl_schedule_private.h isl_val_sioimath.c
basis_reduction_templ.c isl_band.c isl_ilp.c isl_multi_intersect.c isl_scheduler.c isl_vec.c
bound.c isl_band_private.h isl_ilp_private.h isl_multi_macro.h isl_schedule_read.c isl_vec_private.h
bound_test.sh.in isl_basis_reduction.h isl_imath.c isl_multi_templ.c isl_schedule_tree.c isl_version.c
bset_from_bmap.c isl_bernstein.c isl_imath.h isl_multi_templ.h isl_schedule_tree.h isl_vertices.c
bset_to_bmap.c isl_bernstein.h isl_input.c isl_obj.c isl_seq.c isl_vertices_private.h
cat.c isl_blk.c isl_int_gmp.h isl_options.c isl_seq.h isl_yaml.h
ChangeLog isl_blk.h isl_int.h isl_options_private.h isl_set_list.c LICENSE
closure.c isl_bound.c isl_int_imath.h isl_output.c isl_sort.c ltmain.sh
codegen.c isl_bound.h isl_int_sioimath.c isl_output_private.h isl_sort.h m4
codegen_test.sh.in isl_coalesce.c isl_int_sioimath.h isl_point.c isl_space.c Makefile.am
compile isl_config.h.in isl_list_templ.c isl_point_private.h isl_space_private.h Makefile.in
config.guess isl_config_post.h isl_list_templ.h isl_polynomial.c isl_srcdir.c.in missing
config.sub isl_constraint.c isl_local.c isl_polynomial_private.h isl_stream.c mp_get_memory_functions.c
configure isl_constraint_private.h isl_local.h isl_power_templ.c isl_stream_private.h pip.c
configure.ac isl_convex_hull.c isl_local_space.c isl_printer.c isl_tab.c pip_test.sh.in
depcomp isl_ctx.c isl_local_space_private.h isl_printer_private.h isl_tab.h polyhedron_detect_equalities.c
doc isl_ctx_private.h isl_lp.c isl_pw_hash.c isl_tab_lexopt_templ.c polyhedron_minimize.c
GIT_HEAD_ID isl_deprecated.c isl_lp_private.h isl_pw_macro.h isl_tab_pip.c polyhedron_sample.c
imath isl_dim_map.c isl_map.c isl_pw_templ.c isl_tarjan.c polytope_scan.c
imath_wrap isl_dim_map.h isl_map_lexopt_templ.c isl_pw_union_opt.c isl_tarjan.h print.c
include isl_equalities.c isl_map_list.c isl.py isl_test.c print_templ.c
install-sh isl_equalities.h isl_map_private.h isl_range.c isl_test_imath.c print_templ_yaml.c
interface isl_factorization.c isl_map_simplify.c isl_range.h isl_test_int.c read_in_string_templ.c
isl_aff.c isl_factorization.h isl_map_subtract.c isl_reordering.c isl_transitive_closure.c README
isl_affine_hull.c isl_farkas.c isl_map_to_basic_set.c isl_reordering.h isl_union_eval.c schedule.c
isl_aff_private.h isl_ffs.c isl_mat.c isl_sample.c isl_union_macro.h set_from_map.c
isl_arg.c isl_flow.c isl_mat_private.h isl_sample.h isl_union_map.c set_to_map.c
isl_ast_build.c isl_fold.c isl_morph.c isl_scan.c isl_union_map_private.h test-driver
isl_ast_build_expr.c isl_gmp.c isl_morph.h isl_scan.h isl_union_multi.c test_inputs
isl_ast_build_expr.h isl_hash.c isl_multi_apply_set.c isl_schedule_band.c isl_union_neg.c
isl_ast_build_private.h isl_hash_private.h isl_multi_apply_templ.c isl_schedule_band.h isl_union_single.c
isl_ast.c isl_hide_deprecated.h isl_multi_apply_union_set.c isl_schedule.c isl_union_templ.c
isl_ast_codegen.c isl_id.c isl_multi_cmp.c isl_schedule_constraints.c isl_val.c
isl_ast_graft.c isl_id_private.h isl_multi_coalesce.c isl_schedule_constraints.h isl_val_gmp.c
mpc:
aclocal.m4 AUTHORS compile config.h.in configure COPYING.LESSER doc install-sh m4 Makefile.in missing README test-driver TODO
ar-lib ChangeLog config.guess config.sub configure.ac depcomp INSTALL ltmain.sh Makefile.am Makefile.vc NEWS src tests
mpfr:
acinclude.m4 ar-lib BUGS compile config.sub configure.ac COPYING.LESSER doc INSTALL ltmain.sh Makefile.am missing PATCHES src tests tools VERSION
aclocal.m4 AUTHORS ChangeLog config.guess configure COPYING depcomp examples install-sh m4 Makefile.in NEWS README test-driver TODO tune
开始执行编译的第一步,配置
shell
(vscode-build) [root@ecs-70a2 gcc-11.4.0]# mkdir -p build && cd build
(vscode-build) [root@ecs-70a2 build]# ../configure --prefix=/opt/gcc11 --enable-languages=c,c++ --disable-multilib --disable-bootstrap
checking build system type... aarch64-unknown-linux-gnu
checking host system type... aarch64-unknown-linux-gnu
checking target system type... aarch64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
此处省略无数日志
checking where to find the target windres... host tool
checking where to find the target windmc... host tool
checking whether to enable maintainer-specific portions of Makefiles... no
configure: creating ./config.status
config.status: creating Makefile
按CPU核心数执行编译构建
shell
(vscode-build) [root@ecs-70a2 build]# make -j$(nproc)
make[1]: Entering directory '/root/gcc-11.4.0/build'
mkdir -p -- ./fixincludes
mkdir -p -- ./intl
mkdir -p -- ./libiberty
mkdir -p -- ./gmp
Configuring in ./fixincludes
Configuring in ./intl
Configuring in ./gmp
Configuring in ./libiberty
此处省略无数日志
make[4]: Leaving directory '/root/gcc-11.4.0/build/aarch64-unknown-linux-gnu/libsanitizer'
make[3]: Leaving directory '/root/gcc-11.4.0/build/aarch64-unknown-linux-gnu/libsanitizer'
make[2]: Leaving directory '/root/gcc-11.4.0/build/aarch64-unknown-linux-gnu/libsanitizer'
make[1]: Leaving directory '/root/gcc-11.4.0/build'
安装编译的gcc版本
shell
(vscode-build) [root@ecs-70a2 build]# make install
make[1]: Entering directory '/root/gcc-11.4.0/build'
/bin/sh ../mkinstalldirs /opt/gcc11 /opt/gcc11
此处省略无数日志
libtool: finish: PATH="/root/miniconda3/envs/vscode-build/bin:/root/miniconda3/condabin:/root/.nvm/versions/node/v22.21.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin:/sbin" ldconfig -n /opt/gcc11/lib/../lib64
----------------------------------------------------------------------
Libraries have been installed in:
/opt/gcc11/lib/../lib64
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
make[4]: Nothing to be done for 'install-data-am'.
make[4]: Leaving directory '/root/gcc-11.4.0/build/aarch64-unknown-linux-gnu/libatomic'
make[3]: Leaving directory '/root/gcc-11.4.0/build/aarch64-unknown-linux-gnu/libatomic'
make[2]: Leaving directory '/root/gcc-11.4.0/build/aarch64-unknown-linux-gnu/libatomic'
make[1]: Leaving directory '/root/gcc-11.4.0/build'
配置环境变量验证gcc版本安装成功
shell
(vscode-build) [root@ecs-70a2 build]# export PATH="/opt/gcc11/bin:$PATH"
(vscode-build) [root@ecs-70a2 build]# export LD_LIBRARY_PATH="/opt/gcc11/lib64:$LD_LIBRARY_PATH"
(vscode-build) [root@ecs-70a2 build]# export CC=/opt/gcc11/bin/gcc
(vscode-build) [root@ecs-70a2 build]# export CXX=/opt/gcc11/bin/g++
(vscode-build) [root@ecs-70a2 build]# g++ --version
g++ (GCC) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
记得把环境变量设置到 ~/.bashrc 中,再次执行 npm install 终于成功
shell
(vscode-build) [root@ecs-70a2 vscode]# npm install
> fincode-dev@1.106.2 preinstall
> node build/npm/preinstall.js
> fincode-dev@1.106.2 postinstall
> node build/npm/postinstall.js
[build] Installing dependencies...
[build] $ npm install
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
added 536 packages in 37s
92 packages are looking for funding
run `npm fund` for details
[extensions] Installing dependencies...
[extensions] $ npm install
> vscode-extensions@0.0.1 postinstall
> node ./postinstall.mjs
Removed /opt/dev/fincode/vscode/extensions/node_modules/typescript/LICENSE.txt
Removed /opt/dev/fincode/vscode/extensions/node_modules/typescript/README.md
Removed /opt/dev/fincode/vscode/extensions/node_modules/typescript/SECURITY.md
Removed /opt/dev/fincode/vscode/extensions/node_modules/typescript/ThirdPartyNoticeText.txt
Removed /opt/dev/fincode/vscode/extensions/node_modules/typescript/bin
removed '/opt/dev/fincode/vscode/extensions/node_modules/typescript/lib/_tsc.js'
removed '/opt/dev/fincode/vscode/extensions/node_modules/typescript/lib/tsc.js'
removed '/opt/dev/fincode/vscode/extensions/node_modules/typescript/lib/tsserverlibrary.d.ts'
added 1 package, and changed 1 package in 2s
2 packages are looking for funding
run `npm fund` for details
[extensions/configuration-editing] Installing dependencies...
[extensions/configuration-editing] $ npm install
up to date in 492ms
1 package is looking for funding
run `npm fund` for details
[extensions/css-language-features] Installing dependencies...
[extensions/css-language-features] $ npm install
up to date in 531ms
......
1 package is looking for funding
run `npm fund` for details
[test/smoke] Installing dependencies...
[test/smoke] $ npm install
up to date in 580ms
17 packages are looking for funding
run `npm fund` for details
[test/mcp] Installing dependencies...
[test/mcp] $ npm install
up to date in 824ms
82 packages are looking for funding
run `npm fund` for details
[.vscode/extensions/vscode-selfhost-import-aid] Installing dependencies...
[.vscode/extensions/vscode-selfhost-import-aid] $ npm install
up to date in 527ms
[.vscode/extensions/vscode-selfhost-test-provider] Installing dependencies...
[.vscode/extensions/vscode-selfhost-test-provider] $ npm install
up to date in 526ms
1 package is looking for funding
run `npm fund` for details
removed 1 package in 1m
190 packages are looking for funding
run `npm fund` for details
(vscode-build) [root@ecs-70a2 vscode]# npm run gulp compile
> fincode-dev@1.106.2 gulp
> node --max-old-space-size=8192 ./node_modules/gulp/bin/gulp.js compile
[11:32:12] Using gulpfile /opt/dev/fincode/vscode/gulpfile.js
[11:32:12] Starting 'compile'...
[11:32:12] Starting monaco-typecheck ...
[11:32:12] Starting clean-out ...
[11:32:12] Starting clean-extension-configuration-editing ...
......
[11:32:15] Starting compile-extension:json-language-features-client ...
......
[11:32:15] Finished compile-extension-media after 2594 ms
(node:145853) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
[11:32:29] Finished compile-extension:vscode-selfhost-import-aid after 14393 ms
[11:32:30] Finished compile-extension:debug-auto-launch after 17612 ms
[11:32:30] Finished compile-extension:grunt after 16993 ms
[11:32:30] Finished compile-extension:gulp after 16972 ms
[11:32:30] Finished compile-extension:jake after 16808 ms
......
[11:33:16] Finished compile-extension:html-language-features-server after 62700 ms
[11:33:20] Finished compile-extension:git after 67616 ms
[11:33:20] Finished compilation api-proposal-names with 0 errors after 68235 ms
[11:33:20] Finished compile-api-proposal-names after 68278 ms
[11:33:20] Starting compile-src ...
[11:33:35] Starting compilation...
[11:33:41] Finished compile-extension:markdown-language-features after 87924 ms
[11:33:42] Finished compilation extensions with 0 errors after 89404 ms
[11:33:42] Finished compile-extension:typescript-language-features after 87715 ms
[11:33:42] Finished compile-extension:terminal-suggest after 88212 ms
[11:33:42] Starting compile-extensions ...
[11:33:42] Finished compile-extensions after 0 ms
[11:37:26] Finished compilation with 0 errors after 231259 ms
[11:37:26] Finished compile-src after 245493 ms
[11:37:26] Starting compile-client ...
[11:37:26] Finished compile-client after 0 ms
[11:37:26] Starting compile ...
[11:37:26] Finished compile after 0 ms
[11:37:26] Finished 'compile' after 5.22 min
三、解决生产构建时报告内存不足问题,最终构建成功
3.1. 操作系统未设置swap导致构建过程中进程直接被kill
shell
(vscode-build) [root@ecs-70a2 vscode]# npm run gulp vscode-reh-linux-arm64-min
> fincode-dev@1.106.2 gulp
> node --max-old-space-size=8192 ./node_modules/gulp/bin/gulp.js vscode-reh-linux-arm64-min
[11:59:58] Using gulpfile /opt/dev/fincode/vscode/gulpfile.js
[11:59:58] Starting 'vscode-reh-linux-arm64-min'...
[11:59:58] Starting clean-out-build ...
[11:59:58] Finished clean-out-build after 30 ms
[11:59:58] Starting build-date-file ...
[11:59:58] Finished build-date-file after 1 ms
[11:59:58] Starting compile-api-proposal-names ...
[11:59:58] Starting compilation api-proposal-names...
(node:146629) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
[11:59:58] Finished compilation api-proposal-names with 0 errors after 185 ms
[11:59:58] Finished compile-api-proposal-names after 201 ms
[11:59:58] Starting compile-src ...
[12:00:39] [mangler] Done collecting. Classes: 9231. Exported symbols: 11383
[12:00:42] [mangler] Done creating class replacements
[12:00:42] [mangler] Starting prepare rename edits
[12:00:44] Starting compilation...
Killed
添加swap,解决构建时进程被kill的问题,事后想来,在ARM64环境中构建,内存已经超过了服务器内存16G的限制,所以没有swap的时候直接被kill了。
shell
(base) [root@ecs-70a2 ~]# dd if=/dev/zero of=/swapfile bs=1G count=8 status=progress
8589934592 bytes (8.6 GB, 8.0 GiB) copied, 154 s, 55.9 MB/s
8+0 records in
8+0 records out
8589934592 bytes (8.6 GB, 8.0 GiB) copied, 154.452 s, 55.6 MB/s
(base) [root@ecs-70a2 ~]# mkswap /swapfile
Setting up swapspace version 1, size = 8 GiB (8589869056 bytes)
no label, UUID=5b58cf96-29f6-4167-b553-5bb151818069
(base) [root@ecs-70a2 ~]# swapon /swapfile
(base) [root@ecs-70a2 ~]# grep -q '/swapfile' /etc/fstab || echo '/swapfile swap swap defaults 0 0' | sudo tee -a /etc/fstab
/swapfile swap swap defaults 0 0
(base) [root@ecs-70a2 ~]# free -lmh
total used free shared buff/cache available
Mem: 15Gi 360Mi 14Gi 54Mi 262Mi 13Gi
Low: 15Gi 622Mi 14Gi
High: 0B 0B 0B
Swap: 8.0Gi 0B 8.0Gi
3.2. 鲲鹏ARMv8架构下构建对内存需求增高,导致反复提示 Worker terminated due to reaching memory limit: JS heap out of memory
首先在 package.json 中添加了一个 gulp-arm64 专属构建任务,设置了大内存,在默认任务中设置的是8G内存,在arm64的任务中设置了14GB内存
json
"scripts": {
"test": "echo Please run any of the test scripts from the scripts folder.",
"test-browser": "npx playwright install && node test/unit/browser/index.js",
......
"gulp": "node --max-old-space-size=8192 ./node_modules/gulp/bin/gulp.js",
"gulp-arm64": "node --max-old-space-size=14336 ./node_modules/gulp/bin/gulp.js",
以下是设置了之后仍然出现构建错误
shell
(vscode-build) [root@ecs-70a2 vscode]# npm run gulp-arm64 vscode-reh-linux-arm64-min
> fincode-dev@1.106.2 gulp-arm64
> node --max-old-space-size=14336 ./node_modules/gulp/bin/gulp.js vscode-reh-linux-arm64-min
[14:40:27] Using gulpfile /opt/dev/fincode/vscode/gulpfile.js
[14:40:27] Starting 'vscode-reh-linux-arm64-min'...
[14:40:27] Starting clean-out-build ...
[14:40:28] Finished clean-out-build after 28 ms
[14:40:28] Starting build-date-file ...
[14:40:28] Finished build-date-file after 1 ms
[14:40:28] Starting compile-api-proposal-names ...
[14:40:28] Starting compilation api-proposal-names...
(node:147536) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
[14:40:28] Finished compilation api-proposal-names with 0 errors after 192 ms
[14:40:28] Finished compile-api-proposal-names after 208 ms
[14:40:28] Starting compile-src ...
[14:41:08] [mangler] Done collecting. Classes: 9231. Exported symbols: 11383
[14:41:12] [mangler] Done creating class replacements
[14:41:12] [mangler] Starting prepare rename edits
[14:41:13] Starting compilation...
[14:56:49] 'vscode-reh-linux-arm64-min' errored after 16 min
[14:56:49] Error [ERR_WORKER_OUT_OF_MEMORY]: Worker terminated due to reaching memory limit: JS heap out of memory
at [kOnExit] (node:internal/worker:316:26)
at Worker.<computed>.onexit (node:internal/worker:232:20)
at Worker.callbackTrampoline (node:internal/async_hooks:130:17)
3.3. 最后通过分步构建来解决,首先执行主程序编译
shell
(vscode-build) [root@ecs-70a2 vscode]# export NODE_OPTIONS="--max-old-space-size=14336"
(vscode-build) [root@ecs-70a2 vscode]#
(vscode-build) [root@ecs-70a2 vscode]# npm run gulp-arm64 compile
> fincode-dev@1.106.2 gulp-arm64
> node --max-old-space-size=14336 ./node_modules/gulp/bin/gulp.js compile
[15:30:05] Using gulpfile /opt/dev/fincode/vscode/gulpfile.js
[15:30:05] Starting 'compile'...
[15:30:05] Starting monaco-typecheck ...
[15:30:05] Starting clean-out ...
[15:30:05] Starting clean-extension-configuration-editing ...
[15:30:05] Starting clean-extension-css-language-features-client ...
[15:30:05] Starting clean-extension-css-language-features-server ...
......
[15:35:20] Finished compilation with 0 errors after 230028 ms
[15:35:20] Finished compile-src after 244352 ms
[15:35:20] Starting compile-client ...
[15:35:20] Finished compile-client after 0 ms
[15:35:20] Starting compile ...
[15:35:20] Finished compile after 0 ms
[15:35:20] Finished 'compile' after 5.25 min
然后编译扩展
shell
(vscode-build) [root@ecs-70a2 vscode]# npm run gulp-arm64 compile-extensions-build
> fincode-dev@1.106.2 gulp-arm64
> node --max-old-space-size=14336 ./node_modules/gulp/bin/gulp.js compile-extensions-build
[15:36:47] Using gulpfile /opt/dev/fincode/vscode/gulpfile.js
[15:36:47] Starting 'compile-extensions-build'...
[15:36:47] Starting clean-extensions-build ...
[15:36:47] Finished clean-extensions-build after 5 ms
[15:36:47] Starting bundle-marketplace-extensions-build ...
......
[15:39:38] Bundled extension: git/extension.webpack.config.js...
[15:39:39] Bundled extension: html-language-features/extension.webpack.config.js...
[15:39:39] Bundled extension: json-language-features/extension.webpack.config.js...
[15:39:48] Bundled extension: markdown-language-features/extension.webpack.config.js...
[15:39:48] Finished bundle-extensions-build after 167222 ms
[15:39:48] Starting compile-extensions-build ...
[15:39:48] Finished compile-extensions-build after 0 ms
[15:39:48] Finished 'compile-extensions-build' after 3.02 min
然后压缩成reh版本文件
shell
(vscode-build) [root@ecs-70a2 vscode]# npm run gulp-arm64 vscode-reh-linux-arm64-min-ci
> fincode-dev@1.106.2 gulp-arm64
> node --max-old-space-size=14336 ./node_modules/gulp/bin/gulp.js vscode-reh-linux-arm64-min-ci
[15:41:46] Using gulpfile /opt/dev/fincode/vscode/gulpfile.js
[15:41:46] Starting 'vscode-reh-linux-arm64-min-ci'...
[15:41:46] Starting compile-native-extensions-build ...
[15:41:47] Finished compile-native-extensions-build after 996 ms
[15:41:47] Starting node ...
[15:41:47] Downloading node.js 22.20.0 linux arm64 from https://nodejs.org...
[15:41:47] Using SHA256 checksum for checking integrity: 4181609e03dcb9880e7e5bf956061ecc0503c77a480c6631d868cb1f65a2c7dd
[15:41:58] Finished node after 11210 ms
[15:41:58] Starting clean-fincode-reh-linux-arm64 ...
[15:41:58] Finished clean-fincode-reh-linux-arm64 after 1 ms
[15:41:58] Starting vscode-reh-linux-arm64-min-ci ...
[15:42:20] Finished vscode-reh-linux-arm64-min-ci after 21566 ms
[15:42:20] Finished 'vscode-reh-linux-arm64-min-ci' after 34 s