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

Error loading shared library -lncursesw using latest linux/amd64 9.8.2 tag #10

Closed
paulcadman opened this issue Oct 29, 2024 · 10 comments
Closed
Assignees
Labels
alpine Alpine Linux bug Something isn't working upstream This is an upstream issue

Comments

@paulcadman
Copy link

paulcadman commented Oct 29, 2024

We use ghc-musl container to build the Juvix static linux build.

Description of the issue

On 2024-10-22 the build static linux binary of the juvix nightly build started to fail with the following error when using the quay.io/benz0li/ghc-musl:9.8.2 container.

...
Preprocessing executable 'juvix' for juvix-0.6.6..
Building executable 'juvix' for juvix-0.6.6..
[  1 of 199] Compiling Commands.Extra.Package
[  2 of 199] Compiling CommonOptions

<no location info>: error:
    Error loading shared library -lncursesw: No such file or directory

Link to an example failing build:

https://github.com/anoma/juvix-nightly-builds/actions/runs/11578274684/job/32231691647

I tried installing libncursesw separately (using apk add --update libncursesw) as part of the build, but it didn't fix the issue because it's already installed.

Pinning the container to a previous version fixes the issue

The Juvix binary build works if I pin the build to use a 9.8.2 to a container from before the last container rebuild, for example docker.io/benz0li/ghc-musl@sha256:0c491f49df224947847084159c85f60590c4c0324ecdf0efb366f82ed3b20023

https://github.com/anoma/juvix-nightly-builds/actions/runs/11579013347/job/32234216197

We would like to use the latest tag to make sure we're getting the latest security updates etc. We'll also upgrade to 9.8.3 or 9.10.* at some point.

@benz0li
Copy link
Owner

benz0li commented Oct 29, 2024

@paulcadman The difference is v6.4_p20240420-r1 (current) vs v6.4_p20240420-r0 (previous), i.e. https://gitlab.alpinelinux.org/alpine/aports/-/commit/b79b0bbd436ed65de871919b5f3324ed34b2d372.


The current docker.io/benz0li/ghc-musl@sha256:01429d193dbe97e2fde449b1bae32b2988f5c634654b06013b8bacc98b1e2a17:

68fa2586f449:/# apk list --installed | grep ncurses
libformw-6.4_p20240420-r1 x86_64 {ncurses} (X11) [installed]
libmenuw-6.4_p20240420-r1 x86_64 {ncurses} (X11) [installed]
libncurses++-6.4_p20240420-r1 x86_64 {ncurses} (X11) [installed]
libncursesw-6.4_p20240420-r1 x86_64 {ncurses} (X11) [installed]
libpanelw-6.4_p20240420-r1 x86_64 {ncurses} (X11) [installed]
ncurses-dev-6.4_p20240420-r1 x86_64 {ncurses} (X11) [installed]
ncurses-static-6.4_p20240420-r1 x86_64 {ncurses} (X11) [installed]
ncurses-terminfo-base-6.4_p20240420-r1 x86_64 {ncurses} (X11) [installed]
68fa2586f449:/# apk info -qL ncurses-dev
usr/bin/ncursesw6-config
usr/include/curses.h
usr/include/cursesapp.h
usr/include/cursesf.h
usr/include/cursesm.h
usr/include/cursesp.h
usr/include/cursesw.h
usr/include/cursslk.h
usr/include/eti.h
usr/include/etip.h
usr/include/form.h
usr/include/menu.h
usr/include/ncurses.h
usr/include/ncurses_dll.h
usr/include/panel.h
usr/include/term.h
usr/include/term_entry.h
usr/include/termcap.h
usr/include/unctrl.h
usr/lib/libcurses.so
usr/lib/libcursesw.so
usr/lib/libform.so
usr/lib/libformw.so
usr/lib/libmenu.so
usr/lib/libmenuw.so
usr/lib/libncurses++.so
usr/lib/libncurses++w.so
usr/lib/libncurses.so
usr/lib/libncursesw.so
usr/lib/libpanel.so
usr/lib/libpanelw.so
usr/lib/libtic.so
usr/lib/libtinfo.so
usr/lib/pkgconfig/curses.pc
usr/lib/pkgconfig/form.pc
usr/lib/pkgconfig/formw.pc
usr/lib/pkgconfig/menu.pc
usr/lib/pkgconfig/menuw.pc
usr/lib/pkgconfig/ncurses++.pc
usr/lib/pkgconfig/ncurses++w.pc
usr/lib/pkgconfig/ncurses.pc
usr/lib/pkgconfig/ncursesw.pc
usr/lib/pkgconfig/panel.pc
usr/lib/pkgconfig/panelw.pc
usr/lib/pkgconfig/tic.pc
usr/lib/pkgconfig/tinfo.pc

