Bug 14991 - Cannot Patch Toolchain Files Using BR2_GLOBAL_PATCH_DIR
Summary: Cannot Patch Toolchain Files Using BR2_GLOBAL_PATCH_DIR
Status: RESOLVED MOVED
Alias: None
Product: buildroot
Classification: Unclassified
Component: Other (show other bugs)
Version: 2021.08
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-08 20:54 UTC by Michael Johnson
Modified: 2024-06-15 15:04 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Johnson 2022-09-08 20:54:38 UTC
I am attempting to patch include/c++/10.2.1/variant that gets built as part of buildroot to avoid a nvcc compiler issue my company is dealing with. In so doing, I wrote a patch file and placed it in 

/app/br2_external/patches/toolchain-external-arm-aarch64/2020.11/0000-std-variant-nvcc-compat.patch

Supplied the BR config BR2_GLOBAL_PATCH_DIR=/app/br2_external/patches

Then when building the toolchain with `make toolchain` my patch file is failing to find the appropriate path to variant. I dug into the final call that is being made by patch, and found the underlying command be run was:

    cat /app/br2_external/patches/toolchain-external-arm-aarch64/00-std-variant-nvcc-compat.patch | patch -g0 -p1 -E --no-backup-if-mismatch -d  /app/tmp/sources/buildroot/output/build/toolchain-external-arm-aarch64-2020.11 -t -N

The key here was the patch was attempting to run in the directory toolchain-external-arm-aarch64-2020.11

However, when I looked at `make V=1 toolchain`, I saw during toolchain-external-arm-aarch64 extraction phase, ALL of the src was moved from toolchain-external-arm-aarch64 to 
/app/tmp/sources/buildroot/output/host/*

Because the extraction moves the files to a different path AND patch uses -p1 (Which essentially breaks absolute paths in patch files), I am fairly confident there is no way to apply patches to the toolchain source files via the BR2_GLOBAL_PATCH_DIR mechanism. It would be AMAZING if this were to be possible! 

We are exploring forking BR as an alternative, changing the source URL of the gcc toolchain to provide an already-patched tarball rather than having buildroot patch at buildtime :/ 


We use BR 2021.08 today!
Comment 1 Yann E. MORIN 2024-06-15 15:04:17 UTC
Thank you for your report.

The issue tracker for the Buildroot project has been moved to
the Gitlab.com issue tracker:
    https://gitlab.com/buildroot.org/buildroot/-/issues

We are taking this opportunity to close old issues in this old
tracker. If you believe your issue is still relevant, please
open one in the new issue tracker.

Thank you!