Need help applying MinGW patches for std string, getting unexpected ends

荒凉一梦 提交于 2019-12-13 02:54:25

问题


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!


回答1:


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.




回答2:


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


来源:https://stackoverflow.com/questions/15991290/need-help-applying-mingw-patches-for-std-string-getting-unexpected-ends

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!