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

GHC 8.10 compatibility #98

Merged
merged 24 commits into from
Jul 20, 2021
Merged

GHC 8.10 compatibility #98

merged 24 commits into from
Jul 20, 2021

Conversation

nh2
Copy link
Owner

@nh2 nh2 commented Jul 27, 2020

In this PR we can collaborate to add GHC 8.10 compatibility as requested on #90.

For the general approach, see #90 (comment).

TODO

List of upstream PRs made as part of this

@nh2 nh2 added the help wanted Extra attention is needed label Jul 27, 2020
@nh2 nh2 mentioned this pull request Jul 27, 2020
@nh2
Copy link
Owner Author

nh2 commented Jul 27, 2020

CC @avanov @thebrodmann from #90.

@nh2
Copy link
Owner Author

nh2 commented Jul 27, 2020

Next blocker: util-linux fails to build against musl with error:

In file included from misc-utils/kill.c:57:
./include/pidfd-utils.h: In function ‘pidfd_open’:
./include/pidfd-utils.h:20:17: error: ‘SYS_pidfd_open’ undeclared (first use in this function); did you mean ‘pidfd_open’?
   20 |  return syscall(SYS_pidfd_open, pid, flags);
      |                 ^~~~~~~~~~~~~~
      |                 pidfd_open

Build chain:

  builder for '/nix/store/533sv0pi8nnij81pq5f5i21cmrqhbhsz-util-linux-2.35.2.drv' failed with exit code 2
cannot build derivation '/nix/store/g73d5kv0j7jnsapbch8sqnhnh1y8a31a-e2fsprogs-1.45.5.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/qslhcb537mzz7wawvrjjcbfw6w4sh5rs-libarchive-3.4.3.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/c5mf8kk96dngsy04y57m1gcs2yc8div1-cmake-3.17.3.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/wqfdn4miy603bqaj472vkxz7f7g1gpmi-libipt-2.0.1.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/j0z5bxrsyg4gh7w95flypslm5mrnjj4r-gdb-9.2.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/0vik8wc5vzhipk8n6h5jjr028kssya4g-python3.8-Cython-0.29.19.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/b9n0nbiv2npdq6vq351cy696f14hnqbz-python3.8-PyStemmer-2.0.0.1.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/ria7yhakq34g1b16y1l4qvzh20rljr4m-python3.8-snowballstemmer-2.0.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/ncf0v4y2n5ck99spf5hg9sbinziy3nyc-python3.8-sphinx-3.0.3.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/wckn8wjlxr90622pjpnmyw9bq5c1xwlc-ghc-8.10.1.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/gyfk3dsq0sj0rrzpg7h547wk18pgaqz6-hello-1.0.0.2.drv': 1 dependencies couldn't be built

@nh2
Copy link
Owner Author

nh2 commented Jul 27, 2020

util-linux fails to build against musl with error

Suspicion: It might be

- header-level support for new linux features in 5.3 and 5.4

from https://git.musl-libc.org/cgit/musl/tree/WHATSNEW?h=v1.2.0#n2175, thus probably requiring an upgrade of musl in nixpkgs to 1.2.0.

@nh2
Copy link
Owner Author

nh2 commented Jul 28, 2020

probably requiring an upgrade of musl in nixpkgs to 1.2.0

That fixed that.

@nh2
Copy link
Owner Author

nh2 commented Jul 28, 2020

Current errors on -A working:

error: build of '/nix/store/h62shizidrvbsnnbvvbh5d4mm7wjb7j0-dejavu-fonts-full-2.37.drv' on 'ssh://beta.nixbuild.net' failed: builder for '/nix/store/h62shizidrvbsnnbvvbh5d4mm7wjb7j0-dejavu-fonts-full-2.37.drv' failed with exit code 2
builder for '/nix/store/h62shizidrvbsnnbvvbh5d4mm7wjb7j0-dejavu-fonts-full-2.37.drv' failed with exit code 1; last 10 log lines:
  Error relocating scripts/generate.pe: PyFF_Stdin: symbol not found
  Error relocating scripts/generate.pe: FindProgDir: symbol not found
  Error relocating scripts/generate.pe: doversion: symbol not found
  Error relocating scripts/generate.pe: InitSimpleStuff: symbol not found
  Error relocating scripts/generate.pe: CheckIsScript: symbol not found
  Error relocating scripts/generate.pe: getLocaleDir: symbol not found
  Error relocating scripts/generate.pe: custom: symbol not found
  Error relocating scripts/generate.pe: default_encoding: symbol not found
  make: *** [Makefile:99: build/DejaVuMathTeXGyre.ttf] Error 127
  builder for '/nix/store/h62shizidrvbsnnbvvbh5d4mm7wjb7j0-dejavu-fonts-full-2.37.drv' failed with exit code 2
