Bug 12337 - PKG_CONFIG_PATH not read correctly from SDK environment
Summary: PKG_CONFIG_PATH not read correctly from SDK environment
Status: CLOSED OBSOLETE
Alias: None
Product: Eclipse Plugin
Classification: Yocto Project Subprojects
Component: eclipse-plugin (show other bugs)
Version: 2.4
Hardware: All Multiple
: Medium+ normal
Target Milestone: 4.99
Assignee: Chin Huat Ang
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2017-11-12 10:29 UTC by Dennis Menschel
Modified: 2019-08-29 15:17 UTC (History)
5 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Menschel 2017-11-12 10:29:30 UTC
Preconditions/Environment
-------------------------
Eclipse: Oxygen.1a Release (4.7.1a)
Yocto Project SDK Plugin: 1.4.1.201710162310
SDK: http://downloads.yoctoproject.org/releases/yocto/yocto-2.4/toolchain/x86_64/poky-glibc-x86_64-core-image-minimal-cortexa8hf-neon-toolchain-ext-2.4.sh

Triggering Action/Cause
-----------------------
1. Install SDK.
2. Configure Eclipse to use the SDK.
3. Create new "C++ Project", select "Yocto Project SDK Autotools Project" and then "Hello World C++ Autotools Project".
4. Select "Project", "Properties", "C/C++ Build", "Environment" and take a look at PKG_CONFIG_PATH.

Expectation
-----------
PKG_CONFIG_PATH should have been set to "$SDKTARGETSYSROOT/usr/lib/pkgconfig:$SDKTARGETSYSROOT/usr/share/pkgconfig".

Actual Result
-------------
PKG_CONFIG_PATH is set to "$SDKTARGETSYSROOT/usr/lib/pkgconfig".

Reproducibility
---------------
Always.
Comment 1 Ross Burton 2017-11-16 15:48:41 UTC
meta/classes/toolchain-scripts.bbclass:

echo 'export PKG_CONFIG_PATH=$SDKTARGETSYSROOT'"$libdir"'/pkgconfig:$SDKTARGETSYSROOT'"$prefix"'/share/pkgconfig' >> $script

This was fixed in oe-core 1bea760f3f462fdcc3eefc0d8597688d61447ddd which is in morty/pyro/rocko.

So maybe this is an Eclipse thing after all.
Comment 2 Dennis Menschel 2017-11-18 12:49:16 UTC
Examining the current master of eclipse-poky (126e707a6de212feeaaf093edc170aaa74192ce7) reveals the following:

$ git grep -n PKG_CONFIG_PATH
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java:164:                   } else if (sKey.matches("PKG_CONFIG_PATH")) {
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java:174:                   else if (sKey.matches("PKG_CONFIG_PATH"))

$ head -n 171 plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java | tail -n 8                                                                   ~/projects/foreign/eclipse-poky
                        } else if (sKey.matches("PKG_CONFIG_PATH")) {
                                sValue = elem.getStrSysrootLoc();
                                targetFilePath = elem.getStrSysrootLoc() + "/" + elem.getStrTarget();
                                targetFile = new File(targetFilePath);
                                if (targetFile.exists())
                                        sValue = sValue + "/" + elem.getStrTarget();
                                sValue = sValue + "/usr/lib/pkgconfig";
                        }

From what I can tell, the actual value of the environment variable PKG_CONFIG_PATH is not read at all, but instead constructed by concatenating <sysroot location>, <target> and the hardcoded string "/usr/lib/pkgconfig". This would also explain why the second path "$SDKTARGETSYSROOT/usr/share/pkgconfig" is entirely missing.
Comment 3 brian avery 2017-12-08 22:15:44 UTC
Moving to Chin Huat.
Comment 4 Armin Kuster 2019-08-29 15:16:01 UTC
Eclipse got dropped from project support.
Comment 5 Armin Kuster 2019-08-29 15:17:25 UTC
closing