Enable SDL - #108
Conversation
|
The PR mentioned in #107 (comment) seems to have landed in |
|
... No CI? Okay, trying this locally with the patch: |
|
Build failed with: Not sure what to do next. |
|
The problem seems to be the new |
|
Now I'm getting this error building GHC: |
|
And also this one building |
|
@nh2 Any suggestion what I could try next? |
|
The problem with GHC is gone after updating to newer |
|
OK, I have gotten it to work with 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 ]; |
|
Upstream issue about Python: NixOS/nixpkgs#131557, patch: NixOS/nixpkgs#131951 Upstream issue about |
|
Turns out, it’s something in So my fix (adding |
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! |
|
If on top of current That's because 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:
If it was generated by one of the common build systems, it would probably more easily contain the This is explained in https://people.freedesktop.org/~dbn/pkg-config-guide.html (search for all occurrences of
For example, the The best solution would be to fix Bu we can also add the |
|
I have succeeded building SDL2 and associated libraries statically now, and also But what needs research is how to make a static SDL2 find a graphics card or use software rendering via Mesa /nix/store/wydhcgwplw9grms8d3y8sdfm5srg8xgb-LambdaHack-0.10.2.0/bin/LambdaHack
LambdaHack: SDLCallFailed {sdlExceptionCaller = "SDL.Init.init", sdlFunction = "SDL_Init", sdlExceptionError = "No available video device"} |
|
What happens when you do 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. |
|
@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: |
@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. |
|
Collecting here some links where people build static GUI apps with Mesa |
|
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 |
I'm getting (on my Ubuntu 16.04 desktop, no VM) 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. |
|
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 |
No description provided.