All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Chris Morgan <chmorgan@gmail.com>
Cc: bitbake-devel@lists.openembedded.org
Subject: Re: Bitbake for native x86 project?
Date: Mon, 14 Oct 2013 15:33:56 +0100	[thread overview]
Message-ID: <1381761236.29912.322.camel@ted> (raw)
In-Reply-To: <1381683215.29912.233.camel@ted>

On Sun, 2013-10-13 at 17:53 +0100, Richard Purdie wrote:

> Its certainly possible, its just that nobody has done it. Your options
> would be to either reconfigure the native recipes to be packaged, or to
> add in a configuration which shortcircuits the cross compiler and adds
> in some native magic to specific machine targets.
> 
> Whilst adding packaging to native sounds attractive, the reality is that
> its not easy and doesn't really make sense technically. Adding in those
> short-circuits I mention by comparison shouldn't be hard and if I were
> doing this, its the way I'd go.

I had a kind of morbid curiosity about this. I came up with the patches
here:

http://git.yoctoproject.org/cgit.cgi/poky-contrib/commit/?h=rpurdie/t2&id=c1c02d166f22179fb18e430aeae2806bb5d51a3f

where I've basically tried to wire in the host gcc yet compile
everything else for the target as usual including the libc. Its a bit of
an arbitrary choice but should in theory be easier than providing a
whole libc from the native system.

It works to a point (e.g. gettext compiled) but ncurses did not due to
symbol errors with __poll_chk. Why? Basically the compiler/linker do not
respect the sysroot, go searching for libc and find the system one
rather than the one we built. It then fails to link as there is version
mismatch. There isn't any compiler commandline option you can tweak to
stop it doing this :(.

Some questions this raises:

a) Do you use a sysroot of "/" or STAGING_DIR_TARGET?

I did the latter, it wasn't particularly successful as the tools don't
all respect it properly. In theory you can link the pieces inside the
STAGING_DIR to outside the sysroot if you want the compiler to see them,
the reality is some search paths are hardcoded into gcc and they leak
in. When we compile our compiler, we configure it not to do that.

To use "/" you'd have to do what native.bbclass does, set
STAGING_DIR_TARGET to be "/" and then set prefix to be inside the
STAGING_DIR but this means that binaries would expect to always run with
such a prefix.

I guess a hybrid would be possible, add -L and -I for the sysroot and
accept it linking with the system lib/include directories, ditching the
sysroot option a bit like the system did before gcc has sysroot support.

b) Can you use the system compiler without the libc?

Answer appears to be no, you can't. This means you would have to add in
some kind of tweaking to the output packages to add in dependencies on
libc and anything else that was system provided. You can therefore not
use this approach to build complete systems. Packaging up the system
provided libc would also seem to be ruled out.

Cheers,

Richard







      parent reply	other threads:[~2013-10-14 14:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-11 13:22 Bitbake for native x86 project? Chris Morgan
2013-10-13 16:03 ` Trevor Woerner
2013-10-15 12:17   ` Chris Morgan
2013-11-07 18:57     ` Darren Hart
2013-10-13 16:53 ` Richard Purdie
2013-10-14 13:28   ` Chris Morgan
2013-10-14 14:40     ` Richard Purdie
2013-10-14 15:02       ` Chris Morgan
2013-10-14 15:22         ` Trevor Woerner
2013-10-14 15:30         ` Richard Purdie
2013-10-14 14:33   ` Richard Purdie [this message]

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=1381761236.29912.322.camel@ted \
    --to=richard.purdie@linuxfoundation.org \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=chmorgan@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.