kraj / meta-clang

Clang C/C++ cross compiler and runtime for OpenEmbedded/Yocto Project
MIT License
151 stars 192 forks source link

cannot use oe-debuginfod with clang built code #956

Closed abuibrahim closed 4 days ago

abuibrahim commented 2 weeks ago

Describe the bug When trying to use the oe-debuginfod script as described in https://docs.yoctoproject.org/next/dev-manual/debugging.html#using-the-debuginfod-server-method to debug a Clang built recipe, no symbols/source can be found on remote servers from DEBUGINFOD_URLS

To Reproduce Steps to reproduce the behavior:

  1. Set TOOLCHAIN = "clang" and build core-image-minimal.
  2. Run the image inside qemu and make sure you can ping the host.
  3. On the host, run oe-debuginfod
  4. In the VM run export DEBUGINFOD_URLS="http://<your-host-ip>:8002/" ; gdb /bin/my-prog

Expected behavior You should see debug info and sources automatically downloaded during debuging session. This works when the same recipe is built with GCC.

It seems like the Clang built binaries miss the .note.gnu.build-id section

abuibrahim commented 2 weeks ago

Update - adding EXTRA_OECMAKE += "-DENABLE_LINKER_BUILD_ID=ON" fixed it, so perhaps an optional build-id knob could be added to PACKAGECONFIG for those who want to enable it.

kraj commented 2 weeks ago

Update - adding EXTRA_OECMAKE += "-DENABLE_LINKER_BUILD_ID=ON" fixed it, so perhaps an optional build-id knob could be added to PACKAGECONFIG for those who want to enable it.

Thanks for following up and root causing it, this option is enabled by default in GCC in oe-core, therefore we should add it as a packageconfig and also enable it by default. So there is an option for someone to disable it but default can be to enable it.