cannot build derivation '/nix/store/rwrckfwj8ghx76zi7zzmwylchvjp9jkn-dejavu-fonts-minimal-2.37.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/ar80zav4hzh6whgw4b46hc94kav571xj-fontconfig-2.13.92.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/4myqr8r19zqilnpmkpqc30ixzwg6y1y5-fonts.conf.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/r5l611im10wgzj34nr811mz4rs2hi6x1-gd-2.3.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/ww3h0laii2b3wz8bbx516hl5ilpgc8ls-libXft-2.3.3.drv': 1 dependencies couldn't be built
error: build of '/nix/store/ilfnzl9ajhawl2di5x2hfi1bdk5190wr-ilmbase-2.4.1.drv' on 'ssh://static-haskell-nix-ci' failed: builder for '/nix/store/ilfnzl9ajhawl2di5x2hfi1bdk5190wr-ilmbase-2.4.1.drv' failed with exit code 2
builder for '/nix/store/ilfnzl9ajhawl2di5x2hfi1bdk5190wr-ilmbase-2.4.1.drv' failed with exit code 1; last 10 log lines:
  make[2]: *** [IexMath/CMakeFiles/IexMath.dir/build.make:96: IexMath/CMakeFiles/IexMath.dir/IexMathFpu.cpp.o] Error 1
  make[2]: *** Waiting for unfinished jobs....
  make[1]: *** [CMakeFiles/Makefile2:1179: IexMath/CMakeFiles/IexMath.dir/all] Error 2
  make[1]: *** Waiting for unfinished jobs....
  [ 52%] Linking CXX executable ../bin/IexTest
  [ 52%] Built target IexTest
  [ 53%] Linking CXX shared library libIlmThread-2_4.so
  [ 53%] Built target IlmThread
  make: *** [Makefile:161: all] Error 2
  builder for '/nix/store/ilfnzl9ajhawl2di5x2hfi1bdk5190wr-ilmbase-2.4.1.drv' failed with exit code 2
cannot build derivation '/nix/store/m07ps4smz0qsjbczljrzmykmq8inq3qz-openexr-2.4.1.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/gd23hig4l9gad8kglkl4n68nivwjiz9g-libdevil-1.7.8.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/gl5dfsyqy8ml0a5cjx3sqx00464vmd28-graphviz-2.42.2.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/8srd46h0apgnzs8b27n35baki9czfapq-wayland-1.18.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/2ansqiwbmjblfhxvhc1dr1mkcfb7031a-libva-minimal-2.8.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/p6h1r1vby1lb15scn2f4j4abyg0s0zgl-wayland-protocols-1.20.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/r6bs9vzm468l795wmhpm99v2xr5g9nra-mesa-20.1.3.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/mkjzcp2gp7gldkpkgljfs88ai5ypcz6p-libGL-1.3.1.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/nbp5gz55ankkyscknc6g5qbfp8ii24x5-cairo-1.16.0.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/04vxbhkrvhil0yqb38bly9lzrlyl5ais-libdevil-1.7.8.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/50z09l82n63yy0hhklhdvlmym861969z-absolute_gir_path.patch.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/1234jfw9zrnmz04r3iighz3pzi6w2nzb-harfbuzz-2.6.7.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/x08kvminz4i6s1nydwpqihwxyxqhh0pw-gobject-introspection-1.64.1.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/nfb72r2ysxg15q8574c2nc4qr5mh4355-pango-1.44.7.drv': 5 dependencies couldn't be built
cannot build derivation '/nix/store/c5f42xpvhbf9cain50zmfy76b0p6hbsy-graphviz-2.42.2.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/a6fkvxqk0za75ibn4jrjr8nfyim5la3j-graphviz-2999.20.0.4.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/bpzqpm2xrlc6mwgxq2dzwdi8yw2cl6h5-darcs-2.14.4.drv': 1 dependencies couldn't be built
error: build of '/nix/store/vzvf053pp01qmsy9w592aszrij5k86lb-trifecta-2.1.drv' on 'ssh://root@256gb-ram' failed: builder for '/nix/store/vzvf053pp01qmsy9w592aszrij5k86lb-trifecta-2.1.drv' failed with exit code 1
builder for '/nix/store/vzvf053pp01qmsy9w592aszrij5k86lb-trifecta-2.1.drv' failed with exit code 1; last 10 log lines:
  Text.Trifecta.Util.It
  Text.Trifecta.Util.Combinators
  Text.Trifecta.Util.Pretty
  Test suite doctests: FAIL
  Test suite logged to: dist/test/trifecta-2.1-doctests.log
  Test suite quickcheck: RUNNING...
  Test suite quickcheck: PASS
  Test suite logged to: dist/test/trifecta-2.1-quickcheck.log
  1 of 2 test suites (1 of 2 test cases) passed.
  builder for '/nix/store/vzvf053pp01qmsy9w592aszrij5k86lb-trifecta-2.1.drv' failed with exit code 1
