Bug 14444

Summary: [multilib] lib32-core-image-minimal -c populate_sdk failure on dunfell
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Arun P Madhavan <arunpm04>
Component: coreAssignee: Steve Sakoman <steve>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: Medium+ CC: meta.mr.watcher, meta.watcher, poky.bs.watcher, poky.watcher, raj.khem, randy.macleod, richard.purdie
Version: 3.1.11   
Target Milestone: 3.1.11   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description Arun P Madhavan 2021-06-17 17:30:31 UTC
Preconditions/Environment
-------------------------
Build machine: Linux USERABC 5.4.0-74-generic #83-Ubuntu SMP Sat May 8 02:35:39 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
git clone -b dunfell git://git.yoctoproject.org/poky.git
cd poky
source oe-init-build-env
Enable multilib configuration in conf/local.conf by appending below details.

MACHINE = "qemux86-64"
require conf/multilib.conf
MULTILIBS = "multilib:lib32"
DEFAULTTUNE_virtclass-multilib-lib32 = "x86"
IMAGE_INSTALL_append = " lib32-glib-2.0"

Triggering Action/Cause
-----------------------
bitbake lib32-core-image-minimal -c populate_sdk

Expectation
-----------
Build shall succeed without any error and SDK shall be generated.

Actual Result
-------------
VM2[16/Jun|22:45:40]build$ bitbake lib32-core-image-minimal -c populate_sdk
Loading cache: 100% |##############################################################################################################################################################################| Time: 0:00:00
Loaded 2093 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "1.46.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "x86_64-poky-linux"
MACHINE              = "qemux86-64"
DISTRO               = "poky"
DISTRO_VERSION       = "3.1.8"
TUNE_FEATURES        = "m64 core2"
TARGET_FPU           = ""
meta
meta-poky
meta-yocto-bsp       = "dunfell:26428489f4ed53a4774d669f5ed28ccd0184be8c"

ERROR: Task do_populate_sdk does not exist for target lib32-core-image-minimal (virtual:multilib:lib32:/home/USERABC/codebase/poky/meta/recipes-core/images/core-image-minimal.bb:do_populate_sdk). Close matches:
  do_populate_lic_deploy
ERROR: Command execution failed: 1

Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
VM2[16/Jun|22:46:34]build$

Reproducibility
---------------
5/5
Comment 1 Khem Raj 2021-06-20 21:47:03 UTC
patch is on mailing list
Comment 2 Khem Raj 2021-06-20 21:47:59 UTC
patch is on mailing list
Comment 3 Arun P Madhavan 2021-06-24 14:17:39 UTC
Cherrypicked related change-set and gave a try.
With that SDK is being generated but the SDK is not picking the MULTILIB version of packages.
Meaning; if we try to cross compile any sample application on a Host machine using SDK which has any MULTILIB package dependency; then it will fail saying that package is not found.

Eg: Tried cross-compiling a very basic gstreamer sample application with the SDK generated.

......................................
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PkgConfig: /opt/poky/2.0/sysroots/x86_64-poky-linux/usr/bin/pkg-config (found version "0.29.2") 
-- Checking for module 'gstreamer-1.0'
--   No package 'gstreamer-1.0' found
-- Could NOT find PC_GSTREAMER (missing: PC_GSTREAMER_FOUND) 
-- Configuring done
CMake Error at CMakeLists.txt:21 (add_executable):
  Target "gstSampleNativeApp" links to target
  "GStreamer::GStreamer" but the target was not found.  Perhaps a
  find_package() call is missing for an IMPORTED target, or an ALIAS target
  is missing?
-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.
......................................

If we verify PKG_CONFIG_PATH; it seems pointing to proper locations:
......................................
dunfell@dunfell-VirtualBox:$ echo $PKG_CONFIG_PATH 
/opt/poky/2.0/sysroots/aarch64-poky-linux/usr/lib/pkgconfig:/opt/poky/2.0/sysroots/aarch64-poky-linux/usr/share/pkgconfig
......................................

