This commit is contained in:
Arnaud 2025-10-15 11:29:38 +02:00
parent 5b26d4e832
commit 6e52a7106d
No known key found for this signature in database
GPG Key ID: 20E40A5D3110766F
2 changed files with 10 additions and 4 deletions

View File

@ -4,8 +4,13 @@ LIBS_DIR := $(abspath ./libs)
UNAME_S := $(shell uname -s)
# Flags for CGO to find the headers and the shared library
CGO_CFLAGS := -I$(LIBS_DIR)
CGO_LDFLAGS := -L$(LIBS_DIR) -lcodex -Wl,-rpath,$(LIBS_DIR)
ifeq ($(UNAME_S),Darwin)
CGO_CFLAGS := -I$(LIBS_DIR)
CGO_LDFLAGS := -L$(LIBS_DIR) -lcodex -Wl,-rpath,@executable_path/./libs
else
CGO_CFLAGS := -I$(LIBS_DIR)
CGO_LDFLAGS := -L$(LIBS_DIR) -lcodex -Wl,-rpath,$(LIBS_DIR)
endif
ifeq ($(OS),Windows_NT)
BIN_NAME := example.exe
@ -29,6 +34,9 @@ fetch:
rm -f $(LIBS_DIR)/*.zip
build:
@echo "CGO_CFLAGS=$(CGO_CFLAGS)"
@echo "CGO_LDFLAGS=$(CGO_LDFLAGS)"
ls -l $(LIBS_DIR)
CGO_ENABLED=1 CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" go build -o $(BIN_NAME) main.go
run:

View File

@ -8,8 +8,6 @@ import (
"github.com/codex-storage/codex-go-bindings/codex"
)
// #cgo LDFLAGS: -L${SRCDIR}/libs -llibcodex
func main() {
node, err := codex.New(codex.Config{
BlockRetries: 5,