fix: 添加openbsd支持,说明中添加对于CGO编译参数的说明

This commit is contained in:
spiritlhl
2025-07-17 15:46:59 +00:00
parent e70a295a5f
commit e5f3ca1ec3
7 changed files with 34 additions and 33 deletions

View File

@@ -152,22 +152,14 @@ jobs:
- goos: darwin
goarch: amd64
cgo_enabled: "0"
# cc: "clang --target=x86_64-apple-darwin"
# cflags: "-O2 -arch x86_64 -mmacosx-version-min=10.12"
ldflags: "-s -w"
runner: macos-latest
# runner: ubuntu-latest
# requires_osxcross: true
- goos: darwin
goarch: arm64
cgo_enabled: "0"
# cc: "clang --target=aarch64-apple-darwin"
# cflags: "-O2 -arch arm64 -mmacosx-version-min=11.0"
ldflags: "-s -w"
runner: macos-latest
# runner: ubuntu-latest
# requires_osxcross: true
- goos: linux
goarch: arm
@@ -216,6 +208,18 @@ jobs:
cgo_enabled: "0"
ldflags: "-s -w"
runner: ubuntu-latest
- goos: openbsd
goarch: amd64
cgo_enabled: "0"
ldflags: "-s -w"
runner: ubuntu-latest
- goos: openbsd
goarch: arm64
cgo_enabled: "0"
ldflags: "-s -w"
runner: ubuntu-latest
runs-on: ${{ matrix.runner }}
steps:
@@ -259,17 +263,6 @@ jobs:
sudo apt-get install -y build-essential ;;
esac
# - name: Install osxcross for Darwin
# if: matrix.requires_osxcross == true
# run: |
# git clone --depth=1 https://github.com/tpoechtrager/osxcross.git
# cd osxcross
# wget -nc https://github.com/joseluisq/macosx-sdks/releases/download/12.3/MacOSX12.3.sdk.tar.xz
# mv MacOSX12.3.sdk.tar.xz tarballs/
# UNATTENDED=yes OSX_VERSION_MIN=10.12 ./build.sh
# echo "$PWD/target/bin" >> $GITHUB_PATH
# echo "OSXCROSS_ROOT=$PWD" >> $GITHUB_ENV
- name: Get latest tag
id: tag
run: |

View File

@@ -1,8 +1,10 @@
name: Build and Push Docker Image
on:
release:
types: [ published ]
workflow_run:
workflows: ["Build and Release"]
types:
- completed
workflow_dispatch:
jobs:

View File

@@ -1,8 +1,10 @@
name: Public Build
on:
release:
types: [ published ]
workflow_run:
workflows: ["Build and Release"]
types:
- completed
workflow_dispatch:
jobs:
@@ -68,9 +70,7 @@ jobs:
- name: Build and Test
run: |
# 构建二进制文件
go build -o maintest
# 测试无菜单模式是否正常运行(禁用 security 检测)
env CGO_ENABLED=1 go build -o maintest
./maintest -menu=false -l en -security=false -upload=false || exit 1
rm -rf maintest

View File

@@ -1,8 +1,10 @@
name: Sync Latest Release
on:
release:
types: [published]
workflow_run:
workflows: ["Build and Release"]
types:
- completed
workflow_dispatch:
jobs:

View File

@@ -62,7 +62,7 @@ Shell 版本:[https://github.com/spiritLHLS/ecs](https://github.com/spiritLHLS
- 三网路由测试:基于 [NTrace-core](https://github.com/nxtrace/NTrace-core),二次开发至 [nt3](https://github.com/oneclickvirt/nt3)
- 网速测试:基于 [speedtest.net](https://github.com/spiritLHLS/speedtest.net-CN-ID) 和 [speedtest.cn](https://github.com/spiritLHLS/speedtest.cn-CN-ID) 数据,开发至 [oneclickvirt/speedtest](https://github.com/oneclickvirt/speedtest)
- 三网 Ping 值测试:借鉴 [ecsspeed](https://github.com/spiritLHLS/ecsspeed),二次开发至 [pingtest](https://github.com/oneclickvirt/pingtest)
- 支持root或admin环境下测试支持非root或非admin环境下测试支持离线环境下进行测试,支持无DNS环境下进行测试
- 支持root或admin环境下测试支持非root或非admin环境下测试支持离线环境下进行测试**暂未**支持无DNS环境下进行测试
**本项目初次使用建议查看说明:[跳转](https://github.com/oneclickvirt/ecs/blob/master/README_NEW_USER.md)**
@@ -306,9 +306,11 @@ export PATH=$PATH:/usr/local/go/bin
3. 编译
```bash
go build -o goecs
env CGO_ENABLED=1 go build -o goecs
```
CGO在某些系统和架构中可能需要设置为0请都进行尝试直到编译成功无报错。
4. 运行测试
```bash
./goecs -menu=false -l zh

View File

@@ -58,7 +58,7 @@ Shell version: [https://github.com/spiritLHLS/ecs/blob/main/README_EN.md](https:
- Three-network route test: Modified from [NTrace-core](https://github.com/nxtrace/NTrace-core) to [nt3](https://github.com/oneclickvirt/nt3)
- Speed test: Based on data from [speedtest.net](https://github.com/spiritLHLS/speedtest.net-CN-ID) and [speedtest.cn](https://github.com/spiritLHLS/speedtest.cn-CN-ID), developed to [oneclickvirt/speedtest](https://github.com/oneclickvirt/speedtest)
- Three-network Ping test: Modified from [ecsspeed](https://github.com/spiritLHLS/ecsspeed) to [pingtest](https://github.com/oneclickvirt/pingtest)
- Support root or admin environment testing, also support non-root or non-admin environment testing, semi-support offline environment for testing, not support no DNS environment for testing
- Support root or admin environment testing, support non-root or non-admin environment testing, support offline environment for testing, not support no DNS environment for testing
**For first-time users of this project, it is recommended to check the instructions: [Jump to](https://github.com/oneclickvirt/ecs/blob/master/README_NEW_USER.md)**
@@ -301,9 +301,11 @@ export PATH=$PATH:/usr/local/go/bin
3. Compile
```bash
go build -o goecs
env CGO_ENABLED=1 go build -o goecs
```
CGO may need to be set to 0 in some systems and architectures, please try them all until they compile successfully without errors.
4. Run test
```bash
./goecs -menu=false -l en

View File

@@ -39,7 +39,7 @@ import (
)
var (
ecsVersion = "v0.1.61"
ecsVersion = "v0.1.62"
menuMode bool
onlyChinaTest bool
input, choice string