Search for pkgconfig in the SDK installed path:
......................................
dunfell@dunfell-VirtualBox:/opt/poky$ find ./ -iname "pkgconfig"
./2.0/sysroots/aarch64-poky-linux/usr/lib64/pkgconfig
dunfell@dunfell-VirtualBox:/opt/poky$
......................................
Comment 5 Randy MacLeod 2021-08-19 15:25:19 UTC
The patch may have enabled building but not regular usage so there may be more work to do in master according to Richard.
Comment 6 Steve Sakoman 2021-08-19 17:38:06 UTC
(In reply to comment #3)
> Cherrypicked related change-set and gave a try.
> With that SDK is being generated but the SDK is not picking the MULTILIB
> version of packages.
> Meaning; if we try to cross compile any sample application on a Host machine
> using SDK which has any MULTILIB package dependency; then it will fail
> saying that package is not found.
> 
> Eg: Tried cross-compiling a very basic gstreamer sample application with the
> SDK generated.
> 
> ......................................
> -- Detecting C compile features
> -- Detecting C compile features - done
> -- Found PkgConfig:
> /opt/poky/2.0/sysroots/x86_64-poky-linux/usr/bin/pkg-config (found version
> "0.29.2") 
> -- Checking for module 'gstreamer-1.0'
> --   No package 'gstreamer-1.0' found
> -- Could NOT find PC_GSTREAMER (missing: PC_GSTREAMER_FOUND) 
> -- Configuring done
> CMake Error at CMakeLists.txt:21 (add_executable):
>   Target "gstSampleNativeApp" links to target
>   "GStreamer::GStreamer" but the target was not found.  Perhaps a
>   find_package() call is missing for an IMPORTED target, or an ALIAS target
>   is missing?
> -- Generating done
> CMake Generate step failed.  Build files cannot be regenerated correctly.
> ......................................
> 
> If we verify PKG_CONFIG_PATH; it seems pointing to proper locations:
> ......................................
> dunfell@dunfell-VirtualBox:$ echo $PKG_CONFIG_PATH 
> /opt/poky/2.0/sysroots/aarch64-poky-linux/usr/lib/pkgconfig:/opt/poky/2.0/
> sysroots/aarch64-poky-linux/usr/share/pkgconfig
> ......................................
> 
> Search for pkgconfig in the SDK installed path:
> ......................................
> dunfell@dunfell-VirtualBox:/opt/poky$ find ./ -iname "pkgconfig"
> ./2.0/sysroots/aarch64-poky-linux/usr/lib64/pkgconfig
> dunfell@dunfell-VirtualBox:/opt/poky$
> ......................................

Can you point me to the source for the sample app you are trying to compile so that I can try to reproduce this?  Have you tried this with master branch? I suspect the issue is also present there.
Comment 7 Arun P Madhavan 2021-08-28 16:29:52 UTC
Sorry for the delay.
Please find the sample application repo https://github.com/arun-madhavan-013/gstreamer-channelchange-testapp
I didn't tried with master but there also same issue will be present.
Most of our product stacks are based on dunfell hence we are more focused in it.

Regards,
Arun
Comment 8 Steve Sakoman 2021-08-31 17:07:35 UTC
I tried this on master and encountered the same "No package 'gstreamer-1.0' found" error.

However I think this is because core-image-minimal does not include gstreamer-1.0

So to test this I modified your local.conf changes to include gstreamer in the image:

MACHINE = "qemux86-64"
require conf/multilib.conf
MULTILIBS = "multilib:lib32"
DEFAULTTUNE:virtclass-multilib-lib32 = "x86"
IMAGE_INSTALL:append = " lib32-glib-2.0 lib32-gstreamer1.0"

(note the use of colons for the master branch, if trying this on dunfell remember to use underscores)

I rebuilt and installed the sdk and tried your test app once more.  This time gstreamer is found:

-- Checking for module 'gstreamer-1.0'
--   Found gstreamer-1.0, version 1.18.4

And a subsequent make command builds the app successfully.

However there is the following cmake warning, which may or may not be an issue:

CMake Warning (dev) at /opt/poky/3.3+snapshot/sysroots/x86_64-pokysdk-linux/usr/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args`
  (PC_GSTREAMER) does not match the name of the calling package (GStreamer).
  This can lead to problems in calling code that expects `find_package`
  result variables (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/FindGStreamer.cmake:29 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:11 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

Let me know if this resolves the issue for you.
Comment 9 Arun P Madhavan 2021-08-31 21:33:43 UTC
Thank you for confirming on master.

I'll try and share feedback on latest dunfell as it is what our product stack is based on and gstreamer and glib is part of our final image(its not core-image-minimal).

By any chance; do you know which change fixed this root issue (failure of populate_sdk)?
Comment 10 Steve Sakoman 2021-08-31 22:34:24 UTC
Richard posted a link to the fix in master in one of the previous comments above.

I cherry-picked the same fix into dunfell:

https://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?h=dunfell&id=ed4791c8b05d02edb783359656376216b98c1c49
Comment 11 Richard Purdie 2021-09-01 10:57:12 UTC
Steve: From other reports/memories, I think this is still broken on master but I haven't been able to prove that or debug it. I'm nervous about taking the breakage back to dunfell.
Comment 12 Richard Purdie 2021-09-01 10:58:26 UTC
(In reply to comment #11)
> Steve: From other reports/memories, I think this is still broken on master
> but I haven't been able to prove that or debug it. I'm nervous about taking
> the breakage back to dunfell.

Although you're saying you have this working so perhaps it is fine. Not sure, just nervous.
Comment 13 Steve Sakoman 2021-09-01 14:15:28 UTC
Yes, with the fix the original reported sdk build issue is resolved. The secondary issue reported here appears to be related to attempting to build a test app that requires a package not included in the sdk image (gstreamer). Adding this package resolves that issue and the test app build completes.

Let's see if Arun can confirm that all of issues are resolved.
Comment 14 Steve Sakoman 2021-09-02 14:15:10 UTC
It appears that dunfell should also have "sdk: Decouple default install path from built in path": https://git.openembedded.org/openembedded-core/commit/?id=bc4ee5453560dcefc4a4ecc5657df5cc1666e153

Otherwise there will be a large number of sed errors at sdk installation due to undefined  SDK_BUILD_PATH.
Comment 15 Arun P Madhavan 2021-09-06 18:53:55 UTC
Hi Team,

I cloned poky dunfell and the SDK generation worked after cherry-picking following change that you have suggested.
Able to verify SDK by building the same sample application.

https://git.openembedded.org/openembedded-core/commit/?id=bc4ee5453560dcefc4a4ecc5657df5cc1666e153

I'll get these changes in our product stack and confirm how that is going with.

Appreciate your support !!!
Thank you.

-----------------------------------------------------------
bitbake lib32-core-image-minimal -c populate_sdk
Parsing recipes: 100% |#########################################################################################################################################################################################################################################| Time: 0:00:27
Parsing of 774 .bb files complete (0 cached, 774 parsed). 2093 targets, 109 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "1.46.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "ubuntu-18.04"
TARGET_SYS           = "x86_64-poky-linux"
MACHINE              = "qemux86-64"
DISTRO               = "poky"
DISTRO_VERSION       = "3.1.10"
TUNE_FEATURES        = "m64 core2"
TARGET_FPU           = ""
meta
meta-poky
meta-yocto-bsp       = "dunfell:bdd30be1a3815f70062d8febca91eaf042a77c3d"

NOTE: Fetching uninative binary shim http://downloads.yoctoproject.org/releases/uninative/3.2/x86_64-nativesdk-libc.tar.xz;sha256sum=3ee8c7d55e2d4c7ae3887cddb97219f97b94efddfeee2e24923c0cb0e8ce84c6 (will check PREMIRRORS first)
Initialising tasks: 100% |######################################################################################################################################################################################################################################| Time: 0:00:04
Sstate summary: Wanted 1650 Found 0 Missed 1650 Current 0 (0% match, 0% complete)
NOTE: Executing Tasks
NOTE: Tasks Summary: Attempted 4751 tasks of which 0 didn't need to be rerun and all succeeded. 
-----------------------------------------------------------