From: MatthieuCoder Date: Mon, 2 Jan 2023 22:32:01 +0000 (+0400) Subject: statically link liball.a X-Git-Tag: v0.1~26 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=9ceaf1d6be6116fb916e60d593b2fffdfa4de66c;p=matthieu%2Fnova.git statically link liball.a --- diff --git a/exes/all/Cargo.toml b/exes/all/Cargo.toml index d6976ef..41396fc 100644 --- a/exes/all/Cargo.toml +++ b/exes/all/Cargo.toml @@ -25,7 +25,7 @@ config = "0.13.3" pretty_env_logger = "0.4.0" [lib] -crate-type = ["cdylib"] +crate-type = ["staticlib"] [build-dependencies] cbindgen = "0.24.3" \ No newline at end of file diff --git a/exes/all/Makefile b/exes/all/Makefile index 07c02d9..22a67e0 100644 --- a/exes/all/Makefile +++ b/exes/all/Makefile @@ -1,12 +1,12 @@ clean: - rm ./build/libhello.so + rm ./build/* library: cargo build --release build: library - cp ../../target/release/liball.so ./build - go build -ldflags="-r build" -o build/all + cp ../../target/release/liball.a ./build + go build -a -ldflags '-s' -o build/all all: library build diff --git a/exes/all/build.rs b/exes/all/build.rs index e779d53..c52ad11 100644 --- a/exes/all/build.rs +++ b/exes/all/build.rs @@ -15,7 +15,6 @@ fn main() { .to_string(); let config = Config { - namespace: Some(String::from("ffi")), language: Language::C, ..Default::default() }; diff --git a/exes/all/main.go b/exes/all/main.go index 0d15450..6e1f7c0 100644 --- a/exes/all/main.go +++ b/exes/all/main.go @@ -1,7 +1,7 @@ package main /* -#cgo LDFLAGS: -Lbuild -lall +#cgo LDFLAGS: -L./build -lall -lcrypto -lz -ldl -lssl -lm -static-libgcc #include "./build/all.h" */ import "C"