From fdedf683ee94da68b2150807440e39a11c495455 Mon Sep 17 00:00:00 2001 From: Jacob Payne Date: Wed, 12 Apr 2023 11:48:32 -0700 Subject: [PATCH] simplify linking of rpc library --- Earthfile | 2 +- pkg/amtrpc/amtrpc.go | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Earthfile b/Earthfile index 985b954..ac9860b 100644 --- a/Earthfile +++ b/Earthfile @@ -49,7 +49,7 @@ build: COPY +amt-rpc-lib/librpc.so /usr/local/lib/librpc.so COPY +amt-rpc-lib/librpc.h /usr/local/include/librpc.h - RUN go build -o agent-provider-amt cmd/main.go && upx agent-provider-amt + RUN go build -ldflags "-linkmode 'external'" -o agent-provider-amt cmd/main.go && upx agent-provider-amt SAVE ARTIFACT agent-provider-amt AS LOCAL artifacts/agent-provider-amt diff --git a/pkg/amtrpc/amtrpc.go b/pkg/amtrpc/amtrpc.go index e9ec47b..33f1c78 100644 --- a/pkg/amtrpc/amtrpc.go +++ b/pkg/amtrpc/amtrpc.go @@ -3,8 +3,7 @@ package amtrpc /* -#cgo CFLAGS: -I./src -#cgo LDFLAGS: -L./lib -lrpc -Wl,-rpath=./lib +#cgo LDFLAGS: -L/usr/local/lib -lrpc -Wl,-rpath=/usr/local/lib #include #include "librpc.h" */