-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
gforth: fix cross-compilation #104778
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
base: master
Are you sure you want to change the base?
gforth: fix cross-compilation #104778
Conversation
@Mindavi could you help here? I notice you recently did a lot of cross compilation fixes. |
I can take a stab. Anything special you'd like me to take a look at, or is it that you haven't succeeded making it actually cross-compile properly? Note to self, this is the error:
Not gonna work on this today, but I'll take a look in the upcoming days. |
Thanks for the reply. I wasn't able to resolve the error about needing gforth in $PATH, despite it already being there via nativeBuildInputs. |
Some things I've found: AC_CHECK_FILE must be replaced with something like diff --git a/configure.in b/configure.in
index c3602a7..51bec73 100644
--- a/configure.in
+++ b/configure.in
@@ -652,11 +652,15 @@ AC_MSG_RESULT($PREFORTH)
#echo "machine='$machine'"
dnl AC_CHECK_PROG(asm_fs,asm.fs,arch/$machine/asm.fs,,$srcdir/arch/$machine)
-AC_CHECK_FILE($srcdir/arch/$machine/asm.fs,[asm_fs=arch/$machine/asm.fs],)
+if test -f "$srcdir/arch/$machine/asm.fs"; then
+ asm_fs=arch/$machine/asm.fs
+fi
AC_SUBST(asm_fs)
dnl AC_CHECK_PROG(disasm_fs,disasm.fs,arch/$machine/disasm.fs,,$srcdir/arch/$machine)
-AC_CHECK_FILE($srcdir/arch/$machine/disasm.fs,[disasm_fs=arch/$machine/disasm.fs],)
+if test -f "$srcdir/arch/$machine/disasm.fs"; then
+ disasm_fs=arch/$machine/asm.fs
+fi
AC_SUBST(disasm_fs)
AC_PATH_PROG(INSTALL_INFO,install-info,[echo '>>>>Please make info dir entry:'],$PATH:/sbin:/usr/sbin:/usr/local/sbin) Seems like they also did something like that here: https://git.savannah.gnu.org/cgit/gforth.git/tree/configure.ac#n864. The error about gforth missing from the PATH may or may not be relevant. Otherwise, this patch upon your work seems to get me further into the build: +{ stdenv, lib, fetchurl, m4, buildPackages, gforth, autoreconfHook, automake, autoconf }:
let
version = "0.7.3";
@@ -12,7 +12,23 @@ stdenv.mkDerivation {
sha256 = "1c1bahc9ypmca8rv2dijiqbangm1d9av286904yw48ph7ciz4qig";
};
- nativeBuildInputs = [ m4 ] ++ lib.optional crossCompiling gforth;
+ patches = [
+ # To enable cross-compilation
+ ./cross.patch
+ ];
+
+ postPatch = ''
+ rm configure
+ substituteInPlace configure.in \
+ --replace "arm*)" "aarch64*)" \
+ --replace "/sbin/ldconfig" "ldconfig"
+ autoupdate
+ '';
+
+ #strictDeps = true;
+
+ depsBuildBuild = [ automake m4 autoconf autoreconfHook ];
+ #nativeBuildInputs = [ m4 ] ++ lib.optionals crossCompiling [ gforth autoreconfHook ];
configurePlatforms = [ "build" "host" ] ++ lib.optional (stdenv.targetPlatform != stdenv.hostPlatform) "target"; However, the more I'm looking into this, the more I think that this version of gforth might not really support aarch64. I'm not sure which arch you're targeting, but it might be worth trying to get the newer / bleeding edge version building. Of course, your applications need to support that as well. Note that I tried to simply build the bleeding edge version, but that didn't work :/. So it might take some work to get that running too. Build errors after applying above patches
Will do a check on how far I get building the native bleeding edge version. |
I've no clue why the build of the bleeding edge version fails. I see something like The command that's executed is this: The output (with debug enabled)
No clue what that is supposed to mean... |
For armv7l it seems the result is different. I did do this to ensure that gforth is picked up from the path: + makeFlags = lib.optionals crossCompiling [
+ "ENGINE=${buildPackages.gforth}/bin/gforth"
+ ]; Still fails though :(
|
Hi @Mindavi, thanks for looking into this. My attempts have been to cross-compile to armv7l, i.e. |
Ah ok, good to know. The bleeding edge experience I described above, it didn't go very well. |
I will incorporate your diffs into this PR and rebase on master, but looks like we're stuck for a while and should revisit next release. |
@Artturin you might be interested in this cross-compilation issue also |
Co-authored-by: Artturin <Artturin@artturin.com>
db6851f
to
b60f3bb
Compare
All
|
@Artturin how would I set |
Just with #341882 the build gets past that without
|
Motivation for this change
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)