The previous docker.io/benz0li/ghc-musl@sha256:0c491f49df224947847084159c85f60590c4c0324ecdf0efb366f82ed3b20023:

702134ec2904:/# apk list --installed | grep ncurses
libformw-6.4_p20240420-r0 x86_64 {ncurses} (X11) [installed]
libmenuw-6.4_p20240420-r0 x86_64 {ncurses} (X11) [installed]
libncurses++-6.4_p20240420-r0 x86_64 {ncurses} (X11) [installed]
libncursesw-6.4_p20240420-r0 x86_64 {ncurses} (X11) [installed]
libpanelw-6.4_p20240420-r0 x86_64 {ncurses} (X11) [installed]
ncurses-dev-6.4_p20240420-r0 x86_64 {ncurses} (X11) [installed]
ncurses-static-6.4_p20240420-r0 x86_64 {ncurses} (X11) [installed]
ncurses-terminfo-base-6.4_p20240420-r0 x86_64 {ncurses} (X11) [installed]
702134ec2904:/# apk info -qL ncurses-dev
usr/bin/ncursesw6-config
usr/include/curses.h
usr/include/cursesapp.h
usr/include/cursesf.h
usr/include/cursesm.h
usr/include/cursesp.h
usr/include/cursesw.h
usr/include/cursslk.h
usr/include/eti.h
usr/include/etip.h
usr/include/form.h
usr/include/menu.h
usr/include/ncurses.h
usr/include/ncurses_dll.h
usr/include/panel.h
usr/include/term.h
usr/include/term_entry.h
usr/include/termcap.h
usr/include/unctrl.h
usr/lib/libcurses.so
usr/lib/libcursesw.so
usr/lib/libform.so
usr/lib/libformw.so
usr/lib/libmenu.so
usr/lib/libmenuw.so
usr/lib/libncurses++.so
usr/lib/libncurses++w.so
usr/lib/libncurses.so
usr/lib/libncursesw.so
usr/lib/libpanel.so
usr/lib/libpanelw.so
usr/lib/pkgconfig/form.pc
usr/lib/pkgconfig/formw.pc
usr/lib/pkgconfig/menu.pc
usr/lib/pkgconfig/menuw.pc
usr/lib/pkgconfig/ncurses++.pc
usr/lib/pkgconfig/ncurses++w.pc
usr/lib/pkgconfig/ncurses.pc
usr/lib/pkgconfig/ncursesw.pc
usr/lib/pkgconfig/panel.pc
usr/lib/pkgconfig/panelw.pc

@benz0li
Copy link
Owner

benz0li commented Oct 29, 2024

@benz0li benz0li self-assigned this Oct 29, 2024
@benz0li benz0li added bug Something isn't working upstream This is an upstream issue alpine Alpine Linux labels Oct 29, 2024
@paulcadman
Copy link
Author

paulcadman commented Oct 29, 2024

Cross references:

Thanks for the quick reply and investigation.

Do you understand in more detail why this commit caused the issue? Understanding this will help me to raise the issue in aports. It seems like both file lists contain libncursesw.so and corresponding pkginfo files so I think I'm missing the point.

