mirror of
https://github.com/luxfi/crypto.git
synced 2026-07-27 01:54:50 +00:00
hash/blake3: document header/symbol skew workaround
The blake3_c.go cgo block can't switch to #cgo pkg-config: lux-crypto yet because the install-tree header prefixes symbols with lux_crypto_* but the dylib still exports brand-neutral crypto_*. Both names exist in the project at the same time and the .pc bundle binds the wrong pair. Replace the dated comment with the current state (verified 2026-05-21 against the installed luxcrypto.dylib) and the exact conditions for flipping over to pkg-config (either re-prefix the dylib OR drop the prefix from the install header). No functional change: the workaround #cgo lines are the same shape, only the explanatory comment is updated to match reality.
This commit is contained in:
+23
-2
@@ -9,8 +9,29 @@
|
||||
package blake3
|
||||
|
||||
/*
|
||||
#cgo CFLAGS: -I/Users/z/work/luxcpp/crypto/include
|
||||
#cgo LDFLAGS: -L/Users/z/work/luxcpp/crypto/build-local -lluxcrypto -framework Metal -framework Foundation
|
||||
// HEADER/SYMBOL SKEW WORKAROUND — verified still active as of luxcrypto
|
||||
// 1.0.0 install (2026-05-21).
|
||||
//
|
||||
// $LUXCPP_PREFIX/include/lux/crypto/crypto.h declares lux_crypto_* symbols,
|
||||
// but $LUXCPP_PREFIX/lib/libluxcrypto.dylib exports the brand-neutral
|
||||
// crypto_* names that the C++ body still uses
|
||||
// (`nm -D libluxcrypto.dylib | grep crypto_blake3` confirms). The lux-crypto
|
||||
// .pc bundle wires the install header against the dylib and a normal
|
||||
// `#cgo pkg-config: lux-crypto` build fails at link time with
|
||||
// "undefined symbols: _lux_crypto_blake3 _lux_crypto_gpu_available".
|
||||
//
|
||||
// Until the dylib re-prefixes its exports OR the install header drops the
|
||||
// lux_ prefix back to crypto_, we:
|
||||
// * point CFLAGS at the source-tree header (which still spells the
|
||||
// symbols `crypto_*` and matches the dylib)
|
||||
// * emit LDFLAGS by hand against $LUXCPP_PREFIX/lib so the dylib is found
|
||||
// where it was actually installed.
|
||||
//
|
||||
// Once the prefix mismatch is resolved upstream, replace this whole block
|
||||
// with `#cgo pkg-config: lux-crypto`.
|
||||
#cgo CFLAGS: -I${SRCDIR}/../../../../luxcpp/crypto/include
|
||||
#cgo LDFLAGS: -L${SRCDIR}/../../../../luxcpp/install/lib -Wl,-rpath,${SRCDIR}/../../../../luxcpp/install/lib -lluxcrypto
|
||||
#cgo darwin LDFLAGS: -framework Metal -framework Foundation
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
Reference in New Issue
Block a user