Skip to content

Commit 06570b4

Browse files
committed
fix(examples): scope macOS frameworks to darwin in cgo LDFLAGS
The go-demo cgo LDFLAGS hardcoded `-framework CoreFoundation -framework Security`, which only exist on macOS. On the Linux CI runner gcc rejects `-framework`, breaking the examples build. Move those flags to a `#cgo darwin LDFLAGS` line so Linux links with just the portable flags while macOS still pulls the frameworks the Rust staticlib needs transitively. Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
1 parent 9640ce1 commit 06570b4

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

examples/go-demo/cmd/cmf-demo/main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@
2525
package main
2626

2727
/*
28-
#cgo LDFLAGS: -L${SRCDIR}/../../../../target/release -lcpex_demo_ffi -lm -ldl -lpthread -framework CoreFoundation -framework Security
28+
#cgo LDFLAGS: -L${SRCDIR}/../../../../target/release -lcpex_demo_ffi -lm -ldl -lpthread
29+
// CoreFoundation/Security are macOS-only; the Rust staticlib pulls them
30+
// in transitively there. Linux gcc rejects `-framework`, so scope these
31+
// to darwin and leave Linux with the portable flags above.
32+
#cgo darwin LDFLAGS: -framework CoreFoundation -framework Security
2933
#include <stdlib.h>
3034
3135
int cpex_demo_register_factories(void* mgr);

examples/go-demo/main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@
2323
package main
2424

2525
/*
26-
#cgo LDFLAGS: -L${SRCDIR}/../../target/release -lcpex_demo_ffi -lm -ldl -lpthread -framework CoreFoundation -framework Security
26+
#cgo LDFLAGS: -L${SRCDIR}/../../target/release -lcpex_demo_ffi -lm -ldl -lpthread
27+
// CoreFoundation/Security are macOS-only; the Rust staticlib pulls them
28+
// in transitively there. Linux gcc rejects `-framework`, so scope these
29+
// to darwin and leave Linux with the portable flags above.
30+
#cgo darwin LDFLAGS: -framework CoreFoundation -framework Security
2731
#include <stdlib.h>
2832
2933
int cpex_demo_register_factories(void* mgr);

0 commit comments

Comments
 (0)