jbclements / portaudio

Racket Bindings for PortAudio
Other
9 stars 7 forks source link

ffi-lib can't find callbacks.so on linux #8

Closed CTHULHU-Jesus closed 4 years ago

CTHULHU-Jesus commented 4 years ago

when I try to include portaudio I get this error:


Welcome to Racket v7.7.
> (require portaudio)
; ffi-lib: couldn't open "callbacks.so" (callbacks.so: cannot open shared
;   object file: No such file or directory) [,bt for context]
> ,bt
; ffi-lib: couldn't open "callbacks.so" (callbacks.so: cannot open shared object file: No such file or directory)
;   context...:
;    /usr/share/racket/collects/ffi/unsafe.rkt:131:0: get-ffi-lib
;    "/home/dagon/.racket/7.7/pkgs/portaudio/portaudio/callback-support.rkt": [running body]
;    temp35_0
;    for-loop
;    run-module-instance!
;    for-loop
;    [repeats 1 more time]
;    run-module-instance!
;    perform-require!
;    for-loop
;    eval-one-top
;    /usr/share/racket/pkgs/xrepl-lib/xrepl/xrepl.rkt:1478:0
;    /usr/share/racket/collects/racket/repl.rkt:11:26
> 

I know that callbacks.so exists, I can see it, I just don't know where the ffi wants it.

tfidfwastaken commented 4 years ago

I have the same issue and the problem is in this definition in callback-support.rkt: https://github.com/jbclements/portaudio/blob/018e7c9f1049aa301a3d03dc8faa48484782d1d5/portaudio/callback-support.rkt#L236-L246

It only seems to be referencing the mac library callbacks.so which the author seems to have split away from this package in a recent commit.

As of now the only way to get this library working on my linux machine is to edit line 238 and 239 to:

(define lib-path
  (collection-file-path "callbacks.so" "portaudio" "lib" "x86_64-linux" "3m"))

For Windows you have to also set the path accordingly.

@jbclements I wouldn't mind sending in a PR for a fix :)

jbclements commented 4 years ago

Ugh, totally broken, mea culpa. There are a number of obvious fixes, I wish I knew which one was best. I hope to fix this tomorow.

cwebber commented 4 years ago

I found that fixing this for myself was as simple as:

diff --git a/portaudio/callback-support.rkt b/portaudio/callback-support.rkt
index 0374889..a96fcaa 100644
--- a/portaudio/callback-support.rkt
+++ b/portaudio/callback-support.rkt
@@ -236,7 +236,7 @@
 (define callbacks-lib
   (let ()
     (define lib-path
-      (collection-file-path "callbacks.dylib" "portaudio" "lib"))
+      (collection-file-path "callbacks.so" "portaudio" "lib"))
     (cond [(file-exists? lib-path)
            (define-values (dir filename must-be-dir?) (split-path lib-path))
            (ffi-lib (build-path dir "callbacks"))]
jbclements commented 4 years ago

Okay, I think I now have a solution that works for all platforms. Sorry to take so long, sigh. I have a really limited ability to test this on windows & linux platforms, alas, so I'd appreciate feedback.

Closing this, but please feel free to re-open it if I'm mistaken

jbclements commented 4 years ago

closed by #6ab8179f05194d0429e

jbclements commented 4 years ago

oops no number sign? 6ab8179f05194d0429e