@benz0li
Copy link
Owner

benz0li commented Oct 29, 2024

Do you understand in more detail why this commit caused the issue?

Unfortunately, I do not.

But you could revert the symlinks added by the revision and try if it works then.

@paulcadman
Copy link
Author

Do you understand in more detail why this commit caused the issue?

Unfortunately, I do not.

But you could revert the symlinks added by the revision and try if it works then.

Thanks again.

@benz0li
Copy link
Owner

benz0li commented Oct 30, 2024

This is definitively an issue with ncurses-dev v6.4_p20240420-r1.

Because the following works:

On a machine with docker installed

docker run --rm -ti glcr.b-data.ch/ghc/ghc-musl:9.8.2 bash

Inside the container

Revert ncurses-dev to v6.4_p20231125-r0 from Alpine Linux v3.19:

apk del ncurses-dev pcre2-dev
echo 'http://dl-cdn.alpinelinux.org/alpine/v3.19/main' >> /etc/apk/repositories
apk add ncurses-dev==6.4_p20231125-r0 pcre2-dev

Install required packages:

apk add cargo clang llvm

Install Juvix:

cd /tmp
mkdir anoma
cd anoma
git clone https://github.com/anoma/juvix.git
cd juvix
make runtime LIBTOOL=llvm-ar
stack install --system-ghc --no-install-ghc --ghc-options='-split-sections' --flag juvix:static

Result:

juvix --version
file $(which juvix)
Juvix version 0.6.6-23837ed
Branch: main
Commit: 23837ed745173f99bb0b7461081f5a9392ac2fcc
Date: Tue Oct 29 19:58:00 2024 +0000
/root/.local/bin/juvix: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, BuildID[sha1]=5e0c780ebb965673fcad81c658f465b60e3f366f, stripped

@paulcadman Please open an issue over at Alpine Linux aports and point to

for more information.

Ping @ncopa (ncurses package maintainer over at Alpine Linux aports)

@benz0li benz0li pinned this issue Oct 30, 2024
@paulcadman
Copy link
Author

aports issue raised: https://gitlab.alpinelinux.org/alpine/aports/-/issues/16577

@benz0li
Copy link
Owner

benz0li commented Nov 3, 2024

Workaround: ln -sf libncursesw.so /usr/lib/libncurses.so

@benz0li
Copy link
Owner

benz0li commented Nov 13, 2024

Image quay.io/benz0li/ghc-musl:9.8.2 was rebuilt today including ncurses-dev v6.4_p20240420-r2.

The workaround is not required anymore.

Cross reference:

@benz0li benz0li closed this as completed Nov 13, 2024
@benz0li benz0li unpinned this issue Nov 13, 2024
@paulcadman
Copy link
Author

This is a great result! Thank you so much @benz0li

paulcadman added a commit to anoma/juvix-nightly-builds that referenced this issue Nov 13, 2024
The issue with ncurses has been fixed upstream and the GHC container has
been rebuilt.

benz0li/ghc-musl#10
paulcadman added a commit to anoma/juvix that referenced this issue Nov 13, 2024
The issue with alpine ncurses packaging has been fixed upstream the
ghc-musl containers have been rebuilt. Therefore we can resume using the
tagged releases of the ghc-musl container.

benz0li/ghc-musl#10

Thanks @benz0li for help with diagnosing and fixing this issue.

Co-authored-by: Olivier Benz <[email protected]>
janmasrovira pushed a commit to anoma/juvix that referenced this issue Nov 13, 2024
The issue with alpine ncurses packaging has been fixed upstream and the
ghc-musl containers have been rebuilt. Therefore we can resume using the
tagged releases of the ghc-musl container.

benz0li/ghc-musl#10

Thanks @benz0li for help with diagnosing and fixing this issue.

Co-authored-by: Olivier Benz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alpine Alpine Linux bug Something isn't working upstream This is an upstream issue
Projects
None yet
Development

No branches or pull requests

2 participants