[Buildroot] Analysis of build failures

Ricardo Martincoski ricardo.martincoski at gmail.com
Sat Jan 23 12:33:20 UTC 2016


On Fri, 22 Jan 2016 10:29:57 +0100, Thomas Petazzoni wrote:
>>         i686 |               libsoil-20080707 | NOK | http://autobuild.buildroot.net/results/8ff91ab8e52000eb34dd8f662520cf1b31490cf5/
>>       x86_64 |               libsoil-20080707 | NOK | http://autobuild.buildroot.net/results/ea77d6b23aca0cb1cf527e6c16ddf5eba957a69c/
> 
> These are really weird. The patch doesn't apply when the build takes
> place on my build server, but it does apply when I test things locally
> on my machine. A difference in the version of patch ?

This error occurs when applying a patch that changes a file with spaces
in the name.
When applying a patch generated by diff v3.3 (the newest version [2]),
the tool patch needs to be version 2.7 or any later to ensure any patch
will be applied.
libsoil is the only package today that patches a file with space in the
name.


Using patch v2.6:
Hunk #1 FAILED at 1.
Hunk #2 FAILED at 23.
2 out of 2 hunks FAILED -- saving rejects to file 'projects/makefile/alternate Makefile.txt".rej'
Patch failed!  Please fix 0001-fix-makefile.patch!

Using patch v2.6.1:
can't find file to patch at input line 11
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|Various makefile fixes to allow cross compilation
|
|Partly ported from
|http://anonscm.debian.org/cgit/pkg-games/libsoil.git/tree/debian/patches/linking_correctly.patch
|
|Signed-off-by: Bernd Kuhls <bernd.kuhls at t-online.de>
|
|diff -uNr "soil.org/projects/makefile/alternate Makefile.txt" "soil/projects/makefile/alternate Makefile.txt"
|--- "soil.org/projects/makefile/alternate Makefile.txt"	2008-07-07 18:13:28.000000000 +0200
|+++ "soil/projects/makefile/alternate Makefile.txt"	2015-11-07 11:15:04.140106336 +0100
--------------------------
No file to patch.  Skipping patch.
2 out of 2 hunks ignored
Patch failed!  Please fix 0001-fix-makefile.patch!


The output of "diff -purN" when there are spaces in the name of a
changed file depends on the tool version:
diff <= v3.2 does not add double quotes to filenames
diff >= v3.3 adds double quotes to filenames

The tool 'patch' can handle patches with spaces in the name of a
changed file depending on the tool version:
patch >= 2.5.9 can handle unquoted filenames
patch >= 2.7 can handle both quoted and unquoted filenames


Solution 1: Add patch >= 2.7 as prerequisite to the manual (patch v2.7
is from 2012 [2]).
http://patchwork.ozlabs.org/patch/572097/

Solution 2: Add patch >= 2.5.9 as prerequisite to the manual (patch
v2.5.9 is from 2004 [2]), address on the manual
'Format and licensing of the package patches' the workaround needed when
a file changed by a patch has spaces in its name, apply the workaround
to libsoil (either use diff 3.2 or manually remove the quotes from the
filename inside the patch).

Solution 3: Create host-patch. Almost every package would depend on it.
I don't known if it would be feasible since gcc has patches.


[1] http://ftp.gnu.org/gnu/diffutils/
[2] http://ftp.gnu.org/gnu/patch/

I didn't investigate other formats of patch, e.g. git patch.

Regards,
Ricardo


More information about the buildroot mailing list