Images in scribbles

I’ve got an image in a scribble, and it works in my local setup,but when I try to distributie my package, jt fails,because raco does not find it. What can I do to solve this?

Can you show the snippet that fails?

Yes, sure, thank you for looking into it:

#lang scribble/manual

@title{Qt WebView Backend Architecture}
@author[@author+email["Hans Dijkema" "hans@dijkewijk.nl"]]

@section{Introduction}

It would, of course, be preferable to place everything within a single process,
under a unified structure. This would be elegant. It is not how things are.

@centered{
  @image[#:scale 0.45]{rktwebview-shared-memory-diagram-simple.svg}
}

Qt WebEngine establishes its own order: threads, event loops, internal state.
Once set in motion, it does not easily yield. It persists, and it expects its
environment to adapt accordingly. These conditions are accepted.

The Racket process, however, is of a different nature. It is light, precise,
capable of starting and stopping without residue. It must remain so.

So a boundary is drawn.

On one side, Qt: a large, immovable instrument—something like an organ. Once it
begins to sound, it fills the space, and it is not easily silenced. On the other,
Racket: a violin, agile and expressive, able to begin and end a phrase at will.

They do not become the same instrument. They are allowed to play together.
Communication is arranged accordingly. A shared memory region, containing three
queues: commands, results, and events. A command is issued. It crosses the boundary. It is taken up and executed. A result returns.
Events also arise, independently, and must be handled when they appear.

(...)

Currently, I'm trying this:

@section{Introduction}

It would, of course, be preferable to place everything within a single process,
under a unified structure. This would be elegant. It is not how things are.

@(define-runtime-path img-path ".")
@(define img (path->string (build-path img-path
                                       "rktwebview-shared-memory-diagram-simple.svg"
                                       )))
@(displayln (format "image: '~a'"  img))

@centered{
  @image[#:scale 0.45]{@img}
}

Qt WebEngine establishes its own order: threads, event loops, internal state.

I would expect something like this to work:

#lang scribble/manual
@(require racket/runtime-path)

@(define-runtime-path img "images/example.png")

@title{My Docs}

Here is the image:

@image[img]

Where the file structure is:

my-package/
  info.rkt
  scribblings/
    manual.scrbl
    images/
      logo.png

Yes that worked, but now I seem to be getting a new problem:

raco test: 0 (file "/home/root//user/.local/share/racket/9.1/pkgs/racket-webview/example1/example.rkt")
raco test: 1 (file "/home/root//user/.local/share/racket/9.1/pkgs/racket-webview/info.rkt")
raco test: 1 (file "/home/root//user/.local/share/racket/9.1/pkgs/racket-webview/main.rkt")
main.rkt: racket test: #<<non-empty stderr
Cannot load librktwebview.so.
Make sure you installed Qt6 on your system
NB. the minimum Qt version that is supported is Qt 6.10.
This probably means you will need to install it separately from
the standard distro packages (e.g. libqt6webenginewidgets6 on
debian based systems).

Exception:

#(struct:exn:fail:filesystem ffi-lib: could not load foreign library
  path: /home/root/user/.local/share/racket/9.1/pkgs/racket-webview/private/lib/linux/x86_64/librktwebview.so.6
  system error: /home/root/user/.local/share/racket/9.1/pkgs/racket-webview/private/lib/linux/x86_64/librktwebview.so.6: cannot open shared object file: No such file or directory #<continuation-mark-set>)
  context...:
   /home/root/racket/collects/racket/private/more-scheme.rkt:163:2: select-handler/no-breaks
   body of "/home/root/user/.local/share/racket/9.1/pkgs/racket-webview/private/racket-webview-qt.rkt"
   /home/root/racket/share/pkgs/compiler-lib/compiler/commands/test.rkt:98:2
   body of (submod "/home/root/racket/share/pkgs/compiler-lib/compiler/commands/test.rkt" process)
   body of top-level

Although it works on my Linux (mint) box and Windows system:


(define-runtime-path lib-dir "lib")

(define ffi-library
  (cond
   ([eq? os 'windows] 'rktwebview.dll)
   ([eq? os 'linux] 'librktwebview.so)
   )
  )

(define os-lib-dir (build-path lib-dir (symbol->string os) (symbol->string arch)))

(define (libname lib-symbol)
  (build-path os-lib-dir (symbol->string lib-symbol)))


(define rktwebview-prg (if (eq? os 'windows)
                           "rktwebview_prg.exe"
                           "rktwebview_prg"))

(define webengine-process (if (eq? os 'windows)
                             "QtWebEngineProcess.exe"
                             "QtWebEngineProcess"))


(define webview-lib-file (libname ffi-library))
(define webview-lib
  (with-handlers ([exn:fail?
                   (λ (exp)
                     (cond
                       ([eq? os 'linux]
                        (error (format
                                (string-append "Cannot load ~a.\n"
                                               "Make sure you installed Qt6 on your system\n"
                                               "NB. the minimum Qt version that is supported is Qt 6.10.\n"
                                               "This probably means you will need to install it separately from\n"
                                               "the standard distro packages (e.g. libqt6webenginewidgets6 on\n"
                                               "debian based systems).\n"
                                               "\n"
                                               "Exception:\n\n~a")
                                ffi-library exp)))
                       (else (error
                              (format "Cannot load ~a for os ~a\n\nException:\n\n~a"
                                      ffi-library os exp))))
                     )
                   ])
    (ffi-lib webview-lib-file '("6" #f)
             #:get-lib-dirs (list os-lib-dir)
             ;#:custodian (current-custodian)
             )
    )
  )

(define-ffi-definer define-rktwebview webview-lib)

Maybe the lib directory is not copied?