From f9f614cc4f0d556692a73af372b9731e3c6d3ad4 Mon Sep 17 00:00:00 2001 From: Asuka Minato Date: Sat, 21 Sep 2024 18:14:08 +0900 Subject: [PATCH 1/6] see where is the so --- build.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build.sh b/build.sh index f3bb478..8de3bcf 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,5 @@ #!/bin/sh set -eux cargo build -gcc examples/basic.c target/debug/librs_fsrs_c.so +find target -name "librs_fsrs_c*" -type f -print -exec gcc examples/basic.c target/debug/{} \; ./a.out - From ebc5b3bd01faf5605ac8c7a5b3e2eaef891743d2 Mon Sep 17 00:00:00 2001 From: Asuka Minato Date: Sat, 21 Sep 2024 18:15:33 +0900 Subject: [PATCH 2/6] fix name and path --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 8de3bcf..6908024 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,5 @@ #!/bin/sh set -eux cargo build -find target -name "librs_fsrs_c*" -type f -print -exec gcc examples/basic.c target/debug/{} \; +find target -name "librs_fsrs_c.so" -type f -print -exec gcc examples/basic.c {} \; ./a.out From 56f3c061ad6eee5f9d76bf77e3cc2fed472b472e Mon Sep 17 00:00:00 2001 From: Asuka Minato Date: Sat, 21 Sep 2024 18:24:36 +0900 Subject: [PATCH 3/6] try again --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 6908024..439bd3b 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,5 @@ #!/bin/sh set -eux cargo build -find target -name "librs_fsrs_c.so" -type f -print -exec gcc examples/basic.c {} \; +find target -name "librs_fsrs_c.so" -not -path "*/deps/*" -type f -print -exec gcc examples/basic.c {} \; ./a.out From 2aa87f035069fb30c3fb89b43aea705eaade50f4 Mon Sep 17 00:00:00 2001 From: Asuka Minato Date: Sat, 21 Sep 2024 18:28:50 +0900 Subject: [PATCH 4/6] try set LD_LIBRARY_PATH --- build.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 439bd3b..d364eb1 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,9 @@ #!/bin/sh set -eux cargo build -find target -name "librs_fsrs_c.so" -not -path "*/deps/*" -type f -print -exec gcc examples/basic.c {} \; +find target \ + -name "librs_fsrs_c.so" \ + -not -path "*/deps/*" \ + -type f -print \ + -exec env LD_LIBRARY_PATH=target/debug/librs_fsrs_c.so gcc examples/basic.c {} \; ./a.out From fd6a2185b9d69af030d4614a894af713ebb0613b Mon Sep 17 00:00:00 2001 From: Asuka Minato Date: Sat, 21 Sep 2024 18:30:14 +0900 Subject: [PATCH 5/6] see whether it works? --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index d364eb1..e117b53 100755 --- a/build.sh +++ b/build.sh @@ -5,5 +5,5 @@ find target \ -name "librs_fsrs_c.so" \ -not -path "*/deps/*" \ -type f -print \ - -exec env LD_LIBRARY_PATH=target/debug/librs_fsrs_c.so gcc examples/basic.c {} \; + -exec env LD_LIBRARY_PATH=/home/runner/work/rs-fsrs-c/target/debug/librs_fsrs_c.so gcc examples/basic.c {} \; ./a.out From 609ffaa8f4244c5ddbb6fee23b66cc1e47f80d6d Mon Sep 17 00:00:00 2001 From: Asuka Minato Date: Sat, 21 Sep 2024 18:45:45 +0900 Subject: [PATCH 6/6] try again --- build.sh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/build.sh b/build.sh index e117b53..8c1a96c 100755 --- a/build.sh +++ b/build.sh @@ -1,9 +1,6 @@ -#!/bin/sh +#!/usr/bin/env bash set -eux cargo build -find target \ - -name "librs_fsrs_c.so" \ - -not -path "*/deps/*" \ - -type f -print \ - -exec env LD_LIBRARY_PATH=/home/runner/work/rs-fsrs-c/target/debug/librs_fsrs_c.so gcc examples/basic.c {} \; -./a.out +BASEDIR="$( cd "$( dirname "$0" )" && pwd )" +gcc -o a.out examples/basic.c -L${BASEDIR}/target/debug/ -lrs_fsrs_c +env LD_LIBRARY_PATH=${BASEDIR}/target/debug/ ./a.out