cannot build derivation '/nix/store/v8hi3gqzy5f7r831dhjv6dixsmj4c6cr-tree-diff-0.1.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/vcgzjpnqrgrjmxbxrlr2ggmanwzwq8gb-haddock-library-1.9.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/4cgprnhvyfqnbfb4amvizs9xz2lh4hrf-pandoc-2.9.2.1.drv': 1 dependencies couldn't be built
error: build of '/nix/store/93dz7dx7vambd52vyzh1rjzkjird3xsx-stack-2.3.1.drv' on 'ssh://static-haskell-nix-ci' failed: builder for '/nix/store/93dz7dx7vambd52vyzh1rjzkjird3xsx-stack-2.3.1.drv' failed with exit code 1
builder for '/nix/store/93dz7dx7vambd52vyzh1rjzkjird3xsx-stack-2.3.1.drv' failed with exit code 1; last 10 log lines:
  [100 of 109] Compiling Stack.Options.Completion ( src/Stack/Options/Completion.hs, dist/build/Stack/Options/Completion.o, dist/build/Stack/Options/Completion.dyn_o )
  [101 of 109] Compiling Stack.Options.ScriptParser ( src/Stack/Options/ScriptParser.hs, dist/build/Stack/Options/ScriptParser.o, dist/build/Stack/Options/ScriptParser.dyn_o )
  [102 of 109] Compiling Stack.Script     ( src/Stack/Script.hs, dist/build/Stack/Script.o, dist/build/Stack/Script.dyn_o )
  [103 of 109] Compiling Stack.Options.HpcReportParser ( src/Stack/Options/HpcReportParser.hs, dist/build/Stack/Options/HpcReportParser.o, dist/build/Stack/Options/HpcReportParser.dyn_o )
  [105 of 109] Compiling Stack.Options.ExecParser ( src/Stack/Options/ExecParser.hs, dist/build/Stack/Options/ExecParser.o, dist/build/Stack/Options/ExecParser.dyn_o )
  [106 of 109] Compiling Stack.Options.BuildParser ( src/Stack/Options/BuildParser.hs, dist/build/Stack/Options/BuildParser.o, dist/build/Stack/Options/BuildParser.dyn_o )
  [107 of 109] Compiling Stack.Options.GhciParser ( src/Stack/Options/GhciParser.hs, dist/build/Stack/Options/GhciParser.o, dist/build/Stack/Options/GhciParser.dyn_o )
  [108 of 109] Compiling Stack.Options.DotParser ( src/Stack/Options/DotParser.hs, dist/build/Stack/Options/DotParser.o, dist/build/Stack/Options/DotParser.dyn_o )
  [109 of 109] Compiling Stack.Ls         ( src/Stack/Ls.hs, dist/build/Stack/Ls.o, dist/build/Stack/Ls.dyn_o )
  builder for '/nix/store/93dz7dx7vambd52vyzh1rjzkjird3xsx-stack-2.3.1.drv' failed with exit code 1
[0 built (4 failed), 33 copied (49.0 MiB), 0.0 MiB DL]
error: build of '/nix/store/4cgprnhvyfqnbfb4amvizs9xz2lh4hrf-pandoc-2.9.2.1.drv', '/nix/store/93dz7dx7vambd52vyzh1rjzkjird3xsx-stack-2.3.1.drv', '/nix/store/bpzqpm2xrlc6mwgxq2dzwdi8yw2cl6h5-darcs-2.14.4.drv' failed

The dejavu-fonts-full error is:

install -d build/
scripts/generate.pe tmp/DejaVuMathTeXGyre.sfd
Error loading shared library libfontforge.so.4: No such file or directory (needed by scripts/generate.pe)
Error loading shared library libfreetype.so.6: No such file or directory (needed by scripts/generate.pe)
Error loading shared library libxml2.so.2: No such file or directory (needed by scripts/generate.pe)
Error loading shared library libglib-2.0.so.0: No such file or directory (needed by scripts/generate.pe)
Error loading shared library libgio-2.0.so.0: No such file or directory (needed by scripts/generate.pe)
Error loading shared library libuninameslist.so.1: No such file or directory (needed by scripts/generate.pe)
Error loading shared library libreadline.so.6: No such file or directory (needed by scripts/generate.pe)
Error loading shared library libpython3.8.so.1.0: No such file or directory (needed by scripts/generate.pe)
Error relocating scripts/generate.pe: FindOrMakeEncoding: symbol not found
Error relocating scripts/generate.pe: PyFF_Stdin: symbol not found
Error relocating scripts/generate.pe: FindProgDir: symbol not found
Error relocating scripts/generate.pe: doversion: symbol not found
Error relocating scripts/generate.pe: InitSimpleStuff: symbol not found
Error relocating scripts/generate.pe: CheckIsScript: symbol not found
Error relocating scripts/generate.pe: getLocaleDir: symbol not found
Error relocating scripts/generate.pe: custom: symbol not found
Error relocating scripts/generate.pe: default_encoding: symbol not found
make: *** [Makefile:99: build/DejaVuMathTeXGyre.ttf] Error 127

@nh2
Copy link
Owner Author

