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

Enable SDL #108

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Enable SDL #108

wants to merge 1 commit into from

Conversation

int-index
Copy link

No description provided.

@int-index
Copy link
Author

The PR mentioned in #107 (comment) seems to have landed in nixpkgs-unstable.

@int-index
Copy link
Author

... No CI? Okay, trying this locally with the patch:

NIX_PATH=nixpkgs=nixpkgs nix-build --no-link survey/default.nix -A haskellPackages.sdl2

@int-index
Copy link
Author

Build failed with:

running tests
patching script interpreter paths in ../programs/zstdgrep
../programs/zstdgrep: interpreter directive changed from "#!/bin/sh" to "/nix/store/5pp3zddx9n8i3gbjsai1kyjfss9dc43w-bash-4.4-p23/bin/sh"
Test project /build/source/build_
    Start 4: playTests
/nix/store/vf20zcyqr3qzcjhdidzk377qankcqsqa-binutils-2.35.1/bin/ld: libpython3.9.so.1.0.lto.o: warning: relocation against `PyDictValues_Type' in read-only section `.text'
/nix/store/vf20zcyqr3qzcjhdidzk377qankcqsqa-binutils-2.35.1/bin/ld: libpython3.9.so.1.0.lto.o: relocation R_X86_64_PC32 against symbol `PyBool_Type' can not be used when making a shared object; recompile with -fPIC
/nix/store/vf20zcyqr3qzcjhdidzk377qankcqsqa-binutils-2.35.1/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
ln: failed to access 'libpython3.9.so.1.0': No such file or directory
make: *** [Makefile:659: libpython3.9.so] Error 1
builder for '/nix/store/dj1py0bcxmqa7x35nvg4nxwy3g5b3b5z-python3-3.9.5.drv' failed with exit code 2
cannot build derivation '/nix/store/0i4q97h1c0hgj5cz0zkhpz2h788bnp77-dconf-0.40.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/a48dwz3c9bk99rjxf94y9l8vwxkp8nxd-ghc-8.10.4.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/nr52a34i3yxkf7kjq6hv7dllljp9kjd1-glib-2.68.3.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/qvfqq2apjygyrsrhhifqz2wjdxp32gqb-itstool-2.0.6.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/rsf3br8xzrrgg5zz3na1258bcc60k6nc-libapparmor-3.0.1.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/f31281gx4zhhqhbyk4ix1h30mpddr240-libglvnd-1.3.3.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/hfy4ixqmvs7xkk62r4q5hyh7zm7dpl08-libsndfile-1.0.30.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/3idly82hkw79d208nxfgdps7zfailrrf-libxcb-1.14.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/zah05iilfmdnkipqlnfxgsf9xfmhxwhk-libxkbcommon-1.3.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/bdrf0wgmfyi7mfhvj1c5h4shjkw6yknq-libxml2-2.9.12.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/3jh0lsb339f3fjqjg84ixlxk2mffjy4g-libxslt-1.1.34.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/la00dm46q7nf901h89hm978ylan5vg36-wayland-1.19.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/ixmghclkjy63hx2g1acgn8k94gh4xbw6-wayland-protocols-1.21.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/ql7mrix3vj0v9wmdigla2msak6ianfnd-xorgproto-2021.4.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/wskink3cvb71790dvdb988rg8dr0nrqj-sdl2-2.5.3.0.drv': 1 dependencies couldn't be built
error: build of '/nix/store/wskink3cvb71790dvdb988rg8dr0nrqj-sdl2-2.5.3.0.drv' failed

Not sure what to do next.

@int-index
Copy link
Author

The problem seems to be the new enableLTO option in python/cython/default.nix. Setting it to false allowed me to make progress.

@int-index
Copy link
Author

Now I'm getting this error building GHC:

"cp" libraries/base/./GHC/Stack/CCS.hs-boot libraries/base/dist-install/build/GHC/Stack/CCS.hs-boot
cp: cannot create regular file 'libraries/base/dist-install/build/GHC/Stack/CCS.hs-boot': No such file or directory
libraries/integer-gmp/ghc.mk:4: libraries/integer-gmp/dist-install/build/.depend-v-p-dyn.haskell: No such file or directory
make[1]: *** [libraries/base/ghc.mk:4: libraries/base/dist-install/build/GHC/Stack/CCS.hs-boot] Error 1
make: *** [Makefile:128: all] Error 2
builder for '/nix/store/x3wwsdwrxhidkamin2jf67rd0ixgvn3c-ghc-8.10.4.drv' failed with exit code 2
cannot build derivation '/nix/store/v6cqgcdfwdhsh2rpnf19nxaaslwyb7p9-sdl2-2.5.3.0.drv': 1 dependencies couldn't be built
error: build of '/nix/store/v6cqgcdfwdhsh2rpnf19nxaaslwyb7p9-sdl2-2.5.3.0.drv' failed

@int-index
Copy link
Author

And also this one building libdevil:

libtool: link: g++ -shared -nostdlib /nix/store/4c13cwcklgkmkyi296a9mfqr1rb6sv6m-musl-1.2.2/lib/crti.o /nix/store/i7a5x595a3b9p8ln16agnnsrf894gdbm-gcc-10.3.0/lib/gcc/x86_64-unknown-linux-musl/10.3.0/crtbeginS.o  .libs/libIL_la-il_alloc.o .libs/libIL_la-il_doom.o .libs/libIL_la-il_stack.o .libs/libIL_la-il_pcx.o .libs/libIL_la-il_rle.o .libs/libIL_la-il_bits.o .libs/libIL_la-il_endian.o .libs/libIL_la-il_exr.o .libs/libIL_la-il_jpeg.o .libs/libIL_la-il_pic.o .libs/libIL_la-il_sgi.o .libs/libIL_la-il_bmp.o .libs/libIL_la-il_error.o .libs/libIL_la-il_lif.o .libs/libIL_la-il_png.o .libs/libIL_la-il_states.o .libs/libIL_la-il_convbuff.o .libs/libIL_la-il_files.o .libs/libIL_la-il_main.o .libs/libIL_la-il_pnm.o .libs/libIL_la-il_targa.o .libs/libIL_la-il_wdp.o .libs/libIL_la-il_convert.o .libs/libIL_la-il_gif.o .libs/libIL_la-il_manip.o .libs/libIL_la-il_profiles.o .libs/libIL_la-il_tiff.o .libs/libIL_la-il_cut.o .libs/libIL_la-il_header.o .libs/libIL_la-il_mdl.o .libs/libIL_la-il_quantizer.o .libs/libIL_la-il_utility.o .libs/libIL_la-il_dcx.o .libs/libIL_la-il_icon.o .libs/libIL_la-il_mng.o .libs/libIL_la-il_raw.o .libs/libIL_la-il_wal.o .libs/libIL_la-il_dds.o .libs/libIL_la-il_internal.o .libs/libIL_la-il_pal.o .libs/libIL_la-il_rawdata.o .libs/libIL_la-il_devil.o .libs/libIL_la-il_io.o .libs/libIL_la-il_pcd.o .libs/libIL_la-il_register.o .libs/libIL_la-il_psd.o .libs/libIL_la-il_fastconv.o .libs/libIL_la-il_neuquant.o .libs/libIL_la-il_dds-save.o .libs/libIL_la-il_psp.o .libs/libIL_la-il_pix.o .libs/libIL_la-il_pxr.o .libs/libIL_la-il_vtf.o .libs/libIL_la-il_xpm.o .libs/libIL_la-il_hdr.o .libs/libIL_la-il_icns.o .libs/libIL_la-il_jp2.o .libs/libIL_la-altivec_common.o .libs/libIL_la-altivec_typeconversion.o .libs/libIL_la-il_sun.o .libs/libIL_la-il_nvidia.o .libs/libIL_la-il_wbmp.o .libs/libIL_la-il_squish.o .libs/libIL_la-il_iff.o .libs/libIL_la-il_ilbm.o .libs/libIL_la-il_size.o .libs/libIL_la-il_tpl.o .libs/libIL_la-il_fits.o .libs/libIL_la-il_iwi.o .libs/libIL_la-il_blp.o .libs/libIL_la-il_ftx.o .libs/libIL_la-il_dicom.o .libs/libIL_la-il_rot.o .libs/libIL_la-il_texture.o .libs/libIL_la-il_dpx.o .libs/libIL_la-il_utx.o .libs/libIL_la-il_mp3.o   -Wl,-rpath -Wl,/nix/store/rslf9ramqpm0cigzshx9sb9m81awjkxg-libtiff-4.3.0/lib -Wl,-rpath -Wl,/nix/store/b493yxrr0glvv3988mkagqlq5k8rg5g1-xz-5.2.5/lib -Wl,-rpath -Wl,/nix/store/31xrqmhrqx1mki5dl695mbwln1nvzxbc-libpng-apng-1.6.37/lib -Wl,-rpath -Wl,/nix/store/wxrvirazjpjg28n7b4ic4xanma2g6j8i-libmng-2.0.3/lib -Wl,-rpath -Wl,/nix/store/4dp91920k88hf9xiwvk560imljzmhkx7-lcms-1.19/lib -Wl,-rpath -Wl,/nix/store/ffqns4hqmfarz4v0786bkr527ycba5l3-gcc-10.3.0-lib/lib/../lib64 -Wl,-rpath -Wl,/nix/store/rslf9ramqpm0cigzshx9sb9m81awjkxg-libtiff-4.3.0/lib -Wl,-rpath -Wl,/nix/store/b493yxrr0glvv3988mkagqlq5k8rg5g1-xz-5.2.5/lib -Wl,-rpath -Wl,/nix/store/31xrqmhrqx1mki5dl695mbwln1nvzxbc-libpng-apng-1.6.37/lib -Wl,-rpath -Wl,/nix/store/wxrvirazjpjg28n7b4ic4xanma2g6j8i-libmng-2.0.3/lib -Wl,-rpath -Wl,/nix/store/4dp91920k88hf9xiwvk560imljzmhkx7-lcms-1.19/lib -Wl,-rpath -Wl,/nix/store/ffqns4hqmfarz4v0786bkr527ycba5l3-gcc-10.3.0-lib/lib/../lib64 /nix/store/rslf9ramqpm0cigzshx9sb9m81awjkxg-libtiff-4.3.0/lib/libtiff.so /nix/store/b493yxrr0glvv3988mkagqlq5k8rg5g1-xz-5.2.5/lib/liblzma.so -ldeflate /nix/store/31xrqmhrqx1mki5dl695mbwln1nvzxbc-libpng-apng-1.6.37/lib/libpng16.so /nix/store/wxrvirazjpjg28n7b4ic4xanma2g6j8i-libmng-2.0.3/lib/libmng.so /nix/store/4dp91920k88hf9xiwvk560imljzmhkx7-lcms-1.19/lib/liblcms.so -ljpeg -L/nix/store/y3yaq4iz18cwdy00182raqrqqkij0cl1-openexr-2.5.7/lib -lIlmImf-2_5 -lImath-2_5 -lHalf-2_5 -lIex-2_5 -lIexMath-2_5 -lIlmThread-2_5 -lz -L/nix/store/5c4bda86vh2f3ylcs0mhxfgfnnp2yv0y-libjpeg-turbo-2.1.0/lib -L/nix/store/1dlhc7w4dlacgmkjbcx9454givv4kdqj-zlib-1.2.11/lib -L/nix/store/31xrqmhrqx1mki5dl695mbwln1nvzxbc-libpng-apng-1.6.37/lib -L/nix/store/b493yxrr0glvv3988mkagqlq5k8rg5g1-xz-5.2.5/lib -L/nix/store/rslf9ramqpm0cigzshx9sb9m81awjkxg-libtiff-4.3.0/lib -L/nix/store/2265hgdd0p74kpksylmi36nvi5giidpq-lcms2-2.12/lib -L/nix/store/wxrvirazjpjg28n7b4ic4xanma2g6j8i-libmng-2.0.3/lib -L/nix/store/4dp91920k88hf9xiwvk560imljzmhkx7-lcms-1.19/lib -L/nix/store/4m1k3nygch371wakfvw3syfybmwjgggs-ilmbase-2.5.7/lib -L/nix/store/4c13cwcklgkmkyi296a9mfqr1rb6sv6m-musl-1.2.2/lib -L/nix/store/ffqns4hqmfarz4v0786bkr527ycba5l3-gcc-10.3.0-lib/lib -L/nix/store/4qq14211l3470xlhcjl3r0lcx2f53p88-gcc-wrapper-10.3.0/bin -L/nix/store/i7a5x595a3b9p8ln16agnnsrf894gdbm-gcc-10.3.0/lib/gcc/x86_64-unknown-linux-musl/10.3.0 -L/nix/store/i7a5x595a3b9p8ln16agnnsrf894gdbm-gcc-10.3.0/lib/gcc/x86_64-unknown-linux-musl/10.3.0/../../../../lib64 -L/nix/store/i7a5x595a3b9p8ln16agnnsrf894gdbm-gcc-10.3.0/lib/gcc/x86_64-unknown-linux-musl/10.3.0/../../.. /nix/store/ffqns4hqmfarz4v0786bkr527ycba5l3-gcc-10.3.0-lib/lib/../lib64/libstdc++.so -lm -lc -lgcc_s /nix/store/i7a5x595a3b9p8ln16agnnsrf894gdbm-gcc-10.3.0/lib/gcc/x86_64-unknown-linux-musl/10.3.0/crtendS.o /nix/store/4c13cwcklgkmkyi296a9mfqr1rb6sv6m-musl-1.2.2/lib/crtn.o  -msse -msse2 -msse3   -pthread -Wl,-soname -Wl,libIL.so.1 -o .libs/libIL.so.1.1.0
/nix/store/vf20zcyqr3qzcjhdidzk377qankcqsqa-binutils-2.35.1/bin/ld: cannot find -ldeflate
  CC       muxinternal.lo
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:501: libIL.la] Error 1
make[1]: Leaving directory '/build/devil-1.7.8/lib'
make: *** [Makefile:322: all-recursive] Error 1
builder for '/nix/store/n24v74x7736yaycg9yk2cccqva0fdwig-libdevil-1.7.8.drv' failed with exit code 2
cannot build derivation '/nix/store/hq26jq44scw0ci7k9vdiqz17njvxw0c4-graphviz-2.47.2.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/rwgkf27c28j9rv7krp3cyhy0j060k9f8-wayland-1.19.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/0lr6gz04igsvac3nan1gnlyslvclpkk6-SDL2-2.0.14.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/v6cqgcdfwdhsh2rpnf19nxaaslwyb7p9-sdl2-2.5.3.0.drv': 1 dependencies couldn't be built
error: build of '/nix/store/v6cqgcdfwdhsh2rpnf19nxaaslwyb7p9-sdl2-2.5.3.0.drv' failed

@int-index
Copy link
Author

@nh2 Any suggestion what I could try next?

@int-index
Copy link
Author

The problem with GHC is gone after updating to newer nixpkgs. The problem with libdevil is solved by adding libdeflate to buildInputs.

@int-index
Copy link
Author

OK, I have gotten it to work with nixpkgs 95f1154f993bc788bad7df1feed1b98c7e7381cb patched as follows:

diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix
index f52255f4748..a5fecb6cd05 100644
--- a/pkgs/development/interpreters/python/cpython/default.nix
+++ b/pkgs/development/interpreters/python/cpython/default.nix
@@ -45,7 +45,7 @@
 # enableLTO is a subset of the enableOptimizations flag that doesn't harm reproducibility.
 # enabling LTO on 32bit arch causes downstream packages to fail when linking
 # enabling LTO on *-darwin causes python3 to fail when linking.
-, enableLTO ? stdenv.is64bit && stdenv.isLinux
+, enableLTO ? false # stdenv.is64bit && stdenv.isLinux
 , reproducibleBuild ? true
 , pythonAttr ? "python${sourceVersion.major}${sourceVersion.minor}"
 }:
diff --git a/pkgs/development/libraries/libdevil/default.nix b/pkgs/development/libraries/libdevil/default.nix
index fa48c773dfc..04a6636dc9d 100644
--- a/pkgs/development/libraries/libdevil/default.nix
+++ b/pkgs/development/libraries/libdevil/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchurl, libjpeg, libpng, libmng, lcms1, libtiff, openexr, libGL
+{ lib, stdenv, fetchurl, libdeflate, libjpeg, libpng, libmng, lcms1, libtiff, openexr, libGL
 , libX11, pkg-config, OpenGL
 }:
 
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "dev" ];
 
-  buildInputs = [ libjpeg libpng libmng lcms1 libtiff openexr libGL libX11 ]
+  buildInputs = [ libdeflate libjpeg libpng libmng lcms1 libtiff openexr libGL libX11 ]
     ++ lib.optionals stdenv.isDarwin [ OpenGL ];
   nativeBuildInputs = [ pkg-config ];

@int-index
Copy link
Author

int-index commented Jul 31, 2021

Upstream issue about Python: NixOS/nixpkgs#131557, patch: NixOS/nixpkgs#131951

Upstream issue about libdevil: NixOS/nixpkgs#132218, patch: NixOS/nixpkgs#132218

@int-index
Copy link
Author

int-index commented Jul 31, 2021

Turns out, it’s something in static-haskell-nix specifically that causes libdevil to fail. The build failure could not be reproduced with upstream pkgsMusl, see NixOS/nixpkgs#132218 (comment)

So my fix (adding libdeflate to buildInputs) that I tried to submit upstream isn’t right.

@nh2
Copy link
Owner

nh2 commented Aug 12, 2021

... No CI?

There is, but because the builds can take tens of hours (timing out the usual VM-based CI systems), it's using Buildkite and HerculesCI with a community-sponsored dedicated bulider machine, which aren't safe for building untrusted code, thus they don't build all PRs automatically.

I haven't figured out yet how to tell Buildkite via its UI or a Github comment to build contributer PRs after looking at them, so I build them manually so far.

Some tips regarding this would be appreciated!

@nh2
Copy link
Owner

nh2 commented Aug 12, 2021

If on top of current master, I cherry-pick into the nixpkgs submodule the commit NixOS/nixpkgs@6079362 to fix alsa-lib compiling with musl, then I get all the way to building the LambdaHack package (which depends on SDL2), with failure:

Linking dist/build/LambdaHack/LambdaHack ...
/nix/store/8i49006sm0m9d0kri4i4hg7yndn1646b-binutils-2.35.1/bin/ld: cannot find -lSDL2_ttf

That's because SDL2_ttf doesn't have .a files.

That can be gotten past with a simple line:

diff --git a/survey/default.nix b/survey/default.nix
index 46d8066..5323198 100644
--- a/survey/default.nix
+++ b/survey/default.nix
@@ -653,6 +653,8 @@ let
     #patchelf = issue_61682_throw "patchelf" previous.patchelf;
     #xz = issue_61682_throw "xz" previous.xz;
 
+    SDL2_ttf = previous.SDL2_ttf.overrideAttrs (old: { dontDisableStatic = true; });
+
     postgresql = (previous.postgresql.overrideAttrs (old: { dontDisableStatic = true; })).override {
       # We need libpq, which does not need systemd,
       # and systemd doesn't currently build with musl.

Then we get some more linker errors, leading with:

Linking dist/build/LambdaHack/LambdaHack ...
/nix/store/8i49006sm0m9d0kri4i4hg7yndn1646b-binutils-2.35.1/bin/ld: /nix/store/8khwg9wczxyd29jl6knj2zslmkbb6s3q-SDL2_ttf-2.0.15/lib/libSDL2_ttf.a(SDL_ttf.o): in function `TTF_initFontMetrics':
(.text+0x340): undefined reference to `FT_MulFix'

FT_MulFix is a freetype function. The problem here is that the pkg-config .pc file generated by SDL2_ttf is incorrect for static linking: It is hand-written, containing only a Requires: line:

Name: SDL2_ttf
Description: ttf library for Simple DirectMedia Layer with FreeType 2 support
Version: 2.0.15
Requires: sdl2 >= 2.0.8
Libs: -L${libdir} -lSDL2_ttf
Cflags: -I${includedir}/SDL2

If it was generated by one of the common build systems, it would probably more easily contain the Requires.private line, with -lfreetype on it, to indicate that for static linking, linking in freetype is required because it's a direct dependency of SDL2_ttf.

This is explained in https://people.freedesktop.org/~dbn/pkg-config-guide.html (search for all occurrences of Requires.private):

libraries from Requires.private will only be included when static linking

For example, the .pc file for libpng does it correctly:

Name: libpng
Description: Loads and saves PNG files
Version: 1.6.37
Requires: zlib
Libs: -L${libdir} -lpng16
Libs.private: -lz                 <- note this line
Cflags: -I${includedir}

The best solution would be to fix SDL2_ttf to generate a better .pc file. This would require changing its configure.ac file.

Bu we can also add the -l flags in survey/default.nix.

@nh2
Copy link
Owner

nh2 commented Aug 13, 2021

I have succeeded building SDL2 and associated libraries statically now, and also LambdaHack, with some overrides I still need to clean up.

But what needs research is how to make a static SDL2 find a graphics card or use software rendering via Mesa llvmpipe:

/nix/store/wydhcgwplw9grms8d3y8sdfm5srg8xgb-LambdaHack-0.10.2.0/bin/LambdaHack
LambdaHack: SDLCallFailed {sdlExceptionCaller = "SDL.Init.init", sdlFunction = "SDL_Init", sdlExceptionError = "No available video device"}

@Mikolaj
Copy link

Mikolaj commented Aug 14, 2021

What happens when you do SDL_VIDEODRIVER=x11 /nix/store/wydhcgwplw9grms8d3y8sdfm5srg8xgb-LambdaHack-0.10.2.0/bin/LambdaHack?

I was able to reproduce the problems with a small C++ program and I was told libgl can't be linked statically, see utdemir/ghc-musl#14 (comment)

No idea how to link a software rendering replacement of libgl (llvmpipe?), but that may be the only solution, unless we can make dlopen to work.

@nh2
Copy link
Owner

nh2 commented Aug 15, 2021

@Mikolaj On Ubuntu I get:

SDL_VIDEODRIVER=x11 ./LambdaHack
LambdaHack: SDLCallFailed {sdlExceptionCaller = "SDL.Video.createRenderer", sdlFunction = "SDL_CreateRenderer", sdlExceptionError = "Couldn't find matching render driver"}

Here is the static binary in case you want to try:

LambdaHack.tar.gz

@nh2
Copy link
Owner

nh2 commented Aug 15, 2021

LambdaHack: SDLCallFailed {sdlExceptionCaller = "SDL.Init.init", sdlFunction = "SDL_Init", sdlExceptionError = "No available video device"}

@Mikolaj Sorry, that error was misleading: That happened when I tried to run the game on a headless machine without any graphical display, which doesn't make sense. The newer error from above is the one to look into.

@nh2
Copy link
Owner

nh2 commented Aug 15, 2021

Collecting here some links where people build static GUI apps with Mesa swrast == llvmpipe, as I don't know myself yet how to do it:

@nh2
Copy link
Owner

nh2 commented Aug 15, 2021

I've also posted the question to the SDL forum here: https://discourse.libsdl.org/t/what-are-my-options-for-static-linking-on-linux-with-software-opengl-support/32549

@Mikolaj
Copy link

Mikolaj commented Aug 15, 2021

LambdaHack: SDLCallFailed {sdlExceptionCaller = "SDL.Init.init", sdlFunction = "SDL_Init", sdlExceptionError = "No available video device"}

@Mikolaj Sorry, that error was misleading: That happened when I tried to run the game on a headless machine without any graphical display, which doesn't make sense. The newer error from above is the one to look into.

I'm getting (on my Ubuntu 16.04 desktop, no VM)

LambdaHack: SDLCallFailed {sdlExceptionCaller = "SDL.Video.createRenderer", sdlFunction = "SDL_CreateRenderer", sdlExceptionError = "Couldn't find matching render driver"}

But that's already more than I was getting with ghc-musl, because a windows opens up and only then it fails with the message on the console.

@azimut
Copy link

azimut commented Nov 3, 2021

For what I gather this won't be possible in alpine due musl, since it doesn't support dlopen() calls. That is for my case at least, not in haskell/ghc.

https://github.com/libsdl-org/SDL/blob/main/src/video/x11/SDL_x11dyn.c#L164
https://github.com/libsdl-org/SDL/blob/main/src/loadso/dlopen/SDL_sysloadso.c#L51
https://git.musl-libc.org/cgit/musl/tree/src/ldso/dlopen.c

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

Successfully merging this pull request may close these issues.

4 participants