chenwei791129 opened a new pull request, #9292:
URL: https://github.com/apache/devlake/pull/9292

   ### Summary
   
   The `Build and cache devlake (arm64)` job on `main` has failed since #9288 
([failed 
run](https://github.com/apache/devlake/actions/runs/41179873753/job/124477116090)):
   
   ```text
   ld: /usr/local/deps/aarch64/lib/libgit2.so: undefined reference to 
`SSL_connect@OPENSSL_3.0.0'
   ...
   collect2: error: ld returned 1 exit status
   make: *** [Makefile:75: build-server] Error 1
   ```
   
   **Why it broke**
   
   - `libgit2.so` is built against the target rootfs (`/rootfs-arm64`), which 
has the target's `libssl` / `libcrypto`.
   - Before #9288, only the plugin `.so` files linked libgit2. Shared objects 
may leave symbols unresolved, so nothing checked libgit2's own dependencies.
   - After #9288, the `lake` executable links libgit2. An executable must 
resolve everything, so `ld` looks for `libssl.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 the `build` 
stage for each target arch. `-rpath-link` only tells `ld` where 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.
   
   | Build | Before | After |
   | --- | --- | --- |
   | Cross build (host arch ≠ target arch) | link fails, undefined 
`OPENSSL_3.0.0` symbols | `bin/lake` links |
   | Native build (host arch = target arch) | works | works (extra flag is 
harmless) |
   
   The 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 `build` workflow failure on `main` after #9288.
   
   ### Screenshots
   
   N/A
   
   ### Other Information
   
   **Verification** (local, Podman on an arm64 host, `--target build`):
   
   | Check | Before | After |
   | --- | --- | --- |
   | `--platform linux/amd64` (cross link, x86_64 target) | 69 `undefined 
reference ...@OPENSSL_3.0.0`, `build-server` fails | 0 undefined references, 
`bin/lake` produced |
   | `--platform linux/arm64` (native) | passes | not re-run |
   
   Not verified locally: the exact CI case (amd64 host, arm64 target). Podman 
cannot set `BUILDPLATFORM` and `TARGETPLATFORM` independently. The arm64 branch 
uses the same pattern as the verified amd64 branch; this PR's CI run is the 
check for it. I also did not run the full runtime image.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to