public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
* make install fail on cross-compile
@ 2020-06-10  7:49 Paul
  2020-06-11 11:52 ` Adhemerval Zanella
  0 siblings, 1 reply; 3+ messages in thread
From: Paul @ 2020-06-10  7:49 UTC (permalink / raw)
  To: libc-help

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

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?

--
Paul Nicholson
--

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: make install fail on cross-compile
  2020-06-10  7:49 make install fail on cross-compile Paul
@ 2020-06-11 11:52 ` Adhemerval Zanella
  2020-06-14 15:02   ` Paul
  0 siblings, 1 reply; 3+ messages in thread
From: Adhemerval Zanella @ 2020-06-11 11:52 UTC (permalink / raw)
  To: Paul, libc-help

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: make install fail on cross-compile
  2020-06-11 11:52 ` Adhemerval Zanella
@ 2020-06-14 15:02   ` Paul
  0 siblings, 0 replies; 3+ messages in thread
From: Paul @ 2020-06-14 15:02 UTC (permalink / raw)
  To: libc-help


 > What you might do is do not set --build= so cross_compiling
 > is set to 'maybe'.

That works.

After configure,

  $ cd glibc-build
  $ grep cross-comp config.make
  cross-compiling = maybe

and then make and make install work without complaint.

Thanks.  I have another problem now but maybe I'll ask
about that under another subject.
--
Paul Nicholson
--

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-14 15:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-10  7:49 make install fail on cross-compile Paul
2020-06-11 11:52 ` Adhemerval Zanella
2020-06-14 15:02   ` Paul

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