问题
I'm trying to build a Yocto image but the build fails when compiling glibc.
If I run just
bitbake glibc -c compile
I get a compilation error as follows:
/usr/src/debug/glibc/2.27-r0/git/nptl/pthread_atfork.c:51: undefined reference to `__dso_handle'
| /media/g/01D476BE2E4F26B0/AT91/SAMA5D27_SOM1/yocto/poky/build-microchip/tmp/work/cortexa5hf-neon-poky-linux-gnueabi/glibc/2.27-r0/recipe-sysroot-native/usr/bin/arm-poky-linux-gnueabi.gcc-cross-initial-arm/../../libexec/arm-poky-linux-gnueabi.gcc-cross-initial-arm/gcc/arm-poky-linux-gnueabi/7.3.0/ld: /media/g/01D476BE2E4F26B0/AT91/SAMA5D27_SOM1/yocto/poky/build-microchip/tmp/work/cortexa5hf-neon-poky-linux-gnueabi/glibc/2.27-r0/build-arm-poky-linux-gnueabi/rt/librt.so: hidden symbol `__dso_handle' isn't defined
| /media/g/01D476BE2E4F26B0/AT91/SAMA5D27_SOM1/yocto/poky/build-microchip/tmp/work/cortexa5hf-neon-poky-linux-gnueabi/glibc/2.27-r0/recipe-sysroot-native/usr/bin/arm-poky-linux-gnueabi.gcc-cross-initial-arm/../../libexec/arm-poky-linux-gnueabi.gcc-cross-initial-arm/gcc/arm-poky-linux-gnueabi/7.3.0/ld: final link failed: Bad value
| collect2: error: ld returned 1 exit status
| ../Makerules:599: recipe for target '/media/g/01D476BE2E4F26B0/AT91/SAMA5D27_SOM1/yocto/poky/build-microchip/tmp/work/cortexa5hf-neon-poky-linux-gnueabi/glibc/2.27-r0/build-arm-poky-linux-gnueabi/rt/librt.so' failed
| make[2]: *** [/media/g/01D476BE2E4F26B0/AT91/SAMA5D27_SOM1/yocto/poky/build-microchip/tmp/work/cortexa5hf-neon-poky-linux-gnueabi/glibc/2.27-r0/build-arm-poky-linux-gnueabi/rt/librt.so] Error 1
| make[2]: Leaving directory '/media/g/01D476BE2E4F26B0/AT91/SAMA5D27_SOM1/yocto/poky/build-microchip/tmp/work/cortexa5hf-neon-poky-linux-gnueabi/glibc/2.27-r0/git/rt'
| Makefile:235: recipe for target 'rt/others' failed
| make[1]: *** [rt/others] Error 2
| make[1]: Leaving directory '/media/g/01D476BE2E4F26B0/AT91/SAMA5D27_SOM1/yocto/poky/build-microchip/tmp/work/cortexa5hf-neon-poky-linux-gnueabi/glibc/2.27-r0/git'
| Makefile:9: recipe for target 'all' failed
| make: *** [all] Error 2
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_compile (log file is located at /media/g/01D476BE2E4F26B0/AT91/SAMA5D27_SOM1/yocto/poky/build-microchip/tmp/work/cortexa5hf-neon-poky-linux-gnueabi/glibc/2.27-r0/temp/log.do_compile.31096)
ERROR: Task (/media/g/01D476BE2E4F26B0/AT91/SAMA5D27_SOM1/yocto/poky/meta/recipes-core/glibc/glibc_2.27.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 227 tasks of which 226 didn't need to be rerun and 1 failed.
The glibc library is obviously very important so how can I resolved the compilation error?
回答1:
Get the package.
MACHINE=at91sam9rlek bitbake glibc
Clean
MACHINE=at91sam9rlek bitbake -c clean glibc
Compile the recipe
MACHINE=at91sam9rlek bitbake -f -c compile glibc
You can also specify the MACHINE definition. As I see, you use meta-atmel. You can set the MACHINE definition to according to your board.
**Note:**Be sure that your meta-atmel version macthes with open-embedded and yocto poky version. It can be the root cause. Please, share the results.
回答2:
I cloned the rocko verison of meta-atmel to yocto folder and I just compiled glibc recipe successfully with the following commnad.
MACHINE=sama5d27-som1-ek-sd bitbake -f -c compile glibc
Parsing recipes: 100% |######################################################################################################################################################################| Time: 0:01:17
Parsing of 2430 .bb files complete (0 cached, 2430 parsed). 3275 targets, 372 skipped, 37 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
Build Configuration:
BB_VERSION = "1.36.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "universal"
TARGET_SYS = "arm-poky-linux-gnueabi"
MACHINE = "sama5d27-som1-ek-sd"
DISTRO = "poky"
DISTRO_VERSION = "2.4.3"
TUNE_FEATURES = "arm armv7a vfp thumb neon callconvention-hard cortexa5"
TARGET_FPU = "hard"
meta
meta-poky
meta-yocto-bsp = "rocko:05711ba18587aaaf4a9c465a1dd4537f27ceda93"
meta-oe
meta-multimedia
meta-networking
meta-python = "rocko:eae996301d9c097bcbeb8046f08041dc82bb62f8"
meta-raspberrypi = "rocko:8e4c537d84fdde8e3b4642d0dda2c0f4af76d52f"
meta-ti = "rocko:8ba46625b0630b738724e6697fd3520116b082ef"
meta-freescale = "rocko:61ab34ac6d664a229847b796ec20fd9f7c8ecbf4"
meta-qt5 = "rocko:682ad61c071a9710e9f9d8a32ab1b5f3c14953d1"
meta-solidrun-arm-imx6 = "rocko:d567d75be8984bd868df9af6108f12fecb049c2d"
meta-atmel = "rocko:f71ed8ade26b4f26f00b624bf1b6fdc6e6c4aaf0"
NOTE: Tainting hash to force rebuild of task /home/eren/poky-rocko/meta/recipes-core/glibc/glibc_2.26.bb, do_compile | ETA: 0:00:00
WARNING: /home/eren/poky-rocko/meta/recipes-core/glibc/glibc_2.26.bb.do_compile is tainted from a forced run | ETA: 0:00:00
Initialising tasks: 100% |###################################################################################################################################################################| Time: 0:00:00
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
NOTE: Tasks Summary: Attempted 219 tasks of which 187 didn't need to be rerun and all succeeded.
Summary: There was 1 WARNING message shown
I think you problem is, your build environment is not clean or you do not use the same version of meta-atmel, open-embedded and poky or any depended meta.
来源:https://stackoverflow.com/questions/53426734/yocto-bitbake-glibc-build-fails