From: Ryan Egesdahl <ryan@deriamis.net>
The current build method will correctly link with `libcbqn`, but only
if `LD_LIBRARY_PATH` is set (which, incidentally, `build.bqn` doesn't
set properly). However, we can just use `rpath` in a cross-platform
way to avoid the need. This benefits end-users by making sure they
don't need to move or copy `libcbqn` to where ever `bqnlsp` is
located.
---
build.bqn | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/build.bqn b/build.bqn
index 2e3919e..52c1db0 100755
--- a/build.bqn
@@ -6,7 +6,7 @@ Fail ← {•Out¨𝕩 ⋄ •Exit 1}
(Fail∘⋈∘"Usage: build.bqn path/to/libcbqn.(so|dylib|dll)")⍟{𝕩<1} ≠•args
libcbqn ← ⊑•args
-env ← "env"‿"-S"‿("RUSTFLAGS=""-L"∾libcbqn∾""" LD_LIBRARY_PATH="""∾libcbqn∾"""")
+env ← "env"‿"-S"‿("RUSTFLAGS=""-L"∾libcbqn∾" -C link-args=-Wl,-rpath,"∾libcbqn∾"""")
(Fail∘"BQN directory not found."‿"Try running `git submodule update --init --recursive` first.")⍟(¬•file.Exists) "BQN/src"
--
2.45.2
Whoops, replied directly to you, not to the mailing list. Seems like I
don't know how to use sr.ht either :D The message follows:
Hi, thank you for the patch!
On Sun, Nov 10, 2024 at 05:36:26PM -0800, ~deriamis wrote:
> From: Ryan Egesdahl <ryan@deriamis.net>
>
> The current build method will correctly link with `libcbqn`, but only
> if `LD_LIBRARY_PATH` is set (which, incidentally, `build.bqn` doesn't
> set properly). However, we can just use `rpath` in a cross-platform
> way to avoid the need. This benefits end-users by making sure they
> don't need to move or copy `libcbqn` to where ever `bqnlsp` is
> located.
Originally I left out setting RPATH here because I thought people may
distribute the binary version of bqnlsp. Thinking about this now this is
a silly assumption as the dynamic executable probably won't work between
installations anyway due to glibc incompatibilities etc.
> ---
> build.bqn | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/build.bqn b/build.bqn
> index 2e3919e..52c1db0 100755
> --- a/build.bqn
> +++ b/build.bqn
> @@ -6,7 +6,7 @@ Fail ← {•Out¨𝕩 ⋄ •Exit 1}
> (Fail∘⋈∘"Usage: build.bqn path/to/libcbqn.(so|dylib|dll)")⍟{𝕩<1} ≠•args
>
> libcbqn ← ⊑•args
> -env ← "env"‿"-S"‿("RUSTFLAGS=""-L"∾libcbqn∾""" LD_LIBRARY_PATH="""∾libcbqn∾"""")
> +env ← "env"‿"-S"‿("RUSTFLAGS=""-L"∾libcbqn∾" -C link-args=-Wl,-rpath,"∾libcbqn∾"""")
Doesn't this have the same issue that setting LD_LIBRARY_PATH had? The
rpath should point to the directory, not to the libcbqn shared object.
>
> (Fail∘"BQN directory not found."‿"Try running `git submodule update --init --recursive` first.")⍟(¬•file.Exists) "BQN/src"`