mirror of
https://github.com/luxfi/dex.git
synced 2026-09-24 00:26:31 +00:00
The dexgpu refactor moved the LDFLAGS that link libsecp256k1_metal.a into
signed_order_gpu.go (//go:build cgo && dexgpu), but the anchor that force-keeps
secp256k1_ecrecover_address_batch_metal stayed //go:build cgo && darwin. So a
DEFAULT darwin build (no dexgpu) compiled the anchor — referencing the Metal
symbol — while never linking the lib that defines it, breaking the link of every
binary that pulls dex/pkg/dex (e.g. the luxfi/evm C-Chain plugin):
Undefined symbols: _secp256k1_ecrecover_address_batch_metal,
referenced from _lux_secp256k1_metal_anchor
Fix: gate the anchor (.go and .c) behind dexgpu too, so it exists only when its
lib is linked. Without dexgpu neither the anchor nor the GPU LDFLAGS compile → no
Metal reference → clean link (CPU ecrecover path). With dexgpu both compile and
libsecp256k1_metal.a is linked from the build tree, exactly as before. The build
constraint is honored in the .c (cgo applies //go:build to C files).
Verified: `go build ./plugin/` in luxfi/evm now links the 68 MB C-Chain plugin
binary clean in the default build (previously failed on the undefined Metal symbol).
Co-authored-by: Hanzo Dev <[email protected]>