nh2 commented Jul 29, 2020

The dejavu-fonts-full error is:

This is because the fontforge binary doesn't execute at all when linked with this musl. ldd shows the correct paths on that binary, but when started doesn't try to load those. Comparing the version pinned from static-haskell-nix master nixpkgs:

% diff -u <(strace -fy /nix/store/3v0is6v3dh6sg34y136rwny69rynh41v-fontforge-20200314/bin/fontforge 2>&1 | head -n5) <(strace -fy /nix/store/dcl4vl0dhh3b64rcqrfwxczq38na200w-fontforge-20190413/bin/fontforge 2>&1 | head -n5)
--- /proc/self/fd/11  2020-07-29 03:44:42.071564812 +0200
+++ /proc/self/fd/12  2020-07-29 03:44:42.071564812 +0200
@@ -1,5 +1,5 @@
-execve("/nix/store/3v0is6v3dh6sg34y136rwny69rynh41v-fontforge-20200314/bin/fontforge", ["/nix/store/3v0is6v3dh6sg34y136rw"...], 0x7fff670c79d8 /* 81 vars */) = 0
+execve("/nix/store/dcl4vl0dhh3b64rcqrfwxczq38na200w-fontforge-20190413/bin/fontforge", ["/nix/store/dcl4vl0dhh3b64rcqrfwx"...], 0x7fffb423d2c8 /* 81 vars */) = 0
-arch_prctl(ARCH_SET_FS, 0x7efc03efdd68) = 0
+arch_prctl(ARCH_SET_FS, 0x7fc963adcd68) = 0
-set_tid_address(0x7efc03efe33c)         = 24152
+set_tid_address(0x7fc963add33c)         = 24153
-open("/nix/store/adapzmcxx8cs6yd0qxbyjd8m2j815pab-musl-1.2.0/etc/ld-musl-x86_64.path", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
-open("/lib/libfontforge.so.4", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
+open("/nix/store/dcl4vl0dhh3b64rcqrfwxczq38na200w-fontforge-20190413/lib/libfontforgeexe.so.3", O_RDONLY|O_CLOEXEC) = 3</nix/store/dcl4vl0dhh3b64rcqrfwxczq38na200w-fontforge-20190413/lib/libfontforgeexe.so.3.0.0>
+fcntl(3</nix/store/dcl4vl0dhh3b64rcqrfwxczq38na200w-fontforge-20190413/lib/libfontforgeexe.so.3.0.0>, F_SETFD, FD_CLOEXEC) = 0

The new version loads musl-1.2.0/etc/ld-musl-x86_64.path, I suspect this is related to the dynamic loader not working as expected.

ldd comparison between my system one and musl 1.2.0's:

% ldd /nix/store/3v0is6v3dh6sg34y136rwny69rynh41v-fontforge-20200314/bin/fontforge
	linux-vdso.so.1 (0x00007ffee69a0000)
	libfontforge.so.4 => /nix/store/3v0is6v3dh6sg34y136rwny69rynh41v-fontforge-20200314/lib/libfontforge.so.4 (0x00007f89bcc2d000)
	libfreetype.so.6 => /nix/store/dc2j68fmxwx0mdcf8iws5wifqpkwi50z-freetype-2.10.2/lib/libfreetype.so.6 (0x00007f89bd4cf000)
	libxml2.so.2 => /nix/store/m3q4v6y3fmf0af2jq74y5sg762f7727s-libxml2-2.9.10/lib/libxml2.so.2 (0x00007f89bcac7000)
	libglib-2.0.so.0 => /nix/store/m37pc0zrn09dcprmpw6fhr122fli1wn3-glib-2.64.4/lib/libglib-2.0.so.0 (0x00007f89bd3a6000)
	libgio-2.0.so.0 => /nix/store/m37pc0zrn09dcprmpw6fhr122fli1wn3-glib-2.64.4/lib/libgio-2.0.so.0 (0x00007f89bc8fa000)
	libuninameslist.so.1 => /nix/store/7600458g0i247z0m2h7bprb6san46rw1-libuninameslist-20200413/lib/libuninameslist.so.1 (0x00007f89bc5f1000)
	libreadline.so.6 => /nix/store/6m45i0liq8ni0bhpng49pc62sw30mcpd-readline-6.3p08/lib/libreadline.so.6 (0x00007f89bc5a7000)
	libpython3.8.so.1.0 => /nix/store/94ldh5da8mf9j16y8vbjmmn0g6bq826y-python3-3.8.3/lib/libpython3.8.so.1.0 (0x00007f89bc216000)
	libc.so => /nix/store/adapzmcxx8cs6yd0qxbyjd8m2j815pab-musl-1.2.0/lib/libc.so (0x00007f89bc164000)
	libz.so.1 => /nix/store/ksia4xz1gcq41gj33rxqh6hxrjadhlsv-zlib-1.2.11/lib/libz.so.1 (0x00007f89bc144000)
	libwoff2enc.so.1.0.2 => /nix/store/pv8x1lm4k75rlncg909a64vlm3m3p13c-woff2-1.0.2-lib/lib/libwoff2enc.so.1.0.2 (0x00007f89bc130000)
	libbrotlienc.so.1 => /nix/store/0qw8ikbgs06vziws7f58jrs0dbppqn70-brotli-1.0.7-lib/lib/libbrotlienc.so.1 (0x00007f89bc096000)
	libwoff2dec.so.1.0.2 => /nix/store/pv8x1lm4k75rlncg909a64vlm3m3p13c-woff2-1.0.2-lib/lib/libwoff2dec.so.1.0.2 (0x00007f89bd394000)
	libbrotlidec.so.1 => /nix/store/0qw8ikbgs06vziws7f58jrs0dbppqn70-brotli-1.0.7-lib/lib/libbrotlidec.so.1 (0x00007f89bc085000)
	libungif.so.4 => /nix/store/z92gfzqglhq17hpi9jfff8p06rvgfv69-libungif-4.1.4/lib/libungif.so.4 (0x00007f89bc07a000)
	libjpeg.so.62 => /nix/store/p96bc00hx4wg5kgvf7mwqi6ad5hfxn7g-libjpeg-turbo-2.0.4/lib/libjpeg.so.62 (0x00007f89bbfe3000)
	libpng16.so.16 => /nix/store/1ai2dz46djqrsvl1gci267iarjvdh1a6-libpng-apng-1.6.37/lib/libpng16.so.16 (0x00007f89bbfaa000)
	libtiff.so.5 => /nix/store/cj0pb42v313gf130yv1qf9g26d6hx1nz-libtiff-4.1.0/lib/libtiff.so.5 (0x00007f89bbf2b000)
	libstdc++.so.6 => /nix/store/y8yc1cafd4rsvg5fxnk5l1cs6j39992m-gcc-9.3.0-lib/lib/libstdc++.so.6 (0x00007f89bbd28000)
	libgcc_s.so.1 => /nix/store/y8yc1cafd4rsvg5fxnk5l1cs6j39992m-gcc-9.3.0-lib/lib/libgcc_s.so.1 (0x00007f89bbd0d000)
	libbz2.so.1 => /nix/store/q090wbjgl2ysfvns5i3cv9gdfad0jiy0-bzip2-1.0.6.0.1/lib/libbz2.so.1 (0x00007f89bbcfa000)
	libpcre.so.1 => /nix/store/z8ha0pvy6inyfqazv4pi8x6139hcf27n-pcre-8.44/lib/libpcre.so.1 (0x00007f89bbc88000)
	libgobject-2.0.so.0 => /nix/store/m37pc0zrn09dcprmpw6fhr122fli1wn3-glib-2.64.4/lib/libgobject-2.0.so.0 (0x00007f89bbc28000)
	libgmodule-2.0.so.0 => /nix/store/m37pc0zrn09dcprmpw6fhr122fli1wn3-glib-2.64.4/lib/libgmodule-2.0.so.0 (0x00007f89bbc1f000)
	libmount.so.1 => /nix/store/4nj24ld8jr5cgwkss93nn5675sdkr0lm-util-linux-2.35.2/lib/libmount.so.1 (0x00007f89bbbc3000)
	libselinux.so.1 => /nix/store/jn9zk6r2zwmpzc84a0grxr8h8smhgh49-libselinux-2.9/lib/libselinux.so.1 (0x00007f89bbb94000)
	libncursesw.so.6 => /nix/store/051hnf5wbb0if340h2gaqijwgj7px1jp-ncurses-6.2/lib/libncursesw.so.6 (0x00007f89bbb22000)
	libwoff2common.so.1.0.2 => /nix/store/pv8x1lm4k75rlncg909a64vlm3m3p13c-woff2-1.0.2-lib/lib/libwoff2common.so.1.0.2 (0x00007f89bbb1d000)
	libbrotlicommon.so.1 => /nix/store/0qw8ikbgs06vziws7f58jrs0dbppqn70-brotli-1.0.7-lib/lib/libbrotlicommon.so.1 (0x00007f89bbaf8000)
	liblzma.so.5 => /nix/store/y2d15ayvdc241mkyjvp0wr0asi2ihj41-xz-5.2.5/lib/liblzma.so.5 (0x00007f89bbacf000)
	libffi.so.7 => /nix/store/cs57sps9lm9c2034k19ng6m434vbzr6q-libffi-3.3/lib/../lib64/libffi.so.7 (0x00007f89bbac2000)
	libblkid.so.1 => /nix/store/4nj24ld8jr5cgwkss93nn5675sdkr0lm-util-linux-2.35.2/lib/libblkid.so.1 (0x00007f89bba70000)
% /nix/store/adapzmcxx8cs6yd0qxbyjd8m2j815pab-musl-1.2.0/bin/ldd /nix/store/3v0is6v3dh6sg34y136rwny69rynh41v-fontforge-20200314/bin/fontforge
	/nix/store/adapzmcxx8cs6yd0qxbyjd8m2j815pab-musl-1.2.0/lib/ld-musl-x86_64.so.1 (0x7f2c2b8f1000)
Error loading shared library libfontforge.so.4: No such file or directory (needed by /nix/store/3v0is6v3dh6sg34y136rwny69rynh41v-fontforge-20200314/bin/fontforge)
Error loading shared library libfreetype.so.6: No such file or directory (needed by /nix/store/3v0is6v3dh6sg34y136rwny69rynh41v-fontforge-20200314/bin/fontforge)
Error loading shared library libxml2.so.2: No such file or directory (needed by /nix/store/3v0is6v3dh6sg34y136rwny69rynh41v-fontforge-20200314/bin/fontforge)
Error loading shared library libglib-2.0.so.0: No such file or directory (needed by /nix/store/3v0is6v3dh6sg34y136rwny69rynh41v-fontforge-20200314/bin/fontforge)
Error loading shared library libgio-2.0.so.0: No such file or directory (needed by /nix/store/3v0is6v3dh6sg34y136rwny69rynh41v-fontforge-20200314/bin/fontforge)
Error loading shared library libuninameslist.so.1: No such file or directory (needed by /nix/store/3v0is6v3dh6sg34y136rwny69rynh41v-fontforge-20200314/bin/fontforge)
Error loading shared library libreadline.so.6: No such file or directory (needed by /nix/store/3v0is6v3dh6sg34y136rwny69rynh41v-fontforge-20200314/bin/fontforge)
Error loading shared library libpython3.8.so.1.0: No such file or directory (needed by /nix/store/3v0is6v3dh6sg34y136rwny69rynh41v-fontforge-20200314/bin/fontforge)
	libc.so => /nix/store/adapzmcxx8cs6yd0qxbyjd8m2j815pab-musl-1.2.0/lib/ld-musl-x86_64.so.1 (0x7f2c2b8f1000)
Error relocating /nix/store/3v0is6v3dh6sg34y136rwny69rynh41v-fontforge-20200314/bin/fontforge: FindOrMakeEncoding: symbol not found
Error relocating /nix/store/3v0is6v3dh6sg34y136rwny69rynh41v-fontforge-20200314/bin/fontforge: PyFF_Stdin: symbol not found
Error relocating /nix/store/3v0is6v3dh6sg34y136rwny69rynh41v-fontforge-20200314/bin/fontforge: FindProgDir: symbol not found
Error relocating /nix/store/3v0is6v3dh6sg34y136rwny69rynh41v-fontforge-20200314/bin/fontforge: doversion: symbol not found
Error relocating /nix/store/3v0is6v3dh6sg34y136rwny69rynh41v-fontforge-20200314/bin/fontforge: InitSimpleStuff: symbol not found
Error relocating /nix/store/3v0is6v3dh6sg34y136rwny69rynh41v-fontforge-20200314/bin/fontforge: CheckIsScript: symbol not found
Error relocating /nix/store/3v0is6v3dh6sg34y136rwny69rynh41v-fontforge-20200314/bin/fontforge: getLocaleDir: symbol not found
Error relocating /nix/store/3v0is6v3dh6sg34y136rwny69rynh41v-fontforge-20200314/bin/fontforge: custom: symbol not found
Error relocating /nix/store/3v0is6v3dh6sg34y136rwny69rynh41v-fontforge-20200314/bin/fontforge: default_encoding: symbol not found

@nh2
Copy link
Owner Author

nh2 commented Jul 29, 2020

CC @dtzWill @matthewbauer @Ericson2314 on this musl problem ^.

Also, should we in nixpkgs patch out this musl line to further ensure impurities cannot happen?

			if (!sys_path) sys_path = "/lib:/usr/local/lib:/usr/lib";

@nh2
Copy link
Owner Author

nh2 commented Jul 29, 2020

Aha, this seems to be a problem:

There is an unsubstituted ${CMAKE_INSTALL_PREFIX}/lib in the broken fontforge's RPATH; I wonder why my system ldd can handle that at all:

Old:

% patchelf --print-rpath /nix/store/dcl4vl0dhh3b64rcqrfwxczq38na200w-fontforge-20190413/bin/fontforge | tr ':' '\n'
/nix/store/dcl4vl0dhh3b64rcqrfwxczq38na200w-fontforge-20190413/lib
/nix/store/8by85zgjmvkjaf7l8vvj1p5imb85v3v9-gcc-9.2.0-lib/lib/../lib64
/nix/store/4yjg2927dfkwm2cj4fxxrhi2z3hsl4r2-libpng-apng-1.6.37/lib
/nix/store/4szin1ngkqbn9mzqcs1i31dj9znmn03q-freetype-2.10.1/lib
/nix/store/bjghybgz5s2p4lgz063qblin4cd7575l-bzip2-1.0.6.0.1/lib
/nix/store/dw6ylfwq89j8msv6b90ck23xsvbk0cbk-libxml2-2.9.10/lib
/nix/store/rq5f1445pchah07crk3s232rl7a37n9k-woff2-1.0.2-lib/lib
/nix/store/jbf6s0r4l42mmyg7g7vyvppkf35sjkdn-brotli-1.0.7-lib/lib
/nix/store/3kz1gkp3i7wcsvgwigv64zqpcr2y1m7y-zlib-1.2.11/lib
/nix/store/bhdqmpf9lbnw1531grrdsbz7mmgmfb3j-glib-2.62.4/lib
/nix/store/li17272jpifsqi88pp4n9kn0ylqk332g-python3-3.7.6/lib
/nix/store/zci33vy733dgrdns72hw1y01y8zldfg3-readline-6.3p08/lib
/nix/store/6mb1cyj3a0d289srvbphfb3pbrdwyfl1-libungif-4.1.4/lib
/nix/store/7a0mlszgqbp1nr0q4596h6dwj9pw8dh1-libjpeg-turbo-2.0.3/lib
/nix/store/xybcn1idww258qhgi1l7sk17vhm6zqqg-libtiff-4.1.0/lib
/nix/store/38x422ih7aybxkw457xnf5d9mg82a5m0-musl-1.1.24/lib

New:

% patchelf --print-rpath /nix/store/3v0is6v3dh6sg34y136rwny69rynh41v-1 niklas@ares ~/src/haskell/static-haskell-nix-review (git)-[ghc-8.10] % patchelf --print-rpath /nix/store/3v0is6v3dh6sg34y136rwny69rynh41v-fontforge-20200314/bin/fontforge | tr ':' '\n'
${CMAKE_INSTALL_PREFIX}/lib
/nix/store/3v0is6v3dh6sg34y136rwny69rynh41v-fontforge-20200314/lib
/nix/store/6m45i0liq8ni0bhpng49pc62sw30mcpd-readline-6.3p08/lib
/nix/store/7600458g0i247z0m2h7bprb6san46rw1-libuninameslist-20200413/lib
/nix/store/94ldh5da8mf9j16y8vbjmmn0g6bq826y-python3-3.8.3/lib
/nix/store/dc2j68fmxwx0mdcf8iws5wifqpkwi50z-freetype-2.10.2/lib
/nix/store/m37pc0zrn09dcprmpw6fhr122fli1wn3-glib-2.64.4/lib
/nix/store/m3q4v6y3fmf0af2jq74y5sg762f7727s-libxml2-2.9.10/lib
/nix/store/adapzmcxx8cs6yd0qxbyjd8m2j815pab-musl-1.2.0/lib

nh2 added a commit to nh2/nixpkgs that referenced this pull request Jul 29, 2020
@nh2
Copy link
Owner Author

nh2 commented Jul 29, 2020

I found the fix for fontforge: PR at NixOS/nixpkgs#94126

@nh2
Copy link
Owner Author

nh2 commented Jul 29, 2020

Next issue: ilmbase (dependency of many packages) fails with:

/build/source/IlmBase/IexMath/IexMathFpu.cpp: In function ‘void Iex_2_4::FpuControl::restoreControlRegs(const ucontext_t&, bool)’:
/build/source/IlmBase/IexMath/IexMathFpu.cpp:284:38: error: ‘struct _fpstate’ has no member named ‘cw’; did you mean ‘cwd’?
  284 |     setCw ((ucon.uc_mcontext.fpregs->cw & cwRestoreMask) | cwRestoreVal);
      |                                      ^~
      |                                      cwd
/build/source/IlmBase/IexMath/IexMathFpu.cpp:287:20: error: ‘struct Iex_2_4::FpuControl::_fpstate_64’ has no member named ‘magic’
  287 |     setMxcsr (kfp->magic == 0 ? kfp->mxcsr : 0, clearExceptions);
      |                    ^~~~~

nh2 added a commit to nh2/nixpkgs that referenced this pull request Jul 29, 2020
@nh2
Copy link
Owner Author

nh2 commented Jul 30, 2020

Next issue: ilmbase (dependency of many packages) fails with:

Fixing with PR: NixOS/nixpkgs#94205

I also made an upstream PR: AcademySoftwareFoundation/openexr#798

nh2 added a commit that referenced this pull request Jul 30, 2020
* include workaround for NixOS/nixpkgs#85924
* musl 1.2.0 (#98 (comment))
* workaround for fontforge execution failure due to wrong RPATH (NixOS/nixpkgs#94126)
* ilmbase musl compilation error
@nh2
Copy link
Owner Author

nh2 commented Jul 30, 2020

Next error: mesa fails with a warning:

../src/gallium/state_trackers/nine/nine_debug.c: In function ‘_nine_debug_printf’:
../src/gallium/state_trackers/nine/nine_debug.c:77:13: error: assignment to ‘long unsigned int’ from ‘pthread_t’ {aka ‘struct __pthread *’} makes integer from pointer without a cast [-Werror=int-conversion]
   77 |         tid = pthread_self();
      |             ^
cc1: some warnings being treated as errors

nh2 added a commit that referenced this pull request Jul 30, 2020
* include workaround for NixOS/nixpkgs#85924
* musl 1.2.0 (#98 (comment))
* workaround for fontforge execution failure due to wrong RPATH (NixOS/nixpkgs#94126)
* ilmbase musl compilation error (NixOS/nixpkgs#94205)
* mesa: Fix `-Werror=int-conversion` build error on musl

fixup! nixpkgs: Update submodule:
@nh2
Copy link
Owner Author

nh2 commented Jul 30, 2020

Next error: mesa fails with a warning:

Fixing with PR: NixOS/nixpkgs#94207

I also made an upstream PR: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6121

nh2 added a commit that referenced this pull request Jul 30, 2020
* include workaround for NixOS/nixpkgs#85924
* musl 1.2.0 (#98 (comment))
* workaround for fontforge execution failure due to wrong RPATH (NixOS/nixpkgs#94126)
* ilmbase musl compilation error (NixOS/nixpkgs#94205)
* mesa: Fix `-Werror=int-conversion` build error on musl (NixOS/nixpkgs#94207)
@nh2 nh2 mentioned this pull request Aug 12, 2020
10 tasks
@lunaris
Copy link

lunaris commented Oct 5, 2020

Hey Niklas, a couple of questions:

  • At present we're just using the compiler from your package set -- is compiling GHC 8.10 itself blocked on some of the challenges you're facing in this PR or is it the larger Haskell package set?

  • If the former, are there any semi-obvious avenues through which I can help? I'm neither a Musl expert nor a Nix pro but would be happy to give something a go/hammer away at something you know to be an issue.

Cheers as always for all your hard work on this.

nh2 added 2 commits July 10, 2021 14:20
This uses @qrilka's work from nh2/stack2nix#1,
now moved to nh2/stack2nix#2.

Unfortunately, this introduces a backwards incompatibility for stack users:

The `stack2nix-script` nix expression now needs to be passed `inherit compiler`,
to satisfy stack complaining if there's no matching GHC on PATH
(even though we don't use it).

I haven't found a way around that yet.

Example change that users need to make in their `default.nix` for building
stack projects statically:

       stack2nix-script = import "${static-haskell-nix}/static-stack2nix-builder/stack2nix-script.nix" {
         inherit pkgs;
    +    inherit compiler;
         stack-project-dir = toString ./.; # where stack.yaml is
         hackageSnapshot = "2021-07-11T00:00:00Z"; # pins e.g. extra-deps without hashes or revisions
       };
@nh2
Copy link
Owner Author

nh2 commented Jul 12, 2021

Interestingly, the static stack binary built with static-haskell-nix is more than 2x smaller than the official static stack binary built on Alpine:

I don't know why that is yet; both binaries are stripped.

@nh2
Copy link
Owner Author

nh2 commented Jul 12, 2021

I finished making Stack 2 support work (and thus all new Stackage LTSs) with stack2nix.

This needed only minor updates to @qrilka's work on nh2/stack2nix#1.

Some thing may not work yet related to local source dirs described in stack.yaml, or when you use github: or stuff like that. If you hit those, open an issue. In any case, they should be easy to implement in stack2nix by just generating the corresponding fetch* invocation (e.g. fetchGit, fetchFromGitHub, and so on).

@nh2 nh2 force-pushed the ghc-8.10 branch 2 times, most recently from ad72ef7 to 2bf005d Compare July 12, 2021 19:15
The glob substitution was run _before_ the script, so that
the `cd static-stack` was not applied and thus the path was invalid.
@nh2
Copy link
Owner Author

nh2 commented Jul 12, 2021

Buildkite CI is fully green, including stack targets: https://buildkite.com/nh2/static-haskell-nix/builds/858

HerculesCI as well, showing output store paths: https://hercules-ci.com/github/nh2/static-haskell-nix/jobs/195

@nh2 nh2 marked this pull request as ready for review July 12, 2021 20:30
nixpkgs.nix Show resolved Hide resolved
@nh2 nh2 merged commit 217a812 into master Jul 20, 2021
nh2 added a commit that referenced this pull request Jul 20, 2021
* include fixes for GHC segfaulting: (NixOS/nixpkgs#129247, NixOS/nixpkgs#129289)
* musl 1.2.2, including this important fix from musl 1.2.0:
  #98 (comment)
* workaround for fontforge execution failure due to wrong RPATH:
  NixOS/nixpkgs#94126
* ilmbase musl compilation error:
  NixOS/nixpkgs#94205
* mesa: Fix `-Werror=int-conversion` build error on musl:
  NixOS/nixpkgs#94207

survey:

* Update file in which stackage packages are listed.
  See nixpkgs commit

      7f236bd4 - hackage2nix: Split configuration, auto disable hydra builds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants