-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WSL2 Ubuntu 22.04.3 LTS交叉编译失败 #69
Comments
解决了吗 |
目前使用master分支在github的云编译成功了
name: 编译xfrpc
on:
workflow_dispatch:
inputs:
branch:
description: '编译xfrpc源码的分支或版本号,默认主分支master'
required: true
default: 'master'
del:
description: '是否删除历史编译的流程记录'
required: true
default: true
type: boolean
rel:
description: '编译完成后是否发布Release'
required: true
default: true
type: boolean
tag:
description: '指定Release的版本号(留空为源码提交哈希值)'
required: false
default: ''
env:
branch: "${{ github.event.inputs.branch }}"
tag: "${{ github.event.inputs.tag }}"
rel: "${{ github.event.inputs.rel }}"
TZ: Asia/Shanghai
permissions:
contents: write
actions: write
jobs:
build:
name: Build ${{ matrix.target }}
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-linux-musl
os: ubuntu-latest
URL: aarch64-linux-musl
ARCH_FLAG: linux-aarch64
- target: x86_64-linux-musl
os: ubuntu-latest
URL: x86_64-linux-musl
ARCH_FLAG: linux-x86_64
- target: i686-linux-musl
os: ubuntu-latest
URL: i686-linux-musl
ARCH_FLAG: linux-generic32
- target: armv7-linux-musleabihf
os: ubuntu-latest
URL: armv7l-linux-musleabihf
ARCH_FLAG: linux-armv4
- target: armv7-linux-musleabi
os: ubuntu-latest
URL: armv7m-linux-musleabi
ARCH_FLAG: linux-armv4
- target: arm-linux-musleabihf
os: ubuntu-latest
URL: arm-linux-musleabihf
ARCH_FLAG: linux-armv4
- target: arm-linux-musleabi
os: ubuntu-latest
URL: arm-linux-musleabi
ARCH_FLAG: linux-armv4
- target: mipsel-linux-musl
os: ubuntu-latest
URL: mipsel-linux-muslsf
ARCH_FLAG: linux-mips32
- target: mips-linux-musl
os: ubuntu-latest
URL: mips-linux-muslsf
ARCH_FLAG: linux-mips32
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
repository: liudf0716/xfrpc
ref: ${{ env.branch }}
- name: 下载linux-musl-gcc
uses: lmq8267/dl-musl@main
with:
target: ${{ matrix.URL }}
static: true
gccpath: /tmp
- name: 编译
run: |
rm -rf thirdparty/openssl-1.1.1m
git clone --recurse-submodules https://github.com/openssl/openssl.git -b openssl-3.4.0 thirdparty/openssl-1.1.1m
sed -i 's|"linux-mips32"|${CMAKE_ARCH_FLAG}|g' thirdparty/CMakeLists.txt
sed -i 's|mips|YES|g' thirdparty/CMakeLists.txt
sed -i 's|--static|no-shared|g' thirdparty/CMakeLists.txt
sed -i 's|DOPENSSL_LIBRARES|DOPENSSL_LIBRARIES|g' thirdparty/CMakeLists.txt
sed -i 's|dl pthread|dl pthread json-c atomic ${PROJECT_SOURCE_DIR}/thirdparty/libs/libz.a ${PROJECT_SOURCE_DIR}/thirdparty/libs/libcrypto.a|g' CMakeLists.txt
sed -i '/${PROJECT_SOURCE_DIR}\/thirdparty\/include\/libevent/i ${PROJECT_SOURCE_DIR}/thirdparty/zlib-1.2.13/' CMakeLists.txt
mkdir -p bin && cd bin
cmake -DTHIRDPARTY_STATIC_BUILD=YES -DCMAKE_ARCH_FLAG="${{ matrix.ARCH_FLAG }}" -DCROSS_C_COMPILER=$CC ..
make
$STRIP xfrpc
file xfrpc
- name: 安装 UPX
uses: crazy-max/ghaction-upx@v3
with:
version: latest
install-only: true
- name: 压缩
run: |
cd bin
cp xfrpc xfrpc-${{ matrix.target }}_upx
mv xfrpc xfrpc-${{ matrix.target }}
upx --lzma --best xfrpc-${{ matrix.target }}_upx
- uses: actions/upload-artifact@v4
with:
name: xfrpc-${{ env.branch }}-${{ matrix.target }}
path: bin/*
- name: 打包
if: github.event.inputs.rel == 'true'
shell: bash
run: |
echo "build_time=$(date '+%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV
if [ -z "$TAG" ]; then
echo "tag=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
fi
echo "haxi=$(git rev-parse HEAD)" >> $GITHUB_ENV
env:
TAG: ${{ env.tag }}
TARGET: ${{ matrix.target }}
- name: 发布Release
if: github.event.inputs.rel == 'true'
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
> ### 编译时间 :${{ env.build_time }} [提交记录](https://github.com/liudf0716/xfrpc/tree/${{ env.haxi }})
[官方源码](https://github.com/liudf0716/xfrpc)
tag_name: ${{env.tag}}
files: |
bin/xfrpc-${{ matrix.target }}
bin/xfrpc-${{ matrix.target }}_upx
del:
runs-on: ubuntu-latest
steps:
- name: 删除流程记录
if: github.event.inputs.del == 'true'
uses: Mattraks/delete-workflow-runs@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
retain_days: 0
keep_minimum_runs: 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
一、环境:
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.3 LTS
Release: 22.04
Codename: jammy
cat /proc/version
Linux version 5.10.102.1-microsoft-standard-WSL2 (oe-user@oe-host) (x86_64-msft-linux-gcc (GCC) 9.3.0, GNU ld (GNU Binutils) 2.34.0.20200220) How to cross compile this project? #1 SMP Wed Mar 2 00:30:59 UTC 2022
3.arm-linux-gnueabihf-gcc --version
arm-linux-gnueabihf-gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 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.
二、编译报错:
1.git拉取master分支
2.执行cmake -DTHIRDPARTY_STATIC_BUILD=arm -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc ..报错
还有其他报错省略
3.执行make 报错
4.将zlib.h和zconf.h复制到include目录下,再执行make 还是报错
The text was updated successfully, but these errors were encountered: