Skip to content
This repository has been archived by the owner on Jun 4, 2022. It is now read-only.

Lumo 1.10.1 doesn't run in NixOS 19.09 #492

Open
thiagokokada opened this issue Dec 10, 2019 · 9 comments
Open

Lumo 1.10.1 doesn't run in NixOS 19.09 #492

thiagokokada opened this issue Dec 10, 2019 · 9 comments

Comments

@thiagokokada
Copy link

Lumo binary (download from either GitHub Releases or npm i -g lumo-cljs) does not run in NixOS 19.09.

$ ./lumo_linux64
zsh: no such file or directory: ./lumo_linux64

It seems that it is missing libstdc++.so.6:

$ ldd ./lumo_linux64
	linux-vdso.so.1 (0x00007ffe2d4e7000)
	libdl.so.2 => /nix/store/pnd2kl27sag76h23wa5kl95a76n3k9i3-glibc-2.27/lib/libdl.so.2 (0x00007f9b13721000)
	librt.so.1 => /nix/store/pnd2kl27sag76h23wa5kl95a76n3k9i3-glibc-2.27/lib/librt.so.1 (0x00007f9b13717000)
	libstdc++.so.6 => not found
	libm.so.6 => /nix/store/pnd2kl27sag76h23wa5kl95a76n3k9i3-glibc-2.27/lib/libm.so.6 (0x00007f9b13581000)
	libgcc_s.so.1 => /nix/store/pnd2kl27sag76h23wa5kl95a76n3k9i3-glibc-2.27/lib/libgcc_s.so.1 (0x00007f9b1336b000)
	libpthread.so.0 => /nix/store/pnd2kl27sag76h23wa5kl95a76n3k9i3-glibc-2.27/lib/libpthread.so.0 (0x00007f9b1334a000)
	libc.so.6 => /nix/store/pnd2kl27sag76h23wa5kl95a76n3k9i3-glibc-2.27/lib/libc.so.6 (0x00007f9b13192000)
	/lib64/ld-linux-x86-64.so.2 => /nix/store/pnd2kl27sag76h23wa5kl95a76n3k9i3-glibc-2.27/lib64/ld-linux-x86-64.so.2 (0x00007f9b13728000)

Compiling it from source works fine:

$ build/lumo
Lumo 1.10.1
ClojureScript 1.10.520
Node.js v12.2.0
 Docs: (doc function-name-here)
       (find-doc "part-of-name-here")
 Source: (source function-name-here)
 Exit: Control+D or :cljs/quit or exit

cljs.user=> 

/etc/os-release information.

NAME=NixOS
ID=nixos
VERSION="19.09.1548.3a1861fcabc (Loris)"
VERSION_CODENAME=loris
VERSION_ID="19.09.1548.3a1861fcabc"
PRETTY_NAME="NixOS 19.09.1548.3a1861fcabc (Loris)"
LOGO="nix-snowflake"
HOME_URL="https://nixos.org/"
DOCUMENTATION_URL="https://nixos.org/nixos/manual/index.html"
SUPPORT_URL="https://nixos.org/nixos/support.html"
BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues"
@penryu
Copy link
Contributor

penryu commented Dec 10, 2019

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.

@thiagokokada
Copy link
Author

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 #488 was to create a truly static binary, however I may be wrong.

@penryu
Copy link
Contributor

penryu commented Dec 10, 2019

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.

@anmonteiro
Copy link
Owner

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 NixOS/nixpkgs#59414 which @hlolli was so kind to put together.

@hlolli
Copy link
Collaborator

hlolli commented Dec 11, 2019

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.

@thiagokokada
Copy link
Author

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).

@hlolli
Copy link
Collaborator

hlolli commented Dec 13, 2019

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 :)

@hlolli
Copy link
Collaborator

hlolli commented Feb 21, 2020

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

@PlumpMath
Copy link

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
#'user/write-transit-json
#'user/process-caches
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:

  • /build/lumo/scripts/package.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
    at Function.Module._load (internal/modules/cjs/loader.js:686:27)
    at Module.require (internal/modules/cjs/loader.js:848:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object. (/build/lumo/scripts/package.js:1:15)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
    at Module.load (internal/modules/cjs/loader.js:811:32)
    at Function.Module._load (internal/modules/cjs/loader.js:723:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [ '/build/lumo/scripts/package.js' ]
    }
    builder for '/nix/store/bx9s19v7sz3ax5nlpq874j8qfby5nrh8-lumo-1.10.1.drv' failed with exit code 1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants