Closed Earnestly closed 2 years ago
Hi there, just a note, I am the author of hermes, and have continued development of a new package tree based on the lessons learned from hermes that I will be releasing later.
That being said, what is there should still work, though jpm has been through a rewrite in the meantime. I am not totally sure if this is a hermes problem, or a problem with the new jpm, or with the packaging of janet.
That is what I hope to discover as I'm not sure where exactly the problem lies.
Can you build any native executables? One of the simplest is https://github.com/janet-lang/json. Just a wild guess, but you sometimes see an error like that if janet is compiled without rdynamic. You would only see that though if you are really messing with meson or the Makefile, or just bypassing them altogether.
Good call, it does appear to render the same type of failure:
% git clone https://github.com/janet-lang/json
Cloning into 'json'...
remote: Enumerating objects: 65, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 65 (delta 0), reused 2 (delta 0), pack-reused 61
Receiving objects: 100% (65/65), 16.48 KiB | 937.00 KiB/s, done.
Resolving deltas: 100% (33/33), done.
% cd json
% ~/json jpm -l build
/usr/lib/janet/jpm/shutil.janet:68:25: compile warning (normal): file/popen is deprecated
generating meta file build/json.meta.janet...
compiling json.c to build/json.o...
compiling json.c to build/json.static.o...
linking build/json.so...
creating static library build/json.a...
% ~/json jpm -l test
/usr/lib/janet/jpm/shutil.janet:68:25: compile warning (normal): file/popen is deprecated
running test/suite0.janet ...
could not load native build/json.so: build/json.so: undefined symbol: janet_optbuffer
in native [src/core/corelib.c] on line 314
in native-loader [boot.janet] on line 2660, column 40
in require-1 [boot.janet] on line 2683, column 18
in import* [boot.janet] on line 2714, column 15
in _thunk [test/suite0.janet] (tailcall) on line 1, column 1
error: non-zero exit code in test/suite0.janet: 1
in errorf [boot.janet] on line 165, column 3
in dodir [/usr/lib/janet/jpm/declare.janet] on line 277, column 19
in run-tests [/usr/lib/janet/jpm/declare.janet] (tailcall) on line 279, column 3
in <anonymous> [/usr/lib/janet/jpm/rules.janet] on line 18, column 20
in executor [/usr/lib/janet/jpm/rules.janet] on line 25, column 8
in worker [/usr/lib/janet/jpm/dagbuild.janet] on line 65, column 23
in <anonymous> [/usr/lib/janet/jpm/dagbuild.janet] on line 21, column 43
in pmap [/usr/lib/janet/jpm/dagbuild.janet] on line 26, column 7
in pdag [/usr/lib/janet/jpm/dagbuild.janet] (tailcall) on line 71, column 3
in _thunk [/usr/bin/jpm] (tailcall) on line -1, column -1
in cli-main [boot.janet] on line 3644, column 17
You mentioned -rdynamic
but I thought the Makefile
covered this with: LDFLAGS?=-rdynamic
. However I've since checked the compiler output again and fail to see -rdynamic
during linking:
cc -DJANET_BOOTSTRAP -DJANET_BUILD="\"038ca1b9\"" -O0 -g -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -o [...] -lm -lpthread -lrt -ldl
build/janet_boot . JANET_PATH '/usr/lib/janet' > build/c/janet.c
cksum build/c/janet.c
3129288624 2240543 build/c/janet.c
cc -O2 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -c build/c/janet.c -o build/janet.o
cp src/mainclient/shell.c build/c/shell.c
cc -O2 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -c build/c/shell.c -o build/shell.o
cc -rdynamic -O2 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -o build/janet build/janet.o build/shell.o -lm -lpthread -lrt -ldl
cc -rdynamic -O2 -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidden -fPIC -Wl,-soname,libjanet.so.1.18 -shared -o build/libjanet.so build/janet.o build/shell.o -lm -lpthread -lrt -ldl
ar rcs build/libjanet.a build/janet.o build/shell.o
Further it also seems to ignore the environmental flags used by package management:
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection"
CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"
This may need much more work than I was expecting.
I've since switched the build system to meson
and it appears to work; it does use -rdynamic
when linking.
Although my prefered CFLAGS are still not honoured but this can be sorted out later.
I'm not sure if you wish to close this issue as there does appear to be a divergence when using the make build system but otherwise it appears resolved.
My bad, -rdynamic should be part of LDFLAGS, that should fix the issue. Anyway, using meson is also a good solution and that is equally supported.
I'm attempting to package both
janet
andjpm
globally while usingjpm -l
for ultimately buildinghermes
.When following the installation instructions using
jpm -l load-lockfile
it appears to build successfully:% jpm -l load-lockfile
However then using
jpm -l build
I receive the following error:Could you provide any guidance on what I may have done wrong or how to investigate what may be causing this linking failure?
I'm not sure what information to provide but here is some which may be helpful: