Closed saikyun closed 3 years ago
Looks like the init-window
function call is somehow not being loaded or linked, and is instead replaced with nil.
It happened to all functions I tried. Any clue where to start checking?
I had accidentally written (use freja-jaylib)
when I made the repro repo. I've now updated it, and I still get the same error.
Another error, with the following source:
(defn main [& args]
(require "jaylib"))
I get:
error: could not load native /usr/local/lib/janet/jaylib.so: /usr/local/lib/janet/jaylib.so: undefined symbol: janet_getkeyword
in native [src/core/corelib.c] on line 314
in native-loader [boot.janet] on line 2622, column 40
in require-1 [boot.janet] (tailcall) on line 2645, column 18
When running a binary built by jpm build
.
sogaiu figured out that you can reproduce by just running dlopen:
// assuming this content is in the file repro.c:
//
// gcc repro.c -ldl
//
// then:
//
// ./a.out put-the-full-path-to-the-so-file-here
#include <stdio.h>
#include <dlfcn.h>
int main(int argc, char *argv[])
{
if (argc > 1) {
void* lib = dlopen(argv[1], RTLD_NOW);
if (!lib) {
printf("oops: %s\n", dlerror());
return -1;
}
}
return 0;
}
Following the instructions leads to:
$ gcc repro.c -ldl && ./a.out /usr/local/lib/janet/jaylib.so
oops: /usr/local/lib/janet/jaylib.so: undefined symbol: janet_getkeyword
Added repro.c to the repro repo.
Sorry for the confusion.
IIUC, this sort of thing:
(defn main [& args]
(require "jaylib"))
not working is not an error (for a declare-executable
situation) and is unrelated to the original issue.
That won't work with the latest release of janet and the older jpm either.
It may be that https://github.com/janet-lang/janet/issues/753 will take care of this issue.
I tried sogaiu's fix, and it works for me. :)
It looks like https://github.com/janet-lang/janet/commit/a78cbd91dad1066ec82c31cb74b6c4bf2ea44d1b addressed https://github.com/janet-lang/janet/issues/753.
Perhaps this issue can be closed?
Yup, works now. :) Thanks for the fix sogaiu and bakpakin. ^^
When running
jpm build && ./build/lul
in this minimal project: https://github.com/saikyun/jaylib-and-new-jpm-testSource (UPDATED to use
jaylib
instead):I get:
It works when doing
janet lul/main.janet
.Am on Ubuntu,
janet 1.17.0-dev-61769c8f linux/x64
.