Skip to content

fix(cgo): remove -L${SRCDIR} from LDFLAGS to eliminate ld warning for external consumers#37

Draft
WGB5445 wants to merge 1 commit into
aptos-labs:mainfrom
WGB5445:simulate-fresh-dev
Draft

fix(cgo): remove -L${SRCDIR} from LDFLAGS to eliminate ld warning for external consumers#37
WGB5445 wants to merge 1 commit into
aptos-labs:mainfrom
WGB5445:simulate-fresh-dev

Conversation

@WGB5445

@WGB5445 WGB5445 commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Remove -L${SRCDIR}/native/<triple> from all 8 platform CGO files — this path only resolved correctly for in-repo builds. External consumers saw a spurious ld: warning: search path '...go@v1.1.2/aptosconfidential/native/<triple>' not found because ${SRCDIR} expands to the read-only module cache where no .a file exists.
  • Both in-repo developers and external consumers now pass the library search path explicitly via CGO_LDFLAGS.
  • CI, README, and CLAUDE.md updated to reflect the new requirement.

Usage after this change

External consumer:

go run github.com/aptos-labs/confidential-asset-bindings/bindings/go/aptosconfidential/tools/download@v1.1.3
CGO_LDFLAGS="-L$(pwd)/native/aarch64-apple-darwin" go build ./...

In-repo developer:

cargo build -p aptos_confidential_asset_ffi --release --manifest-path rust/Cargo.toml
TRIPLE=aarch64-apple-darwin
mkdir -p bindings/go/aptosconfidential/native/$TRIPLE
cp rust/target/release/libaptos_confidential_asset_ffi.a bindings/go/aptosconfidential/native/$TRIPLE/
cd bindings/go
CGO_LDFLAGS="-L$(pwd)/aptosconfidential/native/$TRIPLE" go test ./aptosconfidential/...

Test plan

  • In-repo: CGO_LDFLAGS="-L$(pwd)/aptosconfidential/native/aarch64-apple-darwin" go test ./aptosconfidential/... — PASS, zero ld warnings
  • External consumer (via local replace): CGO_LDFLAGS="-L$(pwd)/native/aarch64-apple-darwin" go build ./... — PASS, zero ld warnings
  • CI go-bindings-smoke (linux/amd64) passes with updated CGO_LDFLAGS env var

🤖 Generated with Claude Code

… external consumers

CGO_LDFLAGS is now required by both in-repo developers and external consumers.
The -L${SRCDIR}/native/<triple> path only worked for in-repo builds; external
consumers saw an ld warning because ${SRCDIR} expands to a read-only module
cache path where no .a file exists.

Both scenarios now pass the library search path explicitly via CGO_LDFLAGS:
  In-repo:  CGO_LDFLAGS="-L$(pwd)/aptosconfidential/native/$TRIPLE" go test
  External: CGO_LDFLAGS="-L$(pwd)/native/<triple>" go build

CI, README, and CLAUDE.md updated accordingly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant