make install fail on cross-compile
Adhemerval Zanella
adhemerval.zanella@linaro.org
Thu Jun 11 11:52:23 GMT 2020
(Resending since I sent earlier to just Paul).
On 10/06/2020 04:49, Paul via Libc-help wrote:
> Building on x86_64-pc-linux-gnu for a cross-compile and
> target machine is also x86_64-pc-linux-gnu (but a later
> kernel).
>
> Configured with
>
> cd glibc-build
> ../glibc-2.31/configure --prefix=~/glibc-out ... --host=x86_64-pc-linux-gnu --enable-kernel=5.4.45
>
> Make runs fine but hits a problem with make install:
>
> FATAL: kernel too old
> Makefile:115: recipe for target 'install-symbolic-link' failed
> make[1]: *** [install-symbolic-link] Aborted (core dumped)
>
> My build kernel is only 4.15.0 but that shouldn't matter, seems
> that configure decided I was not doing a cross-compile,
> apparently because the build and host system types are the same.
>
> config.log has:
>
> host='x86_64-pc-linux-gnu'
> build='x86_64-pc-linux-gnu'
> cross_compiling='no'
>
> The relevant bit of the Makefile appears to be
>
> # Create links for shared libraries using the `ldconfig' program if possible.
> # Ignore the error if we cannot update /etc/ld.so.cache.
> ifeq (no,$(cross-compiling))
> ifeq (yes,$(build-shared))
> install: install-symbolic-link
> .PHONY: install-symbolic-link
> install-symbolic-link: subdir_install
> $(symbolic-link-prog) $(symbolic-link-list)
> rm -f $(symbolic-link-list)
>
> The configure script:
>
> cross_compiling=no
> ...
> # FIXME: To remove some day.
> if test "x$host_alias" != x; then
> if test "x$build_alias" = x; then
> cross_compiling=maybe
> elif test "x$build_alias" != "x$host_alias"; then
> cross_compiling=yes
> fi
> fi
This in fact came from autoconf (lib/autoconf/general.m4) while
expanding:
configure.ac:
52 AC_SUBST(cross_compiling)
So one solution might to fix on autoconf (although there is no new
release since 2012, so it might not a feasible solution).
>
> Well, if I configure and then edit config.make to change
>
> cross-compiling = no
>
> to
>
> cross-compiling = yes
>
> then make and make install runs fine and I get everything I
> want in ~/glibc-out which I can then copy to my target
> machine.
>
> Is there a magic configure command line option to say that
> I really want to cross-compile?
What you might do is do not set --build= so cross_compiling is set to
'maybe'. But I think the long term solution is to refactor the kernel
check ('FATAL: kernel too old') that prevents running binaries with
--enable-kernel=x.y.z on older kernels.
I recall Joseph has stirred some discussion about it, I need to track
down the discussion on libc-alpha.
More information about the Libc-help
mailing list