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

lighttpd: enable cross-compilation #50935

Closed
wants to merge 1 commit into from

Conversation

tathougies
Copy link
Contributor

Motivation for this change

Lighttpd needs some extra configure flags to build a working cross-compiler. I'm not sure if this makes it work with all combinations of options, and I'm not sure if there's an easier way to make the configure script pick up the host pkgconfig deps.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@@ -24,15 +25,16 @@ stdenv.mkDerivation rec {
patchShebangs tests
'';

nativeBuildInputs = [ pkgconfig ];
depsBuildBuild = [ buildPackages.stdenv.cc buildPackages.pkgconfig ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know what binaries it tries to compile for the builder?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Back then it looked like it where using the compiler for the build architecture, but buildPackages.stdenv.cc indeed will produce binaries for the host architecture.

Copy link
Member

@Mic92 Mic92 Nov 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your approach seems the right for lighttpd. They respect $CC for cross-compiling but looking for the host cc to build lemon. pkgconfig can stay however in nativeBuildInputs:

diff --git a/pkgs/servers/http/lighttpd/default.nix b/pkgs/servers/http/lighttpd/default.nix
index 41394d3bcea..04640207a7b 100644
--- a/pkgs/servers/http/lighttpd/default.nix
+++ b/pkgs/servers/http/lighttpd/default.nix
@@ -1,4 +1,5 @@
-{ stdenv, fetchurl, pkgconfig, pcre, libxml2, zlib, attr, bzip2, which, file
+{ stdenv, fetchurl, autoreconfHook, pkgconfig
+, pcre, libxml2, zlib, attr, bzip2, which, file
 , openssl, enableMagnet ? false, lua5_1 ? null
 , enableMysql ? false, mysql ? null
 , enableLdap ? false, openldap ? null
@@ -24,8 +25,8 @@ stdenv.mkDerivation rec {
   postPatch = ''
     patchShebangs tests
   '';
-
-  depsBuildBuild = [ buildPackages.stdenv.cc buildPackages.pkgconfig ];
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ pkgconfig autoreconfHook ];
   buildInputs = [ pcre libxml2 zlib attr bzip2 which file openssl ]
              ++ stdenv.lib.optional enableMagnet lua5_1
              ++ stdenv.lib.optional enableMysql mysql.connector-c

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also would add autoreconfHook because this is best practice.

@c0bw3b c0bw3b added the 6.topic: cross-compilation Building packages on a different sort platform than than they will be run on label Nov 23, 2018
@mmahut
Copy link
Member

mmahut commented Aug 11, 2019

Are there any updates on this pull request, please?

@doronbehar
Copy link
Contributor

I tested:

  1. nix-build -A pkgsCross.aarch64-multiplatform-musl.lighttpd
  2. nix-build -A pkgsCross.aarch64-multiplatform-musl.lighttpd
  3. nix-build -A pkgsCross.raspberryPi.lighttpd
  4. nix-build -A pkgsCross.armv7l-hf-multiplatform.lighttpd

And none failed. I haven't tested usablity of any of these results but I still think it's not worth keeping this PR open so I'm closing as it's also ancient.

@doronbehar doronbehar closed this May 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict 6.topic: cross-compilation Building packages on a different sort platform than than they will be run on 10.rebuild-darwin: 0 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants