[yocto] Building clang with Yocto

Yu, Chan KitX chan.kitx.yu at intel.com
Sun Dec 21 19:33:17 PST 2014


Hi guys,

Here's an update FYI. I have managed to get clang sort of working. It compiles my sample code but I can't get the binary to execute. ./a.out simply returns:


./a.out: No such file or directory.

I'm sure that a.out exists and weirdly I could get the same binary file to run on my build machine. So I guess it could be because of some architecture difference but both target and build platform are quite the same (Intel x64 in build machine and BayleyBay for target platform) I used valleyisland-64 for the target platform so both should be able to execute 64 bit binaries. I suppose I can specify some other configuration options there but I have no idea what to specify the configure parameter --target=<TARGET> . x64 did not do any good. So any idea?

Thanks,
Chan Kit


From: Yu, Chan KitX
Sent: Wednesday, December 10, 2014 11:25 AM
To: Liviu Gheorghisan; Jim Rafert; yocto at yoctoproject.org
Subject: RE: [yocto] Building clang with Yocto

Liviu and Jim,

The thing is I'm trying to integrate LLVM+Clang together in the LLVM recipe. The modifications that I made are just adding Clang, compiler-rt and Clang tools within the LLVM work directory.  Using this way, I can mimic the original way (the one in LLVM website) of installing Clang+LLVM. So there are just two recipes; llvm3.3 and llvm-common just like the ones in the OpenEmbedded website. I do not know if I can build Clang separately.

Jim, judging from your postbuild script, it would need a RPM based linux system to build isn't it?

Chan Kit

From: Liviu Gheorghisan [mailto:liviu.gheorghisan at enea.com]
Sent: Wednesday, December 10, 2014 12:27 AM
To: Yu, Chan KitX; Jim Rafert; yocto at yoctoproject.org<mailto:yocto at yoctoproject.org>
Subject: Re: [yocto] Building clang with Yocto

Hello Yu, Jim

I think you can get the clang executable into the SDK installer script with something like this:

1. Add this dependency in nativesdk-packagegroup-sdk-host.bb:
RDEPENDS_${PN} += "nativesdk-<name-of-clang-recipe>"

2. In the clang recipe add this install() overwrite for the nativesdk class - this will install it into the SDK sysroot:
do_install_class-nativesdk() {
    install -d ${D}${bindir}
    install -m 0755 clang ${D}${bindir}
}

3. The clang recipe (I don't know if it has a recipe of its own, or it's part of the LLVM recipe) should also inherit from nativesdk:
BBCLASSEXTEND = "nativesdk"

Basically this should get your clang executable inside the SDK installer. Sure you can add more executables related to clang (like the llvm-related ones) in the install_class-nativesdk() function.

- Liviu Gheorghisan
On 12/09/2014 04:36 AM, Yu, Chan KitX wrote:

I **think** I'm just inches away from success. I think I just need to invoke a correct install command somewhere in the do_install function but so far I have not managed to do so. But right now the alternative way of jamming the compiler into the SDK sounds tempting to me.



-----Original Message-----

From: Yu, Chan KitX

Sent: Tuesday, December 09, 2014 9:19 AM

To: 'Jim Rafert'; yocto at yoctoproject.org<mailto:yocto at yoctoproject.org>

Subject: RE: Building clang with Yocto



Hi Jim,



How did you jam the clang compiler into the SDK tarball?



Chan Kit



-----Original Message-----

From: Jim Rafert [mailto:jimr at spectralogic.com]

Sent: Tuesday, December 09, 2014 1:48 AM

To: yocto at yoctoproject.org<mailto:yocto at yoctoproject.org>; Yu, Chan KitX

Subject: Building clang with Yocto



Hello Chan,



I have been working to a similar goal, to include clang in the toolchain to be used for compiling applications to run on the target.  Using clang to compile the OS and kernel are not required or  desired by me.



You may get some insight from the thread I started in November on the subject.  I'm not sure that this contains all of the posts on the subject. You may want to search the archive for November.



I have not been successful yet in getting clang actually packaged in the toolchain, in the Yocto build,  but at least it builds.  I have a postbuild script that takes the built clang compiler from the work directory and jams it into the SDK tarball that is embedded in the sdk install script.



-Jim-





________________________________________

From: yocto-bounces at yoctoproject.org<mailto:yocto-bounces at yoctoproject.org> [yocto-bounces at yoctoproject.org<mailto:yocto-bounces at yoctoproject.org>] on behalf of yocto-request at yoctoproject.org<mailto:yocto-request at yoctoproject.org> [yocto-request at yoctoproject.org<mailto:yocto-request at yoctoproject.org>]

Sent: Monday, December 08, 2014 2:56 AM

To: yocto at yoctoproject.org<mailto:yocto at yoctoproject.org>

Subject: yocto Digest, Vol 51, Issue 26



Send yocto mailing list submissions to

        yocto at yoctoproject.org<mailto:yocto at yoctoproject.org>



To subscribe or unsubscribe via the World Wide Web, visit

        https://lists.yoctoproject.org/listinfo/yocto

or, via email, send a message with subject or body 'help' to

        yocto-request at yoctoproject.org<mailto:yocto-request at yoctoproject.org>



You can reach the person managing the list at

        yocto-owner at yoctoproject.org<mailto:yocto-owner at yoctoproject.org>



When replying, please edit your Subject line so it is more specific than "Re: Contents of yocto digest..."

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20141222/bd8e6b3e/attachment.html>


More information about the yocto mailing list