Allow Statically Linking in Go (#2067)

* unset -L and -rpath from CGO_LDFLAGS

Signed-off-by: Pedro Tôrres <t0rr3sp3dr0@gmail.com>

* allow go statically linking

Signed-off-by: Pedro Tôrres <t0rr3sp3dr0@gmail.com>

* fix setup.py

---------

Signed-off-by: Pedro Tôrres <t0rr3sp3dr0@gmail.com>
Co-authored-by: mio <mio@lazym.io>
This commit is contained in:
Pedro Tôrres
2024-12-20 19:02:28 -08:00
committed by GitHub
parent 7737e7b436
commit 2899088844
7 changed files with 33 additions and 76 deletions

View File

@@ -0,0 +1,4 @@
package unicorn
// #cgo CFLAGS: -I../../../include -O3 -Wall -Werror
import "C"

View File

@@ -0,0 +1,6 @@
//go:build !static
package unicorn
// #cgo LDFLAGS: -lunicorn
import "C"

View File

@@ -0,0 +1,7 @@
//go:build static
package unicorn
// #cgo !darwin LDFLAGS: -lunicorn -lpthread -lm -latomic
// #cgo darwin LDFLAGS: -lunicorn.o
import "C"

View File

@@ -7,9 +7,6 @@ import (
)
/*
#cgo CFLAGS: -O3 -Wall -Werror -I../../../include
#cgo LDFLAGS: -L../../../ -lunicorn -Wl,-rpath,${SRCDIR}/../../../
#cgo linux LDFLAGS: -L../../../ -lunicorn -lrt -Wl,-rpath,${SRCDIR}/../../../
#include <unicorn/unicorn.h>
#include "uc.h"
*/