public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Paul <Paul@abelian.netcom.co.uk>, libc-help@sourceware.org
Subject: Re: make install fail on cross-compile
Date: Thu, 11 Jun 2020 08:52:23 -0300	[thread overview]
Message-ID: <b0e4530d-178c-fa05-359c-7869cdce7880@linaro.org> (raw)
In-Reply-To: <0339f134-2970-37e5-83c9-f333dc57498b@abelian.netcom.co.uk>

(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.

  reply	other threads:[~2020-06-11 11:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-10  7:49 Paul
2020-06-11 11:52 ` Adhemerval Zanella [this message]
2020-06-14 15:02   ` Paul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b0e4530d-178c-fa05-359c-7869cdce7880@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=Paul@abelian.netcom.co.uk \
    --cc=libc-help@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).