Open thiagokokada opened 4 years ago
What is the output of ldd for your self-built lumo binary?
According to this page:
https://nixos.wiki/wiki/Packaging/Binaries
Downloading a binary on NixOS and trying to run it will almost never work. This is due to hard-coded paths in the executable.
...this seems to be a design "feature" of NixOS. The page also talks about the preferred solution using patchelf.
What is the output of ldd for your self-built lumo binary?
$ ldd build/lumo linux-vdso.so.1 (0x00007fffba5ac000) libdl.so.2 => /nix/store/pnd2kl27sag76h23wa5kl95a76n3k9i3-glibc-2.27/lib/libdl.so.2 (0x00007f0e6d983000) librt.so.1 => /nix/store/pnd2kl27sag76h23wa5kl95a76n3k9i3-glibc-2.27/lib/librt.so.1 (0x00007f0e6d979000) libstdc++.so.6 => /nix/store/4l35nqpaiwzhfafrpby1xf7kfik7ai7c-gcc-8.3.0-lib/lib/libstdc++.so.6 (0x00007f0e6d7ee000) libm.so.6 => /nix/store/pnd2kl27sag76h23wa5kl95a76n3k9i3-glibc-2.27/lib/libm.so.6 (0x00007f0e6d658000) libgcc_s.so.1 => /nix/store/pnd2kl27sag76h23wa5kl95a76n3k9i3-glibc-2.27/lib/libgcc_s.so.1 (0x00007f0e6d442000) libpthread.so.0 => /nix/store/pnd2kl27sag76h23wa5kl95a76n3k9i3-glibc-2.27/lib/libpthread.so.0 (0x00007f0e6d421000) libc.so.6 => /nix/store/pnd2kl27sag76h23wa5kl95a76n3k9i3-glibc-2.27/lib/libc.so.6 (0x00007f0e6d269000) /nix/store/pnd2kl27sag76h23wa5kl95a76n3k9i3-glibc-2.27/lib/ld-linux-x86-64.so.2 => /nix/store/pnd2kl27sag76h23wa5kl95a76n3k9i3-glibc-2.27/lib64/ld-linux-x86-64.so.2 (0x00007f0e6d98a000)
According to this page:
https://nixos.wiki/wiki/Packaging/Binaries
...this seems to be a design "feature" of NixOS. The page also talks about the preferred solution using patchelf.
Yeah, however truly static binaries (i.e.: Go) does work in NixOS. Something like joker
:
$ ldd joker
not a dynamic executable
I thought the idea of https://github.com/anmonteiro/lumo/issues/488 was to create a truly static binary, however I may be wrong.
Ah, I see. One workaround proposed in #488 is to build a statically linked binary, but it doesn't look like there's been a decision made about making the npm-provided Linux binary fully-statically linked.
If that is the solution chosen for lumo's dependence on glibc in #488, it should also resolve your issue... at the expense of a potentially much larger binary.
Settings expectations here:
1) I don't really maintain this project anymore. I've expressed interest in onboarding people but there also doesn't seem to be much interest from other folks. 2) it's unlikely that I'll ever ship a statically linked binary for Lumo again -- we've done that before and it broke Node.js native addons that are compiled with different libc versions.
If you want a Nix derivation you can probably use https://github.com/NixOS/nixpkgs/pull/59414 which @hlolli was so kind to put together.
Fully static library on linux with gcc only goes so far, I think musl is the best bet in that field so far, there’s a good talk on this from NixConf 2018. ld-linux and libc are in this case as for all binary cases pure by default on nixos, I guess youre already aware of that. As a nixos user, Id use lumo from nixpkgs and be satisfied to know that while you cant run lumo from npm, any consumer not using nixos will be able to run lumo as npm. I havent tried it, but it should be equally possible to patch the rpaths of a nixos binary for other linux environments, in case you intend to use a customized lumo build.
It would be great if @hlolli PR could be merged, since the current version of Lumo in NixOS is quite old (and at least for me, broken, since it doesn't seem to find some dependencies).
Yes, I'll try again to get it merged, the node packages need to be re-generated, takes around 20 mins, and there's a daily change to that file, quite annoying :)
for what it's worth, it's now merged, but I believed it just missed the 20.03 release, but it should be on nixpkgs-unstable channel
inflating: ./target/clojure/test/check/random.clj inflating: ./target/clojure/test/check/random/doubles.cljs inflating: ./target/clojure/test/check/random/longs/bit_count_impl.cljs inflating: ./target/clojure/test/check/random/longs.cljs inflating: ./target/clojure/test/check/random.cljs inflating: ./target/clojure/test/check/rose_tree.cljc creating: ./target/META-INF/maven/org.clojure/test.check/ inflating: ./target/META-INF/maven/org.clojure/test.check/pom.xml inflating: ./target/META-INF/maven/org.clojure/test.check/pom.properties java.io.FileInputStream
Building production bundle... Circular dependency: src/js/cljs.js -> src/js/repl.js -> src/js/cljs.js Circular dependency: src/js/cli.js -> src/js/cljs.js -> src/js/repl.js -> src/js/socketRepl.js -> src/js/cli.js Circular dependency: src/js/repl.js -> src/js/socketRepl.js -> src/js/repl.js Circular dependency: src/js/cljs.js -> src/js/repl.js -> src/js/socketRepl.js -> src/js/cljs.js internal/modules/cjs/loader.js:796 throw err; ^
Error: Cannot find module 'async' Require stack:
Lumo binary (download from either GitHub Releases or
npm i -g lumo-cljs
) does not run in NixOS 19.09.It seems that it is missing
libstdc++.so.6
:Compiling it from source works fine:
/etc/os-release
information.