Need help applying MinGW patches for std string, g

2019-08-24 13:04发布

I'm trying to apply these patches:

http://tehsausage.com/mingw-to-string

So that I can use std string stuff that I should have access to anyways.

I have MinGW 4.7.2, and at first, I tried copying the zip files with no luck.

Now I'm trying to manually apply the patches. I copied the patch information into a file.patch, placed it in the same folder as the file I am patching, and ran

patch < file.patch

and then I get:

 patching file stdio.h
 patch unexpectedly ends in middle of line
 Hunk #1 FAILED at 574.
 patch unexpectedly ends in middle of line
 1 out of 1 hunk FAILED -- saving rejects to file stdio.h.rej
 patch unexpectedly ends in middle of line

I made sure that there is no extra white space at the end..

Please help!

2条回答
混吃等死
2楼-- · 2019-08-24 13:21

OK, installed the latest mingw from the web-site, downloaded the patch files and made sure they were clean.

I applied each one individually, and they worked without issue. There was a warning that it was 'Stripping the trailing CRs from the file', but it worked without issue.

each patch is applied in the appropriate directory; e.g. the stdio.patch is applied to stdio.h which is in /mingw/include using:

patch </path/to/stdio.patch

ditto for wchar.patch

The os_defines.h file is found at /mingw/lib/gcc/mingw32/4.7.2/include/c++/mingw32/bits, and the patch works properly for that one as well.

I created a github with the patches at https://github.com/petesh/mingwpatches.git - you can clone the repository, or download the individual files from there. Each of them should work correctly without more than a complaint about the trailing CR warning.

查看更多
Explosion°爆炸
3楼-- · 2019-08-24 13:29

After looking at the patch files, you probably need to use the -c option to the patch command. This tells patch that the patch-files are from a context diff.

E.g.

$ patch -c < file.patch
查看更多
登录 后发表回答