Re: Building a cross-compiler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear Nick,

Many thanks for your response!

Nick Bowler (2021/01/20 10:36 -0500):
> One thing that might help you is to know that you can just add
> cross_compiling=yes to the configure command line to force
> configure into cross compilation mode.

I didn't know that indeed! thanks!

> If you only need the C compiler to produce code for the target system
> (and never for the host system) then this might even be sufficient for
> your use case.

That's something I don't know for sure yet but will definitely
investigate, thanks!

I'm not sure but I got the impression that Autoconf has an implicit
invariant which is that if build=A, host=B and target=C, then it expects
that CC points to a compiler running on A aand producing code for B and
if you change CC to something else, generating code for C, say, then
things start to not work properly. I was suggested to run configure
twice, once in the way I mentionned originally and once ==host set to my
target system, so make it easier to have the target-specific information
autodetected.

> Unfortunately Autoconf does not directly support detection of multiple
> C compilers (e.g., to get a different compiler for each of the build,
> host and target systems).  I think the Autoconf Archive has something
> to get a compiler for the build system which might be adaptable for
> target as well.

Yes, indeed, I have found

ax_cc_for_build:
https://www.gnu.org/software/autoconf-archive/ax_cc_for_build.html#ax_cc_for_build

and also

ax_prog_cc_for_build: https://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html

At the conceptual level, it feels that my use case does not really fit
in what has been imagined by autoconf. Indeed, since build=host, we are
not really cross-compiling, as defined by autoconf. But still, since
host!=target, what we are building is a cross-comppiler. At an abstract
level one may thing that a cross-compiler is just a program, but still,
it feels autoconf or the configure script should take this into account
that the built program has something to do with cross-compilation.

Getting a bit lost here...

Sébastien.




[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux