Repository navigation
fix(docker): let the cross linker find libgit2's OpenSSL deps - #9292
Open
chenwei791129 wants to merge 1 commit into
Open
chenwei791129 wants to merge 1 commit into
chenwei791129 wants to merge 1 commit into
Conversation
Since apache#9288 the server binary links libgit2 directly. When the image is cross-built (amd64 runner, arm64 target), ld must resolve libgit2's own dependencies (libssl, libcrypto) but only searches the build host's paths, so the link fails with undefined OPENSSL_3.0.0 symbols. Point ld at the target rootfs with -rpath-link. It only affects link time; nothing is embedded in the binary.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
Build and cache devlake (arm64)job onmainhas failed since #9288 (failed run):Why it broke
libgit2.sois built against the target rootfs (/rootfs-arm64), which has the target'slibssl/libcrypto..sofiles linked libgit2. Shared objects may leave symbols unresolved, so nothing checked libgit2's own dependencies.lakeexecutable links libgit2. An executable must resolve everything, soldlooks forlibssl.so.3. It only searches the build host's paths, finds no arm64 copy, and fails.The fix
Set
CGO_LDFLAGS="-Wl,-rpath-link,<target rootfs lib dirs>"in thebuildstage for each target arch.-rpath-linkonly tellsldwhere to find dependencies of shared libraries at link time. It does not change what is written into the binary, so runtime library loading is unchanged.OPENSSL_3.0.0symbolsbin/lakelinksThe amd64 branch gets the same flag so the image also cross-builds from an arm64 host.
Does this close any open issues?
No issue filed. Fixes the
buildworkflow failure onmainafter #9288.Screenshots
N/A
Other Information
Verification (
--target build):build-devlakejob frombuild.yml(amd64 runner, buildx, arm64 + amd64 targets), registry login and push removed--platform linux/amd64(cross link, x86_64 target)undefined reference ...@OPENSSL_3.0.0,build-serverfailsbin/lakeproduced--platform linux/arm64(native)I did not run the full runtime image.