pact-foundation / pact-reference

Reference implementations for the pact specifications
https://pact.io
MIT License
91 stars 46 forks source link

Native libs compiled against 2.29 instead of 2.24 glibc. #354

Closed mefellows closed 5 months ago

mefellows commented 5 months ago

As per #202, the native library should be compiled against a glibc version 2.24. However, as discovered in https://github.com/pact-foundation/pact-js-core/issues/472 it appears to be 2.29, which makes it incompatible with a lot of common base images.

rholshausen commented 5 months ago

This is not all native libs, just maybe the the ARM 64 ones. I checked the x86_64 one and it is correct.

mefellows commented 5 months ago

ah! Strange, they are created from the same script on the same image if I'm not mistaken.

rholshausen commented 5 months ago

No, they are not. The ARM targets use cross to cross-compile the lib on an Intel agent. Cross uses it's own docker image to build the lib.

rholshausen commented 5 months ago

See https://github.com/pact-foundation/pact-reference/blob/master/rust/pact_ffi/release-linux.sh#L41

mefellows commented 5 months ago

Ah, I see.

YOU54F commented 5 months ago

We are using the latest build from main for cross, over the released version of 0.2.5 due to errors in the build process

There are quite a few changes, one notes glibc explicitly although for an arm image

https://github.com/cross-rs/cross/compare/v0.2.5...main

There is an issue pointing to spurious glibc versions, depending on ordering of builds, with a suggestion of a cargo clean between building for different targets, and one mentioning that the x86_64 is building with too new a version of glibc

This might be relevant too, which shows that main branch vs 0.2.5 has additional changes included which update the docker images, but there is also a suggestion that we can control the glibc version used in the build process

https://github.com/cross-rs/cross/issues/1237#issuecomment-1485835717

mefellows commented 5 months ago

Thanks for that cookie trail. Seems like a cargo clean would work, albeit that might significantly increase build times? I can't see how to specify glibc, so that might need some further digging.

YOU54F commented 5 months ago

i think you can specify in the Cross.toml

https://github.com/cross-rs/cross/blob/185398b1b885820515a212de720a306b08e2c8c9/docs/cross_toml.md?plain=1#L103

mefellows commented 5 months ago

Ah!

YOU54F commented 5 months ago

so

There is a centos image, which results in glibc 2.17

only problem we have is ring was recently updated to ring 0.17.x and it fails to build with earlier versions of the image other than the main tag which is using glibc 2.31

   Compiling ring v0.17.7
error: failed to run custom build command for `ring v0.17.7`

Caused by:
  process didn't exit successfully: `/target/release/build/ring-180a88f8bc6be4be/build-script-build` (exit status: 1)
  --- stderr
  /target/release/build/ring-180a88f8bc6be4be/build-script-build: /lib64/libc.so.6: version `GLIBC_2.29' not found (required by /target/release/build/ring-180a88f8bc6be4be/build-script-build)
  /target/release/build/ring-180a88f8bc6be4be/build-script-build: /lib64/libc.so.6: version `GLIBC_2.25' not found (required by /target/release/build/ring-180a88f8bc6be4be/build-script-build)
  /target/release/build/ring-180a88f8bc6be4be/build-script-build: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by /target/release/build/ring-180a88f8bc6be4be/build-script-build)
  /target/release/build/ring-180a88f8bc6be4be/build-script-build: /lib64/libc.so.6: version `GLIBC_2.27' not found (required by /target/release/build/ring-180a88f8bc6be4be/build-script-build)
  /target/release/build/ring-180a88f8bc6be4be/build-script-build: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /target/release/build/ring-180a88f8bc6be4be/build-script-build)

For ref, we can control the images via Cross.toml

[target.aarch64-unknown-linux-gnu]
image="ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main"

published images

https://github.com/cross-rs/cross/pkgs/container/aarch64-unknown-linux-gnu

edit: looks like the glibc failures for ring are due to hanging around cache, sorted with a cargo clean