Skip to contentSkip to conversation

Issue generating working sdk containing Clang (meta-clang) and package_deb for compiling eBPF #sdk #dunfell #yocto #kernel #linux

DISCUSSION msg board 2 participants 2 messages Mar 25, 2021 – Apr 4, 2021

lore
Share & tools
lore

msg board

author
#0 lore raw

Hello,

I need Clang compiler apart from currently available default gcc compiler as I am trying to compile eBPF which will run on my custom yocto which is based on core-image-minimal. Therefore I added Clang compiler to my yocto sdk build using the meta-clang layer available at https://github.com/kraj/meta-clang. My yocto is based on dunfell and uses package_deb inside local.conf. SDK compilation succeeded with command "bitbake <mycustomdistro> -c populate_sdk " but while installation on host there errors similar to the ones mentioned in this issue ( https://github.com/kraj/meta-clang/issues/119 ).  Therefore, I removed the LDFLAGS_append_class-nativesdk = " -fuse-ld=gold" line from clang_git.bb and compiled. This gave me errors related to this issue ( https://stackoverflow.com/questions/60058817/bitbake-populate-sdk-for-image-fails-with-error ). Therefore, I added package_ipk and also kept package_deb . The compilation was successful but there was one warning as below :

-------------------------

<CUSTOMDISTRO> do_populate_sdk: Unable to install packages. Command <Path>/opkg --volatile-cache -f <Path>/opkg.conf -t <Path>/sysroots/core2-64-poky-linux --force-postinstall --prefer-arch-to-version install <Long list of space seperate package names> returned 1

Collected errors: Solver encountered 1 problem(s) ....

-------------------------

The installation of on host was successful

When I tried to use the sdk to compile eBPF, I got errors mentioning that the sysroot does not contain /usr/include/gelf.h . After looking I saw that elfutils-dev tools were not installed. elfutils-dev would have installed gelf.h. in /usr/include of sysroot.

Without the addition of Clang I was able to generate working sdk with just package_deb in local.conf.

#1 lore raw

Hi

Can you try this patch ( if you are using master ) and see if that helps

(quoted diff) +0 -0

b/recipes-devtools/clang/clang_git.bb
index b8986be..b0c81f1 100644

recipes-devtools/clang/clang_git.bb +0 -0
@@ -15,7 +15,6 @@ BUILD_CXX_class-nativesdk = "clang++"

BUILD_AR_class-nativesdk = "llvm-ar"
BUILD_RANLIB_class-nativesdk = "llvm-ranlib"
BUILD_NM_class-nativesdk = "llvm-nm"
-LDFLAGS_append_class-nativesdk = " -fuse-ld=lld"

inherit cmake cmake-native pkgconfig python3native

Quoted 28 lines · msg board

Hello,

I need Clang compiler apart from currently available default gcc compiler as I am trying to compile eBPF which will run on my custom yocto which is based on core-image-minimal. Therefore I added Clang compiler to my yocto sdk build using the meta-clang layer available at https://github.com/kraj/meta-clang . My yocto is based on dunfell and uses package_deb inside local.conf. SDK compilation succeeded with command "bitbake <mycustomdistro> -c populate_sdk " but while installation on host there errors similar to the ones mentioned in this issue . Therefore, I removed the LDFLAGS_append_class-nativesdk = " -fuse-ld=gold" line from clang_git.bb and compiled. This gave me errors related to this issue . Therefore, I added package_ipk and also kept package_deb . The compilation was successful but there was one warning as below :

-------------------------

<CUSTOMDISTRO> do_populate_sdk: Unable to install packages. Command <Path>/opkg --volatile-cache -f <Path>/opkg.conf -t <Path>/sysroots/core2-64-poky-linux --force-postinstall --prefer-arch-to-version install <Long list of space seperate package names> returned 1

Collected errors: Solver encountered 1 problem(s) ....

-------------------------

The installation of on host was successful

When I tried to use the sdk to compile eBPF, I got errors mentioning that the sysroot does not contain /usr/include/gelf.h . After looking I saw that elfutils-dev tools were not installed. elfutils-dev would have installed gelf.h. in /usr/include of sysroot.

Without the addition of Clang I was able to generate working sdk with just package_deb in local.conf.