-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Add support for cross-compiling for s390x platform #9455
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
Conversation
Signed-off-by: Dirk Haubenreisser <[email protected]>
Signed-off-by: Dirk Haubenreisser <[email protected]>
Signed-off-by: Dirk Haubenreisser <[email protected]>
Signed-off-by: Dirk Haubenreisser <[email protected]>
@ejona86 Can you please take a look at this? Should be pretty straightforward. |
Uhh... this isn't the sort of build failure I was expecting:
(I triggered a rebuild; we'll see if it is consistent.) |
Thanks for taking a look! I tested the protobuf compilation on two servers - one running Ubuntu 22.04.1 LTS on x86_64 and the other one running Ubuntu 18.04.6 LTS on s390x. On x86_64, the installed cross-compilation binary for s390x outputs this:
On s390x where cross-compilation isn't needed g++ compiler reports this:
With this compiler, protobuf doesn't built natively on s390x but fails with the same error message we get from this PR's build run. On the x86_64 server the cross compilation works just fine and the build produces the binary as expected. I suspect that the compiler package is of importance - it would seem that one needs the latest and greatest version to be able to compile protobuf for s390x, even in a cross compilation scenario. Which Ubuntu version is the PR build server running? |
Experimented some more... the key is the compiler version - g++-7 is not able to compile the protobuf source code. One must upgrade to g++-11 to succeed. On my s390x server I did this:
After that, the build for protobuf succeeds. Not sure how to deal with this for the cross-compilation package for Ubuntu... on Ubuntu 22.04.1 LTS it would seem you get a compatible compiler when running |
Signed-off-by: Dirk Haubenreisser <[email protected]>
I fixed the issue - turns out g++ version 8.x is able to compile protobuf for s390x. |
Signed-off-by: Dirk Haubenreisser <[email protected]>
Signed-off-by: Dirk Haubenreisser <[email protected]>
Nope, that didn't work... looks like g++ version 11.x is required for building protobuf for s390x. Unfortunately this compiler package is only available on Ubuntu 22.04 LTS. |
Signed-off-by: Dirk Haubenreisser <[email protected]>
Signed-off-by: Dirk Haubenreisser <[email protected]>
@ejona86 Sorry for all the back and forth... I've introduced a somewhat substantial change to the build mechanism by utilizing a dedicated Ubuntu 22.04 LTS Docker container for building the s390x artifacts. This solves the dependency issue for GCC/G++ version 11.x without the need of any modifications to the underlying build server. If you think this approach makes sense all protobuf-related artifact builds could be handled via this container: arm64, ppc64le, s390x and even x86_64 (in that case it would replace the CentOS-based Docker image). |
@ejona86 Could you please take another look? Thanks! |
@ejona86 any update on this? |
@ejona86 I'm looking for s390x support for one of our component and this comes as hard dependency. Please let us know if there are any changes needed before merge. Any input from you will be helpful in speed up our implementation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry this has languished. We've got a work item to upgrade the kokoro environment we're using, as I think it is 16.04, and I didn't expect it to draw out like it has. I didn't realize you had swapped to the dockerfile. I think that is the right approach.
I've made one comment, which I can take or leave.
set -exu -o pipefail | ||
|
||
# first we need to install the prerequisites required for s390x cross compilation | ||
apt-get update && apt-get install -y g++-s390x-linux-gnu |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to install g++-s390x-linux-gnu
within the Dockerfile.
If we do that, do we need this build_s390x_artifacts_in_docker.sh
any more? "$GRPC_JAVA_DIR"/buildscripts/run_in_docker.sh grpc-java-artifacts-x86 SKIP_TESTS=true ARCH=s390_64 /grpc-java/buildscripts/kokoro/unix.sh
might just work.
(And that's making me want to remove build_artifacts_in_docker.sh
, because we can simply run docker twice.)
* Added s390x platform support * Adapt to existing platform naming scheme * Updated s390_64 library whitelist * Use g++ compiler version 8.x for s390x * Introduced dedicated Docker container for building s390x artifacts Minor fix --------- Signed-off-by: Dirk Haubenreisser <[email protected]> Co-authored-by: Eric Anderson <[email protected]>
This PR adds s390x binaries to the maven artifacts published for this component. This PR builds on changes that were added with #6441 and #9284