GoogleCloudPlatform / kms-integrations

https://cloud.google.com/kms
Apache License 2.0
39 stars 13 forks source link

Support for ARM64 #3

Closed Lodek closed 2 years ago

Lodek commented 2 years ago

Greetings,

From the README.md and BUILDING.md, it seems like there is no build support for ARM64 and it would be on a best effort basis. I tried compiling the libkmsp11 and ran into a failed assertion.

I am wondering whether there's some limitation that would cause the lib to absolutely break on an arm64 system or whether this assertion was a safety net? Do you have any estimate on how difficult it would be to add support for arm64?

Any suggestions on what I'd need to modify in order to support it would also be greatly appreciated.

Regards.

bdhess commented 2 years ago

Hey! -- This assertion is indeed just a safety net.

With a few tweaks I was able to get the library to compile and all the tests to pass on an M1 Mac. I think I can give it a try on aarch64 Linux sometime next week just to see what happens, but I don't think it should be too much of a lift to get it to work.

bdhess commented 2 years ago

Turns out there was another minor patch needed to update one of our dependencies. With the combination of this patch and the previous one I mentioned, I built and executed all tests successfully on Ubuntu 20.04 arm64.

Moving forward we'll try to get these patches integrated. Internally we need to put them through CI on all platforms. Informally, even though we don't officially support arm64, after the next round of dependency updates and the upcoming 1.1 release, I'd be surprised if arm64 breaks. There's a lot more eyes on it now that developers actually have arm64 hardware with M1.

Lodek commented 2 years ago

The last patched worked liked a charm!

I was struggling with the Abseil compilation errors but now everything ran smoothly!

There are two little things that I'd like to point out:

  1. There is a missing character for the package checksum in the last patch you linked. The sha should start with a d. (ie dcf71b9cba8dc0ca9940c4b316a0c796be8fab42b070bb6b7cab62b48f0e66c4 instead of cf71b9cba8dc0ca9940c4b316a0c796be8fab42b070bb6b7cab62b48f0e66c4)
    curl -L 'https://github.com/abseil/abseil-cpp/archive/20211102.0.tar.gz' 2> /dev/null | sha256sum                                                                                                                 
    dcf71b9cba8dc0ca9940c4b316a0c796be8fab42b070bb6b7cab62b48f0e66c4
  2. In BUILDING.md it is said that the project can be built using Bazel 4.0 or later. I tried with Bazel 5.0 and ran into some problems regarding. After downgrading to Bazel 4.0, everything ran smoothly. This is my first contact with Bazel so it might very well be something I was doing wrong.

Awesome stuff, thanks a ton!

bdhess commented 2 years ago

I believe this is fixed in the v1.1 tag. Still not officially supported, but should build fine on arm64 Linux. Hopefully we will be in a position to offer an official build and support later this year.