Hi,

I'm trying to work out how to use 'copy-foreign-libs' [1], but not having
much luck.  I believe the implementation of the collection using '
copy-foreign-libs' is correct because it works in '#lang video', but I've
been unable to use it myself.

I created a collection 'testffi-1' that would make use of the
existing(known working) 'libvid-x86_64-macosx' package [2] used by `#lang
video`.

I installed 'testffi-1' with 'raco pkg install' , but attempts to call it
with a short test program fail with an error that the foreign library
cannot be found.

Thinking that I hadn't 'provided'ed the foreign lib to my test script let
me to create a 'main.rkt' in 'testffi-1', but that also fails to fine the
foreign lib with the same error message, and using the DrRacket 'trace'
functionality seems to blame 'kw.rkt' (/Applications/Racket
v7.2/collects/racket/private/kw.rkt: 1325:47), which seems odd to me
because the error is in my code, not in the standard racket libs.

I used (require setup/dirs
<https://docs.racket-lang.org/raco/dirs.html?q=get-lib-dirs>) to see if the
foreign lib was included, but
get-lib-search-dirs
<https://docs.racket-lang.org/raco/dirs.html#%28def._%28%28lib._setup%2Fdirs..rkt%29._get-lib-search-dirs%29%29>
returns
/Users/spdegabrielle/Library/Racket/7.2/lib /Applications/Racket v7.2/lib
when called from both the test script and the 'testffi-1' collection.

Any suggestions on how I can test or resolve this issue would be
appreciated.

Kind regards,
Stephen

* 'copy-foreign-libs' : *
https://github.com/videolang/native-pkgs/blob/master/libvid-x86_64-macosx/info.rkt

*test program: *
#lang racket
(require ffi/unsafe)
(require testffi-1)
(define libvid-val (ffi-lib (string-append "libvid") "0"))
(displayln libvid-val)


*'main.rkt' in 'testffi-1'*
#lang racket/base
(require ffi/unsafe)
;(ffi-lib? "libvid.0.dylib")

(define libvid-val (ffi-lib (string-append "libvid") "0"))

(displayln libvid-val)


*Error*
Welcome to DrRacket, version 7.2 [3m].
Language: racket, with debugging; memory limit: 2048 MB.
*. . ../../../Applications/Racket
v7.2/collects/racket/private/kw.rkt:1325:47: ffi-lib: couldn't open
"libvid.0.dylib" (dlopen(libvid.0.dylib, 6): image not found)*
>

*tracing the error : *
ffi-lib: couldn't open "libvid.0.dylib" (dlopen(libvid.0.dylib, 6): image
not found)
ffi-lib: couldn't open "libvid.0.dylib" (dlopen(libvid.0.dylib, 6): image
not found)


*package used set deps 'testffi-1' *
#lang info
(define collection "testffi-1")
(define deps '("base"
               ("libvid-x86_64-macosx" #:platform "x86_64-macosx")))
(define build-deps '("scribble-lib" "racket-doc" "rackunit-lib"))
(define scribblings '(("scribblings/testffi.scrbl" ())))
(define pkg-desc "testffi Description Here")
(define version "0.1")
(define pkg-authors '(spdegabrielle))

[1] 'copy-foreign-libs' in '6.3 Controlling raco setup with "info.rkt"
Files'
https://docs.racket-lang.org/raco/setup-info.html?q=copy-foreign-libs#%28idx._%28gentag._21._%28lib._scribblings%2Fraco%2Fraco..scrbl%29%29%29


[2] https://pkgs.racket-lang.org/package/libvid-x86_64-macosx

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to