Bug 8015

Summary: Debug source splitting breaks when externalsrc is enabled
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Paul Eggleton <bluelightning>
Component: devtools / tool chainAssignee: Alejandro <alejandro>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: alejandro, dompe, kergoth, meta.mr.watcher, meta.watcher, randy.macleod, stephano
Version: 1.8   
Target Milestone: 4.99   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Paul Eggleton 2015-07-15 14:22:07 UTC
If you enable externalsrc for a recipe, the debug source files are no longer packaged into the -dbg package during do_package. Digging into this a bit it seems like we may be passing the wrong path into debugedit, and thus the paths in the sources list produced at the end are invalid; however it doesn't seem to want to accept what ought to be the right path, so further investigation is needed.
Comment 1 Paul Eggleton 2015-07-15 14:25:09 UTC
Note that you can see this in action if you do the following:

1) enable buildhistory if it isn't already
2) bitbake mdadm
3) devtool modify mdadm -x /tmp/mdadm
4) bitbake mdadm
5) Examine the buildhistory changes - you should see the debug sources have vanished from the mdadm-dbg package.
Comment 2 Paul Eggleton 2016-02-23 03:47:45 UTC
It appears in master this has been fixed, I'm guessing possibly by one of these fixes (unconfirmed):

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=7a11650ebcb14f8a7cb810e2e6a05294fbccc57a
http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=351039f21a3896a937eef2ca87c3e49e8a7a02ce
Comment 3 Diego Dompe 2016-03-02 22:49:14 UTC
Hi,

I tried this, and I don't think it solve it. The problem seems to be that the logic of splitting that uses the debugedit is expecting the internal directory layout of the workspace. So when using external src you need to account for the changes S location.

See the changes we did for package.bbclass:
https://review.openswitch.net/#/c/4807/2/yocto/openswitch/meta-foss-openswitch/classes/package.bbclass

Also, the external src class should do something like:
-fdebug-prefix-map=${@d.getVar('S')}=/usr/src/debug/${BPN}/${PV}-${PR} to accommodate the links properly (we do this in our own class)

Anyone can suggest what would be the best way to fix this in mainstream (and add a test to devtool).
Comment 4 Paul Eggleton 2016-03-02 23:00:52 UTC
The odd thing is I couldn't reproduce the issue with master - i.e. doing devtool modify on mdadm didn't seem to make the debug source files disappear like it used to. It's possible I'm not replicating the conditions of the original test though. The suggestion that the patches I indicated above fixed it was purely speculation on my part.

Have you been able to verify the issue is still present on master?

With regard to your package.bbclass change, I'd like to think that if it is necessary we could come up with a way that looked at the directory paths being used and determined if the fixup was needed rather than checking explicitly for EXTERNALSRC being set.
Comment 5 Diego Dompe 2016-03-02 23:05:42 UTC
Indeed I was wondering why you couldn't reproduce the issue. I didn't setup a full environment with the master, but compared the debug split logic, and remains the same. I can tell for sure that the code to copy the debug sources won't work when the external src doesn't have the internal structure of the build system. I will try to find some time to create a test case with master, but I'm short on time right now.
Comment 6 Paul Eggleton 2016-03-02 23:11:19 UTC
OK, fair enough. Please do let me know what you find, and if the issue is still present let's reopen this and fix it as you suggest.

The debug splitting logic hasn't changed but the underlying tools (e.g. debugedit, compiler/linker) may have.
Comment 7 Christopher Larson 2017-12-08 19:55:38 UTC
This issue is definitely still present, copydebugsources and -fdebug-prefix-map both assume S is relative to WORKDIR, which isn't the case here.
Comment 8 Paul Eggleton 2018-05-20 15:31:53 UTC
This patch may fix the issue, but needs work:

https://patchwork.openembedded.org/patch/150819/