Hi Alex, thank you so much for your quick reply.

In fact, I just modified the linux-yocto_5.0.bb file directly:

~/code/poky_new/poky$ git diff meta/recipes-kernel/linux/linux-yocto_5.0.bb
Diff --git a/meta/recipes-kernel/linux/linux-yocto_5.0.bb
b/meta/recipes-kernel/linux/linux-yocto_5.0.bb
Index ae8f643e9f04..64180919227d 100644
--- a/meta/recipes-kernel/linux/linux-yocto_5.0.bb
+++ b/meta/recipes-kernel/linux/linux-yocto_5.0.bb
@@ -31,7 +31,7 @@ LIC_FILES_CHKSUM =
"file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
 LINUX_VERSION ?= "5.0.7"

 DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}"
-DEPENDS += "openssl-native util-    linux-native"
+DEPENDS += "openssl-native util-linux-native pkgconfig-native
glib-2.0-native zlib-native"

 PV = "${LINUX_VERSION}+git${SRCPV}"

Related dependencies, such as pkgconfig, glib-2.0 and zlib, have been added
above, since kallsyms was built during kernel compilation, I think they
should are all build-time native dependencies.

The key point now is that the PKG_CONFIG_PATH variable contains the
relevant directory for the recipe-sysroot, but the required glib-2.0.pc
file is placed naturally under the recipe-sysroot-native subdirectory.
So I need to find a way to add the recipe-sysroot-native subdirectory to
PKG_CONFIG_PATH, so that pkg-config tool can find the glib-2.0.pc file.

Alexander Kanavin <alex.kana...@gmail.com> 于2019年5月14日周二 下午6:12写道:

> You probably need to add a dependency on glib-2.0 to your recipe, then
> the needed pkgconfig will be in the target sysroot.
>
> If you can copy-paste the entire recipe, that would help.
>
> Alex
>
> On Tue, 14 May 2019 at 11:06, Tong Chen <yih...@gmail.com> wrote:
> >
> > Hi all:
> > I'm adding some kernel extensions to poky. In summary, I need to extend
> kallsyms, and the new functionality depends on glib-2.0.
> > So I added pkg-confi in the ./scripts/Makefile:
> >
> > HOSTCFLAGS_kallsyms.o := $(shell pkg-config --cflags glib-2.0)
> -I$(srctree)/scripts
> > HOSTLDLIBS_kallsyms := $(shell pkg-config --libs glib-2.0) -ldw
> >
> > But when compiling with bitbake, the following error occurs:
> >
> > | Package glib-2.0 was not found in the pkg-config search path.
> > | Perhaps you should add the directory containing `glib-2.0.pc'
> > | to the PKG_CONFIG_PATH environment variable
> > | No package 'glib-2.0' found
> >
> > Extrat the setting of PKG_CONFIG_PATH from temp/run.do_compile:
> >
> > Export
> PKG_CONFIG_PATH="/home/hchan/code/poky_new/poky/build_ctd/tmp/work/qemux86_64-poky-linux/linux-yocto/5.0.7+gitAUTOINC+d26eec23cf_891531d68e-r0/recipe-sysroot/usr/lib/pkgconfig
> :/home/hchan/code/poky_new/poky/build_ctd/tmp/work/qemux86_64-poky-linux/linux-yocto/5.0.7+gitAUTOINC+d26eec23cf_891531d68e-r0/recipe-sysroot/usr/share/pkgconfig"
> >
> > Look at the recipe-sysroot directory, where there is no corresponding
> glib-2.0.pc file, but in the recipe-sysroot-native directory, there is:
> >
> > ./recipe-sysroot-native/usr/lib/pkgconfig/glib-2.0.pc
> >
> > So my question is how to insert recipe-sysroot-native directory to
> PKG_CONFIG_PATH variable?
> >
> > I am not particularly familiar with poky/bitbake at the moment. By
> searching, I found these assignments. But not sure where to add it, and how
> to add:
> >
> > Hchan@hchan-ThinkPad:~/code/poky_new/poky$ grep --color -rnH 'export
> PKG_CONFIG_PATH=' ./meta*
> > ./meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config-native.in:3:export
> PKG_CONFIG_PATH="@PATH_NATIVE@"
> > ./meta/recipes-devtools/qemu/qemu.inc:85: export
> PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$BHOST_PKGCONFIG_PATH
> > ./meta/classes/toolchain-scripts.bbclass:49: echo 'export
> PKG_CONFIG_PATH=$SDKTARGETSYSROOT'"$libdir"'/pkgconfig:$SDKTARGETSYSROOT'"$prefix"'/share/pkgconfig'
> >> $script
> > ./meta/classes/toolchain-scripts.bbclass:72: echo 'export
> PKG_CONFIG_PATH=${PKG_CONFIG_PATH}' >> $script
> >
> > --
> > Tom
> >
> > --
> > _______________________________________________
> > linux-yocto mailing list
> > linux-yocto@yoctoproject.org
> > https://lists.yoctoproject.org/listinfo/linux-yocto
>


-- 
Yihe Chen(陈统)
+86 153 1193 5295
http://www.juliantec.info/julblog/yihect
中国北京西城区玉桃园三区
-- 
_______________________________________________
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto

Reply via email to