From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] syslinux using host compiler.
Date: Thu, 24 Mar 2016 15:12:01 +0100 [thread overview]
Message-ID: <20160324151201.7e05fd28@free-electrons.com> (raw)
In-Reply-To: <20160324130856.GQ22286@hermes.click-hack.org>
Hello,
On Thu, 24 Mar 2016 14:08:56 +0100, Gilles Chanteperdrix wrote:
> > For grub2, it is actually using the target compiler, see the comment in
> > grub2.mk:
>
> Ok, I thought I saw grub selected BR2_HOSTARCH_NEEDS_IA32_COMPILER
> too, must I have misread.
grub yes, not grub2. But your original comment was about grub2, hence I
looked at grub2. But you are right, grub is like syslinux, we use the
host compiler.
> > No, because syslinux selects BR2_HOSTARCH_NEEDS_IA32_COMPILER, which
> > ensures you have a working x86 32-bits compiler on your host machine. If
> > you don't, then Buildroot will not even start the build.
>
> I meant you can not build syslinux if your host is arm for instance,
> and you have an arm/x86 cross-compilation toolchain.
Correct, but the fact that you select BR2_HOSTARCH_NEEDS_IA32_COMPILER
will test that you have a host compiler capable of producing x86 32
bits binaries. So if you're building on ARM, it will simply abort at
the beginning of the build. Of course, it would be nicer if we could be
on any host architecture, but on the other hand, virtually everyone is
using x86/x86-64 as build machines, so it wasn't really worth putting
more efforts to fix this.
> > The reason why we're using the host compiler rather than the target
> > compiler is because syslinux must be built as 32-bits x86 code, even if
> > your target system is x86_64.
>
> Yes, but AFAIK, gcc for x86_64 always supports the -m32 switch. To
> build 32 bits host binaries, you need a multilib installation with a
> 32 bits glibc, but a bootloader should not use anything in the glibc.
Completely agree with the theory. In practice, I remember seeing some
problems, like it was anyway trying to build some actual user-space
applications with -m32. But (1) my analysis at the time might have been
wrong and (2) syslinux was upgraded several times since then so maybe
they have changed/fixed things. But that definitely doesn't mean I'm
not interested in seeing patches improving this stuff.
> > > I am using an x86_64 toolchain generated with ct-ng, did not enable
> > > multilib, and syslinux seems to have no problem compiling with that
> > > toolchain, which seems normal, since the boot code should not be
> > > using the libc anyway.
> >
> > Are you sure you're using this target compiler to build syslinux, and
> > not your host compiler? Back in 2014, when commit
> > 09e7b4c89159a3e48f463b0a22e649c4fc12f4b3 was done, it wouldn't build
> > with a x86-64 only compiler.
>
> Yes, I am sure of it. The only "trick" I had to apply was to force
> LD="$(TARGET_LD) -m elf_i386". Now buildroot complains later because
> isohybrid in the host directory is not compiled with the proper
> rpath, but I guess it means we need host-syslinux.
OK.
> > If that actually works, then patches are welcome. But in this case, we
> > will indeed probably need separate host-syslinux and syslinux packages,
> > as you suggested.
>
> Yes. Ok, will work on the patch.
Great!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
next prev parent reply other threads:[~2016-03-24 14:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-24 10:39 [Buildroot] syslinux using host compiler Gilles Chanteperdrix
2016-03-24 12:50 ` Thomas Petazzoni
2016-03-24 13:08 ` Gilles Chanteperdrix
2016-03-24 14:12 ` Thomas Petazzoni [this message]
2016-03-25 22:27 ` Arnout Vandecappelle
-- strict thread matches above, loose matches on Subject: below --
2016-03-24 10:30 Gilles Chanteperdrix
2016-03-24 10:55 ` Gilles Chanteperdrix
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=20160324151201.7e05fd28@free-electrons.com \
--to=thomas.petazzoni@free-electrons.com \
--cc=buildroot@busybox.net \
/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