Open andrewbaxter opened 9 months ago
Apparently it also sets CXX_FOR_BUILD
to CXX
maybe? I found a patch that deletes both of those (remove_CXX_FOR_BUILD_stuff
) https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl-demo/+/10455
CXX_FOR_BUILD is actually what it should be using I guess, but it looks like somewhere else sets CXX_FOR_BUILD
to CXX
, hence why the later CXX = CXX_FOR_BUILD
doesn't help.
I tried adding the autoconf-archive ax_prog_cxx_for_build.m4
macro like
(final: prev: {
dbus_cplusplus = prev.dbus_cplusplus.overrideAttrs (old: {
nativeBuildInputs = old.nativeBuildInputs ++ [
pkgs.autoreconfHook
];
patches = old.patches ++ [
./dbus-cplusplus-tools-cxx.patch
];
preAutoreconf = ''
cp ${./ax_prog_cxx_for_build.m4} m4/
'';
});
})
with
diff -Naur libdbus-c++-0.9.0.ori/configure.ac libdbus-c++-0.9.0/configure.ac
--- libdbus-c++-0.9.0.ori/configure.ac 2016-11-15 14:25:36.085882774 +0100
+++ libdbus-c++-0.9.0/configure.ac 2016-11-15 14:27:08.814568717 +0100
@@ -64,9 +64,8 @@
AC_PROG_CC
AC_PROG_CXX
-CXX_FOR_BUILD=${CXX_FOR_BUILD-${CXX}}
-AC_SUBST(CXX_FOR_BUILD)
+AC_PROG_CXX_FOR_BUILD
AM_PROG_LIBTOOL
PKG_PROG_PKG_CONFIG
diff -Naur libdbus-c++-0.9.0.ori/tools/Makefile.am libdbus-c++-0.9.0/tools/Makefile.am
--- libdbus-c++-0.9.0.ori/tools/Makefile.am 2016-11-15 14:25:36.089882803 +0100
+++ libdbus-c++-0.9.0/tools/Makefile.am 2016-11-15 14:26:19.454203583 +0100
@@ -1,7 +1,5 @@
# hacky, but ...
-CXX = $(CXX_FOR_BUILD)
-
AM_CPPFLAGS = \
$(dbus_CFLAGS) \
$(xml_CFLAGS) \
but getting
./configure: line 6474: AX_PROG_CC_FOR_BUILD: command not found
checking how to run the C++ preprocessor... aarch64-unknown-linux-gnu-g++ -E
checking for x86_64-unknown-linux-gnu-g++... no
checking for x86_64-unknown-linux-gnu-c++... no
...
checking for g++... no
checking for c++... no
...
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
Not sure about the AX_PROG_CC_FOR_BUILD
thing when it's apparently running it, it seems like I just need some more native inputs here.
Ah... I guess both buildInputs and nativeBuildInputs use the host arch, not build arch. depsBuildBuild
seems to work. Some progress with
(final: prev: {
dbus_cplusplus = prev.dbus_cplusplus.overrideAttrs (old: {
# https://github.com/NixOS/nixpkgs/issues/268533
depsBuildBuild = [
pkgs.autoreconfHook
pkgs.gcc
pkgs.pkg-config
pkgs.expat
pkgs.dbus
];
patches = old.patches ++ [
./dbus-cplusplus-tools-cxx.patch
];
preAutoreconf = ''
cp ${./ax_prog_cc_for_build.m4} m4/
cp ${./ax_prog_cxx_for_build.m4} m4/
'';
});
})
but it's now using aarch64 headers and libs for linking the tool. I modified the patch to overload CXXFLAGS and LDFLAGS but it looks like the issue is actually pkgconfig is finding aarch64 packages.
There's no AC_CHECK_LIB_FOR_BUILD
afaict and I'm not excited to set forth on the adventure of writing it myself.
I wonder if it would be easier to split this into two packages... actually maybe I can just patch uses of dbusxx-* with the binaries from the build-arch package (are they distributed?)
This worked
let
buildPkgs = (import
(nixpkgs_path + /nixos/lib/eval-config.nix)
{
system = builtins.currentSystem;
modules = [{ }];
}).pkgs;
in
...
(final: prev: {
dbus_cplusplus = prev.dbus_cplusplus.overrideAttrs (old: {
# https://github.com/NixOS/nixpkgs/issues/268533
postConfigure = ''
${buildPkgs.findutils}/bin/find . -type f -exec ${buildPkgs.gnused}/bin/sed -i -e 's^..top_builddir..tools.dbusxx-xml2cpp^${buildPkgs.dbus_cplusplus}/bin/dbusxx-xml2cpp^' {} \;
'';
});
})
No patches, etc, just replacing the calls to -xml2cpp
.
I'm sure there's a better way to refer to non-host packages though, but google and discord failed me.
Steps To Reproduce
Steps to reproduce the behavior:
Build log
https://gist.github.com/andrewbaxter/22b065690b56b4ed5442a24cb9dd15b9
Additional context
I'm not familiar with automake conventions, but is this caused by
in
tools/Makefile.am
? If I understood correctly,CXX_FOR_BUILD
is the cross compiler, so the tools are built for the target arch. However these tools are used on the build system for other parts of the build, so need to be executable on the build system.I looked around for other patches but couldn't find distros packaging this for arch. The SF patches list had one patch that went even further here, overriding CXXFLAGS + co in a similar manner.
Notify maintainers
@cillianderoiste
Metadata