Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alpine linux: Failed at the purescript@0.13.2 postinstall script #16

Closed
javier-cornejo opened this issue Jul 14, 2019 · 15 comments
Closed

Comments

@javier-cornejo
Copy link

Trying to run
npm i -g purescript

On alpine:3.10.1 in a docker container.
node v10.16.0
npm v6.9.0

716 verbose stack Error: purescript@0.13.2 postinstall: install-purescript --purs-ver=0.13.2
716 verbose stack Exit status 1
716 verbose stack at EventEmitter. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
716 verbose stack at EventEmitter.emit (events.js:198:13)
716 verbose stack at ChildProcess. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
716 verbose stack at ChildProcess.emit (events.js:198:13)
716 verbose stack at maybeClose (internal/child_process.js:982:16)
716 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)

Also attaching a log file:
2019-07-14T03_13_09_728Z-debug.log

@javier-cornejo
Copy link
Author

Screenshot from 2019-07-13 22-35-44

@hdgarrood
Copy link
Collaborator

Thanks for the report. Do you have a minimal Dockerfile which can reproduce this issue?

@javier-cornejo
Copy link
Author

javier-cornejo commented Jul 16, 2019

Sure,
Fedora release 30 (Thirty)
Docker version 18.09.7, build 2d0083d

FROM alpine:3.10.1

RUN apk add nodejs npm && \
    npm install --global purescript

@javier-cornejo
Copy link
Author

This one shows more errors at docker build time

FROM alpine:3.10.1

RUN apk add nodejs npm && \
    npm install --global --ignore-scripts purescript && \
    node /usr/lib/node_modules/purescript/node_modules/purescript-installer/index.js

@marijnz0r
Copy link

I'm affected by this issue as well on:

  • Ubuntu 19.04
  • Node 12.13.0
✔Check if a prebuilt 0.13.4 binary is provided for linux (906ms)
✔ Download the prebuilt PureScript binary (943ms)
✖ Verify the prebuilt binary works correctly
  /home/marijn/.nvm/versions/node/v12.13.0/lib/node_modules/purescript/purs.bin --version
  Error: Command failed: /home/marijn/.nvm/versions/node/v12.13.0/lib/node_modules/purescript/purs.bin --version
/home/marijn/.nvm/versions/node/v12.13.0/lib/node_modules/purescript/purs.bin: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory

    at ChildProcess.exithandler (child_process.js:295:12)
    at ChildProcess.emit (events.js:210:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Socket.<anonymous> (internal/child_process.js:430:11)
    at Socket.emit (events.js:210:5)
    at Pipe.<anonymous> (net.js:658:12)
▬ Save the downloaded binary to the npm cache directory

↓ Fallback: building from source

✖ Check if 'stack' command is available
  stack --allow-different-user --numeric-version
  Error: Command failed with exit code 2 (ENOENT): stack --allow-different-user --numeric-version
spawn stack ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
▬ Download the PureScript 0.13.4 source
▬ Ensure the appropriate GHC is installed
▬ Build a binary from source
▬ Save the built binary to the npm cache directory

@hdgarrood
Copy link
Collaborator

@marijnz0r that looks like a different issue to me, it seems you're missing the libtinfo / ncurses library. See the note in https://github.com/purescript/purescript/blob/master/INSTALL.md#the-curses-library

@marijnz0r
Copy link

@hdgarrood thanks for the quick response, it seems it might have to do something with a correct version of libtinfo, check out this issue: purescript/spago#104
Do you have an idea how to fix this?

@hdgarrood
Copy link
Collaborator

Yes, you need to install the ncurses/libtinfo library, and/or build from source so that GHC can select the appropriate version.

@marijnz0r
Copy link

The weird thing is, I do have them installed:

locate libtinfo.so
/snap/core/7713/lib/x86_64-linux-gnu/libtinfo.so.5
/snap/core/7713/lib/x86_64-linux-gnu/libtinfo.so.5.9
/snap/core/7917/lib/x86_64-linux-gnu/libtinfo.so.5
/snap/core/7917/lib/x86_64-linux-gnu/libtinfo.so.5.9
/snap/core18/1192/lib/x86_64-linux-gnu/libtinfo.so.5
/snap/core18/1192/lib/x86_64-linux-gnu/libtinfo.so.5.9
/snap/core18/1223/lib/x86_64-linux-gnu/libtinfo.so.5
/snap/core18/1223/lib/x86_64-linux-gnu/libtinfo.so.5.9
/usr/lib/x86_64-linux-gnu/libtinfo.so
/usr/lib/x86_64-linux-gnu/libtinfo.so.6
/usr/lib/x86_64-linux-gnu/libtinfo.so.6.1

How do I point the purescript install script to the correct libtinfo.so.5?

@marijnz0r
Copy link

This apparently fixed it for me:

sudo ln -s /snap/core/7917/lib/x86_64-linux-gnu/libtinfo.so.5 /usr/lib/x86_64-linux-gnu/libtinfo.so.5

I hope it helps someone.

@hdgarrood
Copy link
Collaborator

You can use LD_LIBRARY_PATH, or preferably put the library in one of the directories listed in /etc/ld.so.conf. See http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html

@hdgarrood
Copy link
Collaborator

I've dug into this a bit and I think it might be to do with alpine being based on musl rather than glibc or some other difference in how the system is set up. After running those commands, we get an error along the lines of spawn /purs ENOENT, which would suggest that the problem is that the file /purs does not exist. In fact the file does exist, which leads me to believe that we are in a similar situation to this person: https://stackoverflow.com/questions/5234088/execve-file-not-found-when-stracing-the-very-same-file, and the ENOENT really means that the dynamic loader for the binary doesn't exist. Indeed, ldd /purs prints /lib64/ld-linux-x86-64.so.2 as the first line of the output, but no such file that exists in the container. I think you may need to build the compiler from source.

@hdgarrood
Copy link
Collaborator

The issues reported here are covered by #22 and #24, so I'm going to close this. Thanks for the report!

@wclr
Copy link

wclr commented Jan 12, 2021

@hdgarrood
(Form the discussion) it is not clear what to do if one wants to install purs on alpine and encounters the error?

Should this be added to https://github.com/purescript/purescript/blob/master/INSTALL.md ?

@hdgarrood
Copy link
Collaborator

hdgarrood commented Jan 12, 2021

You’ll need to build the compiler yourself from source on alpine, as all of the prebuilt binaries rely on glibc. We do have instructions there for building from source already, but I don’t think we have the bandwidth to maintain instructions for alpine specifically.

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

No branches or pull requests

4 participants