Hi Pierrick,
On Wed, 8 Jul 2026 16:55:19 -0700, Pierrick Bouvier wrote:
+A minimal end-to-end example wraps a one-function library, ``libhello.so``,
+declared by ``hello.h``:
+
+.. code-block:: c
+
+ void hello(const char *name, int lucky);
+
Please include full files for example:
hello.h, hello.c and main.c calling hello function.
Also, please include compiler commands for libhello.so and main.
You can give a full example assuming it run on a x86_64 host.
Good idea. I will get it done in v8.
I could not get it to work.
Following all the steps, the error message is:
[GRT] failed to load host runtime
qemu: uncaught target signal 6 (Aborted) - core dumped
Aborted
On the error. [GRT] failed to load host runtime is the host side (QEMU)
failing to dlopen the Lorelei host runtime, which means $DEVKIT/lib was
not on the host LD_LIBRARY_PATH, for example if $DEVKIT was not set in
the shell that ran the command. -L only points QEMU at the guest's
loader and libc, so it is unrelated.
I reproduced it: dropping just $DEVKIT/lib from the host LD_LIBRARY_PATH
gives exactly that message and the abort. The real fix is making the
example self-contained so nothing stays implicit, which is what v8 does.
We talked about not overriding sysroot, so please remove -L part.
Also, Why do current dir is passed in LD_LIBRARY_PATH?
In this example it assumes that the host libhello.so is in the current
directory, which must be able to be found in LD_LIBRARY_PATH.
+The guest ``LD_LIBRARY_PATH``, passed with ``-E``, controls what the emulated
+program loads:
+
+* ``$DEVKIT/x86_64/lib`` contains the guest runtime support shipped with the
+ devkit.
+* ``thunks/x86_64/lib/x86_64-LoreGTL`` contains the generated guest
+ ``libhello.so`` thunk, used in place of an ordinary guest library.
+
+The host ``LD_LIBRARY_PATH`` controls what the plugin and host thunk load:
+
+* ``$DEVKIT/lib`` contains the host runtime support shipped with the devkit.
+* ``.`` is the current directory, where the host's own ``libhello.so`` is
+ located.
+
+See the runnable
+`hello <https://github.com/rover2024/lorelei/tree/main/examples/hello>`_
+(minimal) and
+`demo <https://github.com/rover2024/lorelei/tree/main/examples/demo>`_
+(variadic functions and a callback that reenters the guest) examples, and
+`Lorelei <https://github.com/rover2024/lorelei>`_ for prebuilt thunk trees and
+the runtime environment they expect.
+
+.. list-table:: Dynamic Linking Call arguments
+ :widths: 20 80
+ :header-rows: 1
+
+ * - Option
+ - Description
+ * - syscall_num=N
+ - The magic syscall number the guest issues (default 4096). Must be high
+ enough not to clash with a real syscall.
+
Other emulation features
------------------------
Regards,
Pierrick
It looks unexplained today only because the walkthrough never shows
building it. v8 will.
v8 will also include the full hello.h, hello.c and main.c, plus the cc
and clang commands for libhello.so and main, as one runnable x86_64
sequence.