0

I was trying to build only gcc using yocto. I tried with "bitbake-layers show-recipes" it was showing multiple recipes for gcc, similarly for bitbake -s.

#bitbake-layers show-recipes 
gcc:
  meta                 4.8.2
gcc-cross:
  meta                 4.8.2
gcc-cross-canadian-arm:
  meta                 4.8.2
gcc-cross-initial:
  meta                 4.8.2
gcc-crosssdk:
  meta                 4.8.2
gcc-crosssdk-initial:
  meta                 4.8.2
gcc-runtime:
  meta                 4.8.2
gccmakedep:
  meta                 1:1.0.2

#bitbake -s 
gcc                                                 :4.8.2-r0                          
gcc-cross                                           :4.8.2-r0                          
gcc-cross-canadian-arm                              :4.8.2-r0                          
gcc-cross-initial                                   :4.8.2-r0                          
gcc-crosssdk                                        :4.8.2-r0                          
gcc-crosssdk-initial                                :4.8.2-r0                          
gcc-runtime                                         :4.8.2-r0                          
gccmakedep                                         1:1.0.2-r3

Please guide me to understand why there are multiple recipes related to gcc and which one I have to build.

In yocto, is there one to one match for recipe and package. i.e for creating each package there is a corresponding only one recipe?

Ravi A
  • 421
  • 2
  • 9
  • 21

2 Answers2

6

To explain each one in turn:

  • gcc is the recipe for gcc that runs on the target machine itself.
  • gcc-cross is the cross-compiler that the build system uses. If you build any recipe for the target that needs to be compiled with gcc, this is what will be used to compile that.
  • gcc-cross-canadian- is the final relocatable cross-compiler for the SDK, in this case for the ARM architecture.
  • gcc-crosssdk is an intermediate step in producing gcc-cross-canadian.
  • the *-initial are the initial versions of the compiler required to bootstrap the toolchain separately for the standard cross-compiler and for the SDK.
  • gcc-runtime builds the runtime components that come as part of gcc (e.g. libstdc++).
  • gccmakedep isn't really part of gcc itself, it's a script that comes as part of the X11 utilities that some projects need to determine dependencies for each source file.

When you say "you only need to build gcc", it's not entirely clear what you mean, but I suspect it's either gcc for the target (in which case it's "gcc", though I suspect you'll probably need more than that - packagegroup-core-buildessential may be what you want) or you want a cross-compiler you can install separately in which case you probably ought to bitbake meta-toolchain or bitbake -c populate_sdk imagename. That'll contain more than just gcc but it's likely gcc alone isn't going to be enough anyway.

bluelightning
  • 461
  • 3
  • 5
  • I need to compile 3rd party source code for IMX6, I required IMX6 toolchain to cross compile. As complete build (bitbake core-minimal-image)takes more time and in between it is failing while downloading required packages using fetchers, because fetch urls are blocked in office network if the package size is huge. So I thought building only toolchain using yocto will takes less time and download failures also minimum. – Ravi A Jun 02 '16 at 06:26
  • I'd be very surprised if you couldn't already find a pre-built IMX6 SDK/toolchain installer somewhere. Failing that, do your downloading outside of your corporate network using bitbake -c fetchall and then bring that in via sneakernet to finish off. – bluelightning Jun 03 '16 at 04:00
  • I was also changing the tool chain configuration to disable hard floating point by modifying some of the inc files. Each time when I modify one variable also I was cleaning and building the image. As most of the time I was waiting for the build to complete. I checked how to build only required package using yocto, but I saw multiple packages for gcc when I checked the package list using bitbake -s. – Ravi A Jun 03 '16 at 18:47
0

GCC is a huge project. Maybe this recipe could help you understand GCC and Yocto a little bit better. The following information is some information paraphrase from "Embedded Linux Projects Using Yocto Project Cookbook" by Alex Gonzalez

GNU toolchain contains the following components:

Assembler (GNU as): part of the binutils package

Linker (GNU Id): part of the binutils package

Compiler (GNU gcc): support for C, C++, Java, Ada, Fortran, and Objective C

Debugger (GNU gdb): GNU debugger

Binary file tools (objdump, nm, objcopy, readelf, strip, and so on): these are part of the binutils package

These components are enough to build bare metal applications bootloaders like u-boot, Linux Kernel because they do not need C library and they implement C library functions they need. POSIX-compliant C library is needed for LInux user space applications.

glibc is the default C library used in the Yocto Project.

On Embedded Systems, we need a cross-compilation toolchain. We build in a host computer but run the result binarines on the target which is usually different architecture. There are several types of toolchains based on build machine, target machine.

The most common combinations are:

Native: An example of this is an x86 machine running a toolchain that >has also been built on an x86 machine producing binaries to run on an x86 machine. This is common in desktop computers.

Cross-compilation: This is the most common on embedded systems; for example, an x86 machine running a toolchain that has also been built on an x86 machine but producing binaries to run on a different architecture, like ARM.

Cross-native: This is typically the toolchain running on targets. An example of this is where a toolchain has been built on an x86 machine but runs on ARM and produces

Canadian: Rarely seen, this is where the build, host, and target machines are all different.

Charles C.
  • 3,725
  • 4
  • 28
  • 50