libgit2 / libgit2sharp.nativebinaries

MIT License
28 stars 62 forks source link

Support cross-building for 32-bit arm #92

Closed qmfrederik closed 4 years ago

qmfrederik commented 5 years ago

As a follow-up to #91, this adds support for cross-building for 32-bit arm.

.NET Core 2.1, 2.2 and 3.0 support/will support 32-bit arm on Ubuntu 16.04, Ubuntu 18.04, Ubuntu 18.10 and Debian 9:

This keeps the RID graph rather limited, so this PR includes cross-builds for all these distros individually.

As for the dependencies, Ubuntu 18.04 and Ubuntu 18.10 end up with the same dependencies. Debian 9 has very similar dependencies, with the difference of ld-lnux-armhf.so.3 not being required:

$ readelf -d nuget.package/runtimes/ubuntu.16.04-arm/native/libgit2-.so 

Dynamic section at offset 0xb2ef0 contains 30 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [librt.so.1]
 0x00000001 (NEEDED)                     Shared library: [libpthread.so.0]
 0x00000001 (NEEDED)                     Shared library: [libssl.so.1.0.0]
 0x00000001 (NEEDED)                     Shared library: [libcrypto.so.1.0.0]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x00000001 (NEEDED)                     Shared library: [ld-linux-armhf.so.3]
$ readelf -d nuget.package/runtimes/ubuntu.18.04-arm/native/libgit2-.so 

Dynamic section at offset 0xb6ef0 contains 30 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [librt.so.1]
 0x00000001 (NEEDED)                     Shared library: [libpthread.so.0]
 0x00000001 (NEEDED)                     Shared library: [libssl.so.1.1]
 0x00000001 (NEEDED)                     Shared library: [libcrypto.so.1.1]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x00000001 (NEEDED)                     Shared library: [ld-linux-armhf.so.3]
$ readelf -d nuget.package/runtimes/ubuntu.18.10-arm/native/libgit2-.so 

Dynamic section at offset 0xa7ef0 contains 30 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [librt.so.1]
 0x00000001 (NEEDED)                     Shared library: [libpthread.so.0]
 0x00000001 (NEEDED)                     Shared library: [libssl.so.1.1]
 0x00000001 (NEEDED)                     Shared library: [libcrypto.so.1.1]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x00000001 (NEEDED)                     Shared library: [ld-linux-armhf.so.3]
$readelf -d nuget.package/runtimes/debian.9-arm/native/libgit2-.so 

Dynamic section at offset 0xacef8 contains 29 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [librt.so.1]
 0x00000001 (NEEDED)                     Shared library: [libpthread.so.0]
 0x00000001 (NEEDED)                     Shared library: [libssl.so.1.1]
 0x00000001 (NEEDED)                     Shared library: [libcrypto.so.1.1]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
qmfrederik commented 5 years ago

I guess you could try to use the Debian 9 build for the linux-arm RID, and that file would be used for Debian 9, Ubuntu 18.04 and Ubuntu 18.10. They should all satisfy the declared dependencies.

bording commented 5 years ago

Looking at the current RID graph, I'm currently thinking that providing a linux-arm binary might be opening us up to too many unverified scenarios, but maybe ubuntu.16.04-arm and debian-arm (with the debian 9 binary being used for that) would work.

However, before doing that, we should verify that the debian 9 binary would actually work properly on Ubuntu.

qmfrederik commented 5 years ago

I have ARM hardware so I can run some tests. Ideally I'd run them in a CI system (e.g. Drone CI) so they outcome is documented and reproducible.

How do you want to test this? Is there a test suite from libgit2sharp I can run with the ARM binaries that should pass?

bording commented 5 years ago

How do you want to test this? Is there a test suite from libgit2sharp I can run with the ARM binaries that should pass?

Yes, running the LibGit2Sharp tests would be perfect. The primary thing I want to test before we merge this PR would be that if we shipped debian-arm and ubuntu.16.04-arm that the binaries would actually work for full set of OSes.

The easiest way to accomplish that might be to build a pre-release version of the nativebinaries package and then reference that from LibGit2Sharp.

bording commented 5 years ago

@qmfrederik Let's make the same changes here as we did for the ARM64 PR.

qmfrederik commented 5 years ago

@bording Sure, I updated the PR and squashed the commits. I'll monitor CI; let me know if there's anything else you need from me.

Thanks for your patience!

qmfrederik commented 5 years ago

@bording Gentle ping, do you think this PR is ready to be merged?

bording commented 4 years ago

@qmfrederik After an extreme delay, it looks like some progress is finally being made again, so I've incorporated the changes here into #96.

The goal is to be able to provide a single binary per architecture now that it seems achievable to remove OpenSSL as a requirement, so I'm moved to just using the debian-based image for arm/arm64,

We'll have to see if that works, and if not tweak things as we go.

bording commented 4 years ago

96 is merged, so this is in master now.

qmfrederik commented 4 years ago

Thanks @bording. Here's to cross-platform, cross-distro libgit2 on Linux!