鲲鹏编译Chromium

前言

鲲鹏的服务器似乎和别的arm架构都不一样,使用线上别人的二进制是直接跑不起来
这里记录一下自己编译的过程
服务器使用华为云上海8C32G鲲鹏架构服务器,镜像用的是ubuntu
代理是自己准备的用gost中转socks5

代理准备

由于我用的是gost先要准备gost,但是官方编译的不支持,需要自己编译

环境准备

1
2
3
4
wget https://golang.google.cn/dl/go1.23.4.linux-arm64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.23.4.linux-arm64.tar.gz
export PATH=$PATH:/usr/local/go/bin
go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/,direct

开始编译

1
2
3
git clone https://github.com/go-gost/gost.git
cd gost/cmd/gost
go build

代理配置

git配置

1
2
3
4
5
6
git config --global http.proxy 'socks5://127.0.0.1:1080' 
git config --global https.proxy 'socks5://127.0.0.1:1080'

# 关闭代理
git config --global --unset http.proxy
git config --global --unset https.proxy

终端代理

1
sudo apt-get install polipo

配置/etc/polipo/config

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
logSyslog = true:
logFile = "/var/log/polipo/polipo.log"

socksParentProxy = "127.0.0.1:1080" #这是socks代理的地址和端口
socksProxyType = socks5

chunkHighMark = 50331648
objectHighMark = 16384

serverMaxSlots = 64
serverSlots = 16
serverSlots1 = 32

# 我们最后要使用这个地址作为代理,它会去走SSR的代理
proxyAddress = "127.0.0.1" #这是本代理的地址端口
proxyPort = 8123
1
2
3
4
service polipo restart

export http_proxy="http://127.0.0.1:8123"
export https_proxy="http://127.0.0.1:8123"

换源

1
2
3
4
5
6
cat << EOF > /etc/apt/sources.list
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ focal main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ focal-security main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ focal-updates main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ focal-backports main restricted universe multiverse
EOF

克隆

1
2
3
4
5
6
7
8
9
10
11
12
13
apt update
apt install -y git curl wget
mkdir -p /data/chrome/ChromePwn
cd /data/chrome/ChromePwn
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH="$PATH:/data/chrome/ChromePwn/depot_tools"
source ~/.bashrc
mkdir /data/chrome/Chromium
cd /data/chrome/Chromium
fetch --nohooks chromium

# 断开后继续下载
gclient sync

在最后似乎有一步Syncing projects特别慢,于是我直接换到新加坡的服务器,下载速度达30MB/s,一个上午白费···

克隆完后文件夹一共大小为95G

编译

编译高版本python

1
2
3
4
5
6
7
8
9
apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev curl
wget https://www.python.org/ftp/python/3.11.5/Python-3.11.5.tgz
tar -xf Python-3.11.5.tgz
cd Python-3.11.5
./configure --enable-optimizations
make -j 7
cp python /usr/bin/python3.11
rm -f /usr/bin/python3
ln -s /usr/bin/python3.11 /usr/bin/python3
1
2
3
4
cd src
./build/install-build-deps.sh
gclient runhooks
gn gen out/Default

运行最后一行命令后,把64G内存都占满了,暂时没有办法继续了

遇到的报错

报错

1
gn.py: Could not find gn executable at: ['/data/chrome/Chromium/src/buildtools/linux64/gn/gn', '/data/chrome/Chromium/src/buildtools/linux64/gn']

解决

1
2
mkdir -p buildtools/linux64
cp -Rf /data/chrome/ChromePwn/depot_tools/* buildtools/linux64/