@@ -48,20 +48,49 @@ jobs:
48
48
RUNTIME_IDENTIFIER : ${{ matrix.rid }}
49
49
50
50
steps :
51
- - name : Install Linux Dependencies
52
- if : matrix.os == 'ubuntu-latest'
53
- run : sudo apt-get update && sudo apt-get install -y clang zlib1g-dev
51
+ - name : Checkout code
52
+ uses : actions/checkout@v4
54
53
55
54
- name : Setup .NET SDK
56
55
uses : actions/setup-dotnet@v4
57
56
with :
58
57
dotnet-version : ' 9.0.x'
59
58
60
- - name : Checkout code
61
- uses : actions/checkout@v4
59
+ - name : Install Linux Dependencies
60
+ if : matrix.os == 'ubuntu-latest'
61
+ run : |
62
+ sudo apt-get update
63
+ sudo apt-get install -y clang zlib1g-dev
64
+
65
+ # Install additional dependencies for ARM64 builds
66
+ if [ "${{ matrix.rid }}" == "linux-arm64" ]; then
67
+ sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu
68
+ fi
62
69
63
70
- name : Publish with Native AOT
64
- run : dotnet publish Lagrange.Core.NativeAPI -c Release -r ${{ matrix.rid }}
71
+ shell : bash
72
+ run : |
73
+ if [ "${{ matrix.rid }}" == "linux-arm64" ] && [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
74
+ # Set up cross-compilation for ARM64 on Ubuntu
75
+ export OBJCOPY=aarch64-linux-gnu-objcopy
76
+
77
+ dotnet publish Lagrange.Core.NativeAPI -c Release -r linux-arm64 \
78
+ /p:CppCompilerAndLinker=clang \
79
+ /p:CrossHostArch=x64 \
80
+ /p:CrossHostCompilerPath=/usr/bin \
81
+ /p:IlcDisableObjCopy=true
82
+
83
+ # Process the generated shared library
84
+ cd Lagrange.Core.NativeAPI/bin/Release/net9.0/linux-arm64/publish/
85
+ if [ -f "Lagrange.Core.NativeAPI.so" ]; then
86
+ aarch64-linux-gnu-objcopy --only-keep-debug Lagrange.Core.NativeAPI.so Lagrange.Core.NativeAPI.so.dbg
87
+ aarch64-linux-gnu-objcopy --strip-debug Lagrange.Core.NativeAPI.so
88
+ aarch64-linux-gnu-objcopy --add-gnu-debuglink=Lagrange.Core.NativeAPI.so.dbg Lagrange.Core.NativeAPI.so
89
+ fi
90
+ cd -
91
+ else
92
+ dotnet publish Lagrange.Core.NativeAPI -c Release -r ${{ matrix.rid }}
93
+ fi
65
94
66
95
- name : Upload artifacts
67
96
if : github.event_name != 'pull_request'
0 commit comments