Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] Help adding a prerequisite to GCC
@ 2012-07-27 22:27 Scott Moore
  2012-07-28  7:37 ` Thomas Petazzoni
  2012-07-28 16:43 ` Yann E. MORIN
  0 siblings, 2 replies; 3+ messages in thread
From: Scott Moore @ 2012-07-27 22:27 UTC (permalink / raw)
  To: buildroot

Hi,
I'm trying to compile a toolchain with LTO support in gcc.
I tried to do this by adding the additional gcc flag "--enable-lto", but 
the build fails (unsurprisingly) because building gcc with lto support 
requires libelf, which is not currently a prerequisite for gcc in buildroot.

To fix this, I tried adding libelf to gcc-uclibc-4.x.mk by adding:
GCC_HOST_PREREQ += host-libelf
GCC_TARGET_PREREQ += libelf

The resulting build fails because their is "no make target host-libelf, 
required for gcc_initial". Can anyone help me figure out where I went 
wrong? I realize just hacking it in to the .mk like that probably isn't 
ideal. I was planning to add it as a menuconfig option once I get it 
building at all.
Thanks in advance,
Scott

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

* [Buildroot] Help adding a prerequisite to GCC
  2012-07-27 22:27 [Buildroot] Help adding a prerequisite to GCC Scott Moore
@ 2012-07-28  7:37 ` Thomas Petazzoni
  2012-07-28 16:43 ` Yann E. MORIN
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2012-07-28  7:37 UTC (permalink / raw)
  To: buildroot

Hello Scott,

Le Fri, 27 Jul 2012 15:27:23 -0700,
Scott Moore <scott.moore@sri.com> a ?crit :

> I'm trying to compile a toolchain with LTO support in gcc.
> I tried to do this by adding the additional gcc flag "--enable-lto", but 
> the build fails (unsurprisingly) because building gcc with lto support 
> requires libelf, which is not currently a prerequisite for gcc in buildroot.
> 
> To fix this, I tried adding libelf to gcc-uclibc-4.x.mk by adding:
> GCC_HOST_PREREQ += host-libelf
> GCC_TARGET_PREREQ += libelf

This sounds good.

> The resulting build fails because their is "no make target host-libelf, 
> required for gcc_initial". Can anyone help me figure out where I went 
> wrong? I realize just hacking it in to the .mk like that probably isn't 
> ideal. I was planning to add it as a menuconfig option once I get it 
> building at all.

If you look at package/libelf/libelf.mk, you'll see that there is only
a target variant of this package, and no host variant.

So you should add a line:

$(eval $(host-autotools-package))

at the bottom of the file, and try again. You may need to define some
addition HOST_* variables to adjust the configuration options and
others, if the build fails or if the resulting host libelf doesn't work
properly for what you're trying to do.

Hope this helps,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

* [Buildroot] Help adding a prerequisite to GCC
  2012-07-27 22:27 [Buildroot] Help adding a prerequisite to GCC Scott Moore
  2012-07-28  7:37 ` Thomas Petazzoni
@ 2012-07-28 16:43 ` Yann E. MORIN
  1 sibling, 0 replies; 3+ messages in thread
From: Yann E. MORIN @ 2012-07-28 16:43 UTC (permalink / raw)
  To: buildroot

Scott, All,

On Saturday 28 July 2012 00:27:23 Scott Moore wrote:
> I'm trying to compile a toolchain with LTO support in gcc.
> I tried to do this by adding the additional gcc flag "--enable-lto", but 
> the build fails (unsurprisingly) because building gcc with lto support 
> requires libelf, which is not currently a prerequisite for gcc in buildroot.
> 
> To fix this, I tried adding libelf to gcc-uclibc-4.x.mk by adding:
> GCC_HOST_PREREQ += host-libelf
> GCC_TARGET_PREREQ += libelf

Please, note that only gcc-4.5 requires libelf for LTO.
gcc-4.6 and above do *not need libelf for LTO (nor any other lib).

So, this PREREQs should be conditional to the gcc version.

Or you can use crostool-NG as a backend, that already has all the magic to
build an LTO-capable toolchain (as well as using GRAPHITE).

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

end of thread, other threads:[~2012-07-28 16:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-27 22:27 [Buildroot] Help adding a prerequisite to GCC Scott Moore
2012-07-28  7:37 ` Thomas Petazzoni
2012-07-28 16:43 ` Yann E. MORIN

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox