DavidEGrayson / nixcrpkgs

Nice nix expressions for cross-compiling.
Other
136 stars 8 forks source link

Qt 5 fails to build #19

Closed bjornfor closed 1 year ago

bjornfor commented 1 year ago

The current mirror has only 5.15.x sources, not 5.12.x, so the download fails.

I tried using this patch:

diff --git a/pkgs/qt/default.nix b/pkgs/qt/default.nix
index 5aa5929..6889d86 100644
--- a/pkgs/qt/default.nix
+++ b/pkgs/qt/default.nix
@@ -30,8 +30,8 @@ let
     in "${os_code}-${compiler_code}";

   base_src = crossenv.nixpkgs.fetchurl {
-    url = "https://download.qt.io/official_releases/qt/5.12/${version}/submodules/qtbase-everywhere-src-${version}.tar.xz";
-    sha256 = "fBXDFZC27BJAgkKxoyB10dVF814dQf260x7GcNAGgPI=";
+    url = "https://download.qt.io/archive/qt/5.12/${version}/single/qt-everywhere-src-${version}.tar.xz";
+    sha256 = "sha256-GXmjIz9onLiz4ng5F/j5j2ouGCGnCBX7c38CDNS2qwY=";
   };

   base_raw = crossenv.make_derivation {

(Notice how the hash changes -- ugh. I don't have the original tarball to compare.)

But then there is a new error:

$ nix-build -A win32.qt
these 2 derivations will be built:
  /nix/store/7v0ggca81j3mmbhsfqr7inmbb80fvk80-qtbase-raw-5.12.12-i686-w64-mingw32.drv
  /nix/store/pkw281xvjkv3jnqjlm36lapjizw030cy-qtbase-5.12.12-i686-w64-mingw32.drv
building '/nix/store/7v0ggca81j3mmbhsfqr7inmbb80fvk80-qtbase-raw-5.12.12-i686-w64-mingw32.drv'...
/nix/store/5cki47ssg6p9rp8zj0pssp0lr262q0ha-qtbase-raw-5.12.12-i686-w64-mingw32 /build
mv: cannot stat 'qtbase-everywhere-src-*': No such file or directory
error: builder for '/nix/store/7v0ggca81j3mmbhsfqr7inmbb80fvk80-qtbase-raw-5.12.12-i686-w64-mingw32.drv' failed with exit code 1;
       last 2 log lines:
       > /nix/store/5cki47ssg6p9rp8zj0pssp0lr262q0ha-qtbase-raw-5.12.12-i686-w64-mingw32 /build
       > mv: cannot stat 'qtbase-everywhere-src-*': No such file or directory
       For full logs, run 'nix log /nix/store/7v0ggca81j3mmbhsfqr7inmbb80fvk80-qtbase-raw-5.12.12-i686-w64-mingw32.drv'.
error: 1 dependencies of derivation '/nix/store/pkw281xvjkv3jnqjlm36lapjizw030cy-qtbase-5.12.12-i686-w64-mingw32.drv' failed to build

Is my new tarball URL bad?

DavidEGrayson commented 1 year ago

Thanks for the report! The new URL for the same tarball seems to be:

https://download.qt.io/archive/qt/5.12/5.12.12/submodules/qtbase-everywhere-src-5.12.12.tar.xz

This is fixed in commit a57a608f4684894ec5605ae06ce9b07d3d6cfcb9.

Note that nixcrpkgs supports Qt 6 now, so you might want to try that instead! It should be better than Qt 5, since I didn't have to patch it as much and I didn't have to generate the CMake files myself using Ruby scripts.

nix-build -A win32.qt6.examples
bjornfor commented 1 year ago

Thanks!

bjornfor commented 1 year ago
nix-build -A win32.qt6.examples

That actually failed with missing /bin/pwd. I fixed it with this quick hack:

diff --git a/pkgs/qt6/builder.sh b/pkgs/qt6/builder.sh
index 2d768d0..f3524d9 100644
--- a/pkgs/qt6/builder.sh
+++ b/pkgs/qt6/builder.sh
@@ -14,6 +14,7 @@ cd ../../..
 mkdir build
 cd build

+sed -i -e "s|/bin/pwd|pwd|g" ../src/configure
 PKG_CONFIG=pkg-config-cross ../src/configure -prefix $out $configure_flags
 cmake --build . --parallel
 cmake --install .
diff --git a/pkgs/qt6/qt_host_builder.sh b/pkgs/qt6/qt_host_builder.sh
index 97194cb..9960b4a 100644
--- a/pkgs/qt6/qt_host_builder.sh
+++ b/pkgs/qt6/qt_host_builder.sh
@@ -6,6 +6,7 @@ chmod u+w -R src
 mkdir build
 cd build

+sed -i -e "s|/bin/pwd|pwd|g" ../src/configure
 ../src/configure -prefix $out $configure_flags
 cmake --build . --parallel --verbose
 cmake --install .

However, it failed to run under wine:

$ nix-shell -p wine --run "wine /nix/store/i7phvykdba758fbcla9a8v8hw622n7an-qt-examples-6.4.1-i686-w64-mingw32/bin/mainwindow.exe"
0024:err:module:import_dll Library api-ms-win-core-winrt-l1-1-0.dll (which is needed by L"Z:\\nix\\store\\i7phvykdba758fbcla9a8v8hw622n7an-qt-examples-6.4.1-i686-w64-mingw32\\bin\\mainwindow.exe") not found
0024:err:module:import_dll Library api-ms-win-core-winrt-string-l1-1-0.dll (which is needed by L"Z:\\nix\\store\\i7phvykdba758fbcla9a8v8hw622n7an-qt-examples-6.4.1-i686-w64-mingw32\\bin\\mainwindow.exe") not found
0024:err:module:import_dll Library api-ms-win-core-synch-l1-2-0.dll (which is needed by L"Z:\\nix\\store\\i7phvykdba758fbcla9a8v8hw622n7an-qt-examples-6.4.1-i686-w64-mingw32\\bin\\mainwindow.exe") not found
0024:err:module:LdrInitializeThunk Importing dlls for L"Z:\\nix\\store\\i7phvykdba758fbcla9a8v8hw622n7an-qt-examples-6.4.1-i686-w64-mingw32\\bin\\mainwindow.exe" failed, status c0000135

nix-build -A win32.qt.examples (qt5) worked though. This is very cool!

DavidEGrayson commented 1 year ago

I'm glad you like it! The /bin/pwd thing is now fixed in commit 20c54c9. I don't know much about Wine so I'm not sure what's going on there.

bjornfor commented 1 year ago

Thanks!