{"id":51998,"date":"2024-12-03T17:06:21","date_gmt":"2024-12-03T09:06:21","guid":{"rendered":"https:\/\/fwq.ai\/blog\/51998\/"},"modified":"2024-12-03T17:06:21","modified_gmt":"2024-12-03T09:06:21","slug":"mingw%e8%83%bd%e4%b8%8d%e8%83%bd%e5%9c%a8linux%e4%b8%8a%e8%bf%90%e8%a1%8c","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/51998\/","title":{"rendered":"mingw\u80fd\u4e0d\u80fd\u5728linux\u4e0a\u8fd0\u884c"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>mingw\u80fd\u4e0d\u80fd\u5728linux\u4e0a\u8fd0\u884c<\/h1>\n<p>\u4e00\u5206\u8015\u8018\uff0c\u4e00\u5206\u6536\u83b7\uff01\u65e2\u7136\u90fd\u6253\u5f00\u8fd9\u7bc7<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300amingw\u80fd\u4e0d\u80fd\u5728linux\u4e0a\u8fd0\u884c\u300b<\/span>\uff0c\u5c31\u575a\u6301\u770b\u4e0b\u53bb\uff0c\u5b66\u4e0b\u53bb\u5427\uff01\u672c\u6587\u4e3b\u8981\u4f1a\u7ed9\u5927\u5bb6\u8bb2\u5230<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\u77e5\u8bc6\u70b9\uff0c\u5982\u679c\u5927\u5bb6\u5bf9\u672c\u6587\u6709\u597d\u7684\u5efa\u8bae\u6216\u8005\u770b\u5230\u6709\u4e0d\u8db3\u4e4b\u5904\uff0c\u975e\u5e38\u6b22\u8fce\u5927\u5bb6\u79ef\u6781\u63d0\u51fa\uff01\u5728\u540e\u7eed\u6587\u7ae0\u6211\u4f1a\u7ee7\u7eed\u66f4\u65b0<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u6587\u7ae0<\/span>\u76f8\u5173\u7684\u5185\u5bb9\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u90fd\u6709\u6240\u5e2e\u52a9\uff01<\/p>\n<\/p>\n<blockquote>\n<p>mingw\u80fd\u5728linux\u4e0a\u8fd0\u884c\u3002MinGW\u662f\u4e00\u4e2a\u53ef\u81ea\u7531\u4f7f\u7528\u548c\u81ea\u7531\u53d1\u5e03\u7684Windows\u7279\u5b9a\u5934\u6587\u4ef6\u548c\u4f7f\u7528GNU\u5de5\u5177\u96c6\u5bfc\u5165\u5e93\u7684\u96c6\u5408\uff0c\u53ef\u4ee5\u5141\u8bb8\u7528\u6237\u5728GNU\/Linux\u5e73\u53f0\u4e0a\u751f\u6210\u672c\u5730\u7684Windows\u7a0b\u5e8f\u800c\u4e0d\u9700\u8981\u7b2c\u4e09\u65b9C\u8fd0\u884c\u65f6\uff08C Runtime\uff09\u5e93\u3002<\/p>\n<\/blockquote>\n<p><strong>mingw\u662f\u4ec0\u4e48<\/strong><\/p>\n<p>MinGW\uff0c\u662fMinimalist GNU for Windows\u7684\u7f29\u5199\u3002\u5b83\u662f\u4e00\u4e2a\u53ef\u81ea\u7531\u4f7f\u7528\u548c\u81ea\u7531\u53d1\u5e03\u7684Windows\u7279\u5b9a\u5934\u6587\u4ef6\u548c\u4f7f\u7528GNU\u5de5\u5177\u96c6\u5bfc\u5165\u5e93\u7684\u96c6\u5408\uff0c\u5141\u8bb8\u4f60\u5728GNU\/Linux\u548cWindows\u5e73\u53f0\u751f\u6210\u672c\u5730\u7684Windows\u7a0b\u5e8f\u800c\u4e0d\u9700\u8981\u7b2c\u4e09\u65b9C\u8fd0\u884c\u65f6\uff08C Runtime\uff09\u5e93\u3002<\/p>\n<p>MinGW \u662f\u4e00\u7ec4\u5305\u542b\u6587\u4ef6\u548c\u7aef\u53e3\u5e93\uff0c\u5176\u529f\u80fd\u662f\u5141\u8bb8\u63a7\u5236\u53f0\u6a21\u5f0f\u7684\u7a0b\u5e8f\u4f7f\u7528\u5fae\u8f6f\u7684\u6807\u51c6C\u8fd0\u884c\u65f6\uff08C Runtime\uff09\u5e93\uff08MSVCRT.DLL\uff09\uff0c\u8be5\u5e93\u5728\u6240\u6709\u7684 NT OS \u4e0a\u6709\u6548\uff0c\u5728\u6240\u6709\u7684 Windows 95\u53d1\u884c\u7248\u4ee5\u4e0a\u7684 Windows OS \u6709\u6548\uff0c\u4f7f\u7528\u57fa\u672c\u8fd0\u884c\u65f6\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528 GCC \u5199\u63a7\u5236\u53f0\u6a21\u5f0f\u7684\u7b26\u5408\u7f8e\u56fd\u6807\u51c6\u5316\u7ec4\u7ec7\uff08ANSI\uff09\u7a0b\u5e8f\uff0c\u53ef\u4ee5\u4f7f\u7528\u5fae\u8f6f\u63d0\u4f9b\u7684 C \u8fd0\u884c\u65f6\uff08C Runtime\uff09\u6269\u5c55\uff0c\u4e0e\u57fa\u672c\u8fd0\u884c\u65f6\u76f8\u7ed3\u5408\uff0c\u5c31\u53ef\u4ee5\u6709\u5145\u5206\u7684\u6743\u5229\u65e2\u4f7f\u7528 CRT\uff08C Runtime\uff09\u53c8\u4f7f\u7528 WindowsAPI\u529f\u80fd\u3002<\/p>\n<p><strong>mingw\u80fd\u5728linux\u4e0a\u8fd0\u884c\u4e48<\/strong><\/p>\n<p><strong>mingw\u53ef\u4ee5\u5728Linux\u4e0a\u8fd0\u884c\u3002<\/strong>\u4ee5debian\u7cfb\u5217\u4e3a\u4f8b\uff0c\u53ef\u4ee5\u901a\u8fc7\u5982\u4e0b\u65b9\u6cd5\u67e5\u8be2\u5230mingw\u7684\u5b89\u88c5\u5305\uff0c\u6839\u636e\u9700\u8981\u5b89\u88c5\u5373\u53ef\u3002<\/p>\n<p>1\u3001\u67e5\u8be2mingw\u7684\u8fd0\u884c\u65f6\u5e93<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20240403\/1712154995660d697314d77.png\" class=\"aligncenter\" title=\"mingw\u80fd\u4e0d\u80fd\u5728linux\u4e0a\u8fd0\u884c\u63d2\u56fe\" alt=\"mingw\u80fd\u4e0d\u80fd\u5728linux\u4e0a\u8fd0\u884c\u63d2\u56fe\" \/><\/p>\n<p>2\u3001\u67e5\u8be2mingw\u7684\u5f00\u53d1\u73af\u5883<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20240403\/1712154995660d6973164fb.jpg\" class=\"aligncenter\" title=\"mingw\u80fd\u4e0d\u80fd\u5728linux\u4e0a\u8fd0\u884c\u63d2\u56fe1\" alt=\"mingw\u80fd\u4e0d\u80fd\u5728linux\u4e0a\u8fd0\u884c\u63d2\u56fe1\" \/><\/p>\n<p>3\u3001\u67e5\u8be2mingw\u6784\u5efa\u5305<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20240403\/1712154995660d6973197ed.jpg\" class=\"aligncenter\" title=\"mingw\u80fd\u4e0d\u80fd\u5728linux\u4e0a\u8fd0\u884c\u63d2\u56fe2\" alt=\"mingw\u80fd\u4e0d\u80fd\u5728linux\u4e0a\u8fd0\u884c\u63d2\u56fe2\" \/><\/p>\n<p>4\u3001\u9009\u62e9\u9002\u5408\u81ea\u5df1\u7684\u786c\u4ef6\u5e73\u53f0\u7684\u5305\u8fdb\u884c\u5b89\u88c5<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20240403\/1712154995660d69731c65c.jpg\" class=\"aligncenter\" title=\"mingw\u80fd\u4e0d\u80fd\u5728linux\u4e0a\u8fd0\u884c\u63d2\u56fe3\" alt=\"mingw\u80fd\u4e0d\u80fd\u5728linux\u4e0a\u8fd0\u884c\u63d2\u56fe3\" \/><\/p>\n<p><strong>Linux\u4e0b\u4f7f\u7528MinGW\u9759\u6001\u4ea4\u53c9\u7f16\u8bd1\u5e26\u6709zlib\u7684libcurl<\/strong><\/p>\n<p>libcurl\u662f\u4e00\u4e2a\u8de8\u5e73\u53f0\u7684\u3001\u6613\u7528\u7684\u3001\u5f3a\u5927\u7684\u7f51\u7edc\u5e93\u3002\u5728\u5927\u90e8\u5206Linux\u53d1\u884c\u7248\u4e2d\u90fd\u6709\u7f16\u8bd1\u597d\u7684\u4e8c\u8fdb\u5236\u5305\u53ef\u4f9b\u4f7f\u7528\uff0cMac\u7cfb\u7edf\u66f4\u662f\u5c06\u5176\u4f5c\u4e3a\u4e86\u4e00\u4e2a\u6838\u5fc3\u90e8\u4ef6\u3002\u4f46\u662f\u5728Windows\u5e73\u53f0\u4e0a\u5374\u9700\u8981\u624b\u5de5\u7f16\u8bd1\uff0c\u66f4\u4e0d\u5fc5\u8bf4\u4e00\u4e9b\u6709\u7279\u6b8a\u6d01\u7656\u7684\u4eba\uff08\u6bd4\u5982\u8bf4\u6211\uff09\u8fd8\u7279\u522b\u8ba8\u538c\u591a\u51fa\u6765\u51e0\u4e2aDLL,\u975e\u8981\u9759\u6001\u94fe\u63a5\u4e0d\u53ef\u3002\u672c\u6587\u4f5c\u4e3a\u6211\u4e24\u4e2a\u665a\u4e0a\u6298\u817e\u7ecf\u5386\u7684\u4e00\u4e2a\u5c0f\u5c0f\u603b\u7ed3\uff0c\u8bb2\u89e3\u5982\u4f55\u5728Linux\u4e0b\u4f7f\u7528MinGW\u7f16\u8bd1\u7ed9Windows\u4f7f\u7528\u7684libcurl\u9759\u6001\u5e93\u3002<\/p>\n<p><strong>STEP1 \u5b89\u88c5MinGW\u7f16\u8bd1\u5668<\/strong><\/p>\n<p>\u8fd9\u6b65\u6211\u4e0d\u6253\u7b97\u591a\u8bf4\uff0c\u5927\u90e8\u5206Linux\u53d1\u884c\u7248\u7684\u4ed3\u5e93\u5e94\u8be5\u90fd\u6709\uff0c\u4ee5\u6211\u7684ArchLinux\u4e3a\u4f8b\uff0c\u6267\u884c\uff1a<\/p>\n<pre>~#&nbsp;pacman&nbsp;-S&nbsp;mingw-w64<\/pre>\n<p>\u5373\u53ef\u3002\u5982\u679c\u4f60\u4e0d\u9700\u8981\u4ea4\u53c9\u7f16\u8bd1\uff0c\u8981\u5728Windows\u4e0a\u76f4\u63a5\u7f16\u8bd1\uff0c\u8bf7\u81ea\u884c\u53bbSourceForge\u4e0a\u4e0b\u8f7dWindows\u7248\u672c\u3002\u4e0d\u8981\u62c5\u5fc3\u90a3\u4e2a<code>w64<\/code>\u662f\u4e0d\u662f64\u4f4d\u7248\u672c\uff0c\u5b83\u65e2\u53ef\u4ee5\u7f16\u8bd132\u4f4d\u53c8\u53ef\u4ee5\u7f16\u8bd164\u4f4d\u7a0b\u5e8f\u3002\u8fd8\u662f\u4ee5\u6211\u7684\u7248\u672c\u4e3a\u4f8b:<\/p>\n<pre>~#&nbsp;pacman&nbsp;-Ql&nbsp;mingw-w64-gcc|&nbsp;grep&nbsp;'\/usr\/bin\/.*gcc$'\nmingw-w64-gcc&nbsp;\/usr\/bin\/i686-w64-mingw32-gcc\nmingw-w64-gcc&nbsp;\/usr\/bin\/x86_64-w64-mingw32-gcc<\/pre>\n<p>\u53ef\u4ee5\u770b\u5230\u6709\u4e24\u4e2agcc,\u7528<code>i686-w64-mingw32-gcc<\/code>\u7f16\u8bd1\u51fa\u6765\u7684\u7a0b\u5e8f\u5c31\u662f32\u4f4d\u7684\uff0c\u800c<code>x86_64-w64-mingw32-gcc<\/code>\u7f16\u8bd1\u51fa\u6765\u7684\u5c31\u662f64\u4f4d\u7684\u3002\u73b0\u5728\uff0c\u968f\u4fbf\u5199\u4e2aHello World\uff08\u4f60\u53ef\u4ee5\u7528\u6211\u7684Hello World\u4ee3\u7801 ^_^\uff09\uff0c\u7136\u540e\u7f16\u8bd1\u8bd5\u8bd5\uff1a<\/p>\n<pre>i686-w64-mingw32-gcc&nbsp;hello_world.c&nbsp;-o&nbsp;hello_world.exe<\/pre>\n<p>\u628a\u5b83\u62ff\u5230\u865a\u62df\u673a\u6216\u6254\u8fdbWine\u91cc\uff0c\u5982\u679c\u80fd\u6b63\u5e38\u8fd0\u884c\uff0c\u90a3\u4e48\u606d\u559c\u4f60\uff0c\u7b2c\u4e00\u6b65\u5b8c\u6210\u4e86\u3002<\/p>\n<p><strong>STEP2 \u4e0b\u8f7d\u6e90\u7801<\/strong><\/p>\n<p>\u5f88\u7b80\u5355\u7684\u6b65\u9aa4\uff0c\u5982\u679c\u81ea\u5df1\u641e\u4e0d\u5b9a\u7684\u5efa\u8bae\u76f4\u63a5\u53f3\u4e0a\u89d2\u3002<\/p>\n<ul>\n<li>\n<p>LibCurl\uff1a\u6700\u4e0a\u9762\u7684Source Archives<\/p>\n<\/li>\n<li>\n<p>zLib\uff1a\u8bf7\u4e0bSource Code<\/p>\n<\/li>\n<li>\n<p>OpenSSL\uff1a\u53ef\u9009\uff0c\u5982\u679c\u6ca1\u6709\u5fc5\u8981\u5c31\u4e0d\u8981\u7f16\u8bd1\uff0c\u4f1a\u6781\u5927\u5730\u589e\u52a0\u6587\u4ef6\u4f53\u79ef<\/p>\n<\/li>\n<\/ul>\n<p>\u628a<code>curl-7.35.0<\/code>\u548c<code>zlib-1.2.8<\/code>(\u53ef\u80fd\u8fd8\u6709<code>openssl-1.0.1f<\/code>)\u8fd9\u51e0\u4e2a\u6587\u4ef6\u5939\u653e\u5728\u540c\u4e00\u4e2a\u76ee\u5f55\u4e0b\uff0c\u7136\u540e\u8fdb\u884c\u4e0b\u4e00\u6b65\u3002<\/p>\n<p><strong>STEP3 \u7f16\u8bd1\u6e90\u7801<\/strong><\/p>\n<p>\u5148\u6253\u5f00<code>zlib\/win32<\/code>\u6587\u4ef6\u5939\u4e0b\u7684<code>Makefile.gcc<\/code>\u6587\u4ef6,\u628a<code>PREFIX =<\/code>\u8fd9\u884c\u6539\u6210STEP1\u91cc\u7684gcc\u524d\u7f00\uff0c\u5bf9\u4e8e\u6211\u6765\u8bf4\u5c31\u662f<code>PREFIX = i686-w64-mingw32-<\/code>\u3002\u628a\u8fd9\u4e2a\u6587\u4ef6\u62f7\u8d1d\u5230<code>zlib<\/code>\u6587\u4ef6\u5939\u4e0b\uff0c\u7136\u540e\u5728<code>zlib<\/code>\u6587\u4ef6\u5939\u4e0b<code>make -f Makefile.gcc<\/code>\uff0c\u4f60\u5c31\u5e94\u8be5\u80fd\u770b\u5230<code>libz.a<\/code>\u8fd9\u4e2a\u6587\u4ef6\u4e86\u3002<\/p>\n<p>\u5982\u679c\u4f60\u8981\u7f16\u8bd1OpenSSL,\u90a3\u4e48\u5c31\u53bbopenssl\u6587\u4ef6\u5939\u4e0b<\/p>\n<pre>$&nbsp;.\/Configure&nbsp;no-shared&nbsp;--cross-compile-prefix=i686-w64-mingw32-&nbsp;mingw\n$&nbsp;make<\/pre>\n<p>\u5373\u53ef\uff0c\u8bb0\u5f97\u6539prefix\u3002\u751f\u6210<code>libssl.a<\/code>\u548c<code>libcrypto.a<\/code><\/p>\n<p>\u6700\u540e\u53bblibcurl\u91cc\u7684lib\u6587\u4ef6\u5939\u91cc\u4fee\u6539<code>Makefile.m32<\/code>\u6587\u4ef6\uff0c\u5728<code>CC = $(CROSSPREFIX)gcc<\/code>\u4e0a\u52a0\u4e00\u884c<code>CROSSPREFIX=i686-w64-mingw32-<\/code>\uff08\u8bf7\u6309\u9700\u4fee\u6539\uff09\uff0c\u7136\u540e\u628a\u4e0b\u9762<code>CFLAGS<\/code>\u90a3\u884c\u6539\u6210\u8fd9\u6837<code>CFLAGS = -g -O2 -Wall -DCURL_DISABLE_LDAP<\/code>\uff0c\u6700\u540e<\/p>\n<pre>make&nbsp;-f&nbsp;Makefile.m32&nbsp;CFG=-zlib<\/pre>\n<p>\u6216\u662f<\/p>\n<pre>make&nbsp;-f&nbsp;Makefile.m32&nbsp;CFG=-zlib-ssl<\/pre>\n<p>make\u5230\u6700\u540e\u65f6\u4f1a\u62a5\u4e2a\u9519\uff0c\u662f\u56e0\u4e3a\u6587\u4ef6\u6ca1\u653e\u5bf9\u5730\u65b9\uff0c\u624b\u52a8\u632a\u4e00\u4e0b\u5373\u53ef<\/p>\n<pre>for&nbsp;x&nbsp;in&nbsp;vtls\/openssl.o&nbsp;vtls\/gtls.o&nbsp;vtls\/vtls.o&nbsp;vtls\/nss.o&nbsp;vtls\/qssl.o&nbsp;vtls\/polarssl.o&nbsp;vtls\/polarssl_threadlock.o&nbsp;vtls\/axtls.o&nbsp;vtls\/cyassl.o&nbsp;vtls\/curl_schannel.o&nbsp;vtls\/curl_darwinssl.o&nbsp;vtls\/gskit.o\ndo\nmv&nbsp;`basename&nbsp;$x`&nbsp;vtls\ndone<\/pre>\n<p>\u7136\u540e\u518dmake\u4e00\u4e0b\uff0c<code>libcurl.a<\/code>\u6587\u4ef6\u5e94\u8be5\u5c31\u51fa\u73b0\u4e86\u3002<br \/>\u5982\u679c\u751f\u6210dll\u51fa\u9519\u4e5f\u4e0d\u8981\u7d27\uff0c\u6211\u4eec\u8981\u7684\u662f<code>.a<\/code>\u6587\u4ef6<\/p>\n<p><strong>STEP4 \u6d4b\u8bd5<\/strong><\/p>\n<p>\u73b0\u5728\uff0c\u4f60\u53ef\u4ee5\u627e\u4e00\u6bb5libcurl\u7684demo\u6765\u6d4b\u8bd5\u4e86\u3002\u6ce8\u610f\u8981\u52a0\u4e0a\u5b8f\u5b9a\u4e49<code>CURL_STATICLIB<\/code><\/p>\n<pre>i686-w64-mingw32-gcc&nbsp;-I.&nbsp;-L.&nbsp;-DCURL_STATICLIB&nbsp;curl_demo.c&nbsp;-lcurl&nbsp;-lz&nbsp;-lws2_32&nbsp;-o&nbsp;curl_demo.exe<\/pre>\n<p>\u5982\u679c\u4f60\u56e0\u4e3a\u4e0d\u77e5\u9053gcc<code>-I<\/code>\u548c<code>-L<\/code>\u9009\u9879\u7684\u7528\u6cd5\u800c\u7f16\u8bd1\u4e0d\u8fc7\uff0c\u8bf7\u81ea\u884cGoogle\u3002\u5982\u679c\u4f60\u52a0\u4e86ssl\u652f\u6301\uff0c\u4f60\u9700\u8981\u94fe\u63a5\u66f4\u591a\u7684\u5e93\uff0c\u5177\u4f53\u8bf7\u6839\u636e\u9519\u8bef\u4fe1\u606f\u81ea\u884cGoogle\u3002<\/p>\n<p>\u6700\u540e\u63d0\u9192\u4e00\u70b9\uff1a\u8bf7\u628a-lcurl\u9009\u9879\u653e\u5728\u6e90\u6587\u4ef6\u540e\u9762\uff0c\u6211\u5f53\u521d\u5c31\u662f\u56e0\u4e3a\u8fd9\u4e2a\u6b7b\u6d3b\u94fe\u63a5\u4e0d\u8fc7\u3002\u6700\u540e\u628acurl_demo.exe\u62d6\u8fdb\u865a\u62df\u673a\u91cc\uff0c\u5982\u679c\u4e00\u5207\u6b63\u5e38\uff0c\u90a3\u4e48\u606d\u559c\u4f60\uff0c\u4f60\u6210\u529f\u4e86\u3002<\/p>\n<p>\u6587\u4e2d\u5173\u4e8eLinux,mingw\u7684\u77e5\u8bc6\u4ecb\u7ecd\uff0c\u5e0c\u671b\u5bf9\u4f60\u7684\u5b66\u4e60\u6709\u6240\u5e2e\u52a9\uff01\u82e5\u662f\u53d7\u76ca\u532a\u6d45\uff0c\u90a3\u5c31\u52a8\u52a8\u9f20\u6807\u6536\u85cf\u8fd9\u7bc7\u300amingw\u80fd\u4e0d\u80fd\u5728linux\u4e0a\u8fd0\u884c\u300b\u6587\u7ae0\u5427\uff0c\u4e5f\u53ef\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\u4e86\u89e3\u76f8\u5173\u6280\u672f\u6587\u7ae0\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>mingw\u80fd\u4e0d\u80fd\u5728linux\u4e0a\u8fd0\u884c \u4e00\u5206\u8015\u8018\uff0c\u4e00\u5206\u6536\u83b7\uff01\u65e2\u7136\u90fd\u6253\u5f00\u8fd9\u7bc7\u300amingw\u80fd\u4e0d\u80fd\u5728linux\u4e0a\u8fd0\u884c\u300b\uff0c\u5c31\u575a\u6301\u770b\u4e0b\u53bb\uff0c\u5b66\u4e0b\u53bb\u5427\uff01\u672c\u6587\u4e3b\u8981\u4f1a\u7ed9\u5927\u5bb6\u8bb2\u5230\u7b49\u7b49\u77e5\u8bc6\u70b9\uff0c\u5982\u679c\u5927\u5bb6\u5bf9\u672c\u6587\u6709\u597d\u7684\u5efa\u8bae\u6216\u8005\u770b\u5230\u6709\u4e0d\u8db3\u4e4b\u5904\uff0c\u975e\u5e38\u6b22\u8fce\u5927\u5bb6\u79ef\u6781\u63d0\u51fa\uff01\u5728\u540e\u7eed\u6587\u7ae0\u6211\u4f1a\u7ee7\u7eed\u66f4\u65b0\u6587\u7ae0\u76f8\u5173\u7684\u5185\u5bb9\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u90fd\u6709\u6240\u5e2e\u52a9\uff01 mingw\u80fd\u5728linux\u4e0a\u8fd0\u884c\u3002MinGW\u662f\u4e00\u4e2a\u53ef\u81ea\u7531\u4f7f\u7528\u548c\u81ea\u7531\u53d1\u5e03\u7684Windows\u7279\u5b9a\u5934\u6587\u4ef6\u548c\u4f7f\u7528GNU\u5de5\u5177\u96c6\u5bfc\u5165\u5e93\u7684\u96c6\u5408\uff0c\u53ef\u4ee5\u5141\u8bb8\u7528\u6237\u5728GNU\/Linux\u5e73\u53f0\u4e0a\u751f\u6210\u672c\u5730\u7684Windows\u7a0b\u5e8f\u800c\u4e0d\u9700\u8981\u7b2c\u4e09\u65b9C\u8fd0\u884c\u65f6\uff08C Runtime\uff09\u5e93\u3002 mingw\u662f\u4ec0\u4e48 MinGW\uff0c\u662fMinimalist GNU for Windows\u7684\u7f29\u5199\u3002\u5b83\u662f\u4e00\u4e2a\u53ef\u81ea\u7531\u4f7f\u7528\u548c\u81ea\u7531\u53d1\u5e03\u7684Windows\u7279\u5b9a\u5934\u6587\u4ef6\u548c\u4f7f\u7528GNU\u5de5\u5177\u96c6\u5bfc\u5165\u5e93\u7684\u96c6\u5408\uff0c\u5141\u8bb8\u4f60\u5728GNU\/Linux\u548cWindows\u5e73\u53f0\u751f\u6210\u672c\u5730\u7684Windows\u7a0b\u5e8f\u800c\u4e0d\u9700\u8981\u7b2c\u4e09\u65b9C\u8fd0\u884c\u65f6\uff08C Runtime\uff09\u5e93\u3002 MinGW \u662f\u4e00\u7ec4\u5305\u542b\u6587\u4ef6\u548c\u7aef\u53e3\u5e93\uff0c\u5176\u529f\u80fd\u662f\u5141\u8bb8\u63a7\u5236\u53f0\u6a21\u5f0f\u7684\u7a0b\u5e8f\u4f7f\u7528\u5fae\u8f6f\u7684\u6807\u51c6C\u8fd0\u884c\u65f6\uff08C Runtime\uff09\u5e93\uff08MSVCRT.DLL\uff09\uff0c\u8be5\u5e93\u5728\u6240\u6709\u7684 NT OS \u4e0a\u6709\u6548\uff0c\u5728\u6240\u6709\u7684 Windows 95\u53d1\u884c\u7248\u4ee5\u4e0a\u7684 Windows OS \u6709\u6548\uff0c\u4f7f\u7528\u57fa\u672c\u8fd0\u884c\u65f6\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528 GCC \u5199\u63a7\u5236\u53f0\u6a21\u5f0f\u7684\u7b26\u5408\u7f8e\u56fd\u6807\u51c6\u5316\u7ec4\u7ec7\uff08ANSI\uff09\u7a0b\u5e8f\uff0c\u53ef\u4ee5\u4f7f\u7528\u5fae\u8f6f\u63d0\u4f9b\u7684 C \u8fd0\u884c\u65f6\uff08C Runtime\uff09\u6269\u5c55\uff0c\u4e0e\u57fa\u672c\u8fd0\u884c\u65f6\u76f8\u7ed3\u5408\uff0c\u5c31\u53ef\u4ee5\u6709\u5145\u5206\u7684\u6743\u5229\u65e2\u4f7f\u7528 CRT\uff08C Runtime\uff09\u53c8\u4f7f\u7528 WindowsAPI\u529f\u80fd\u3002 mingw\u80fd\u5728linux\u4e0a\u8fd0\u884c\u4e48 mingw\u53ef\u4ee5\u5728Linux\u4e0a\u8fd0\u884c\u3002\u4ee5debian\u7cfb\u5217\u4e3a\u4f8b\uff0c\u53ef\u4ee5\u901a\u8fc7\u5982\u4e0b\u65b9\u6cd5\u67e5\u8be2\u5230mingw\u7684\u5b89\u88c5\u5305\uff0c\u6839\u636e\u9700\u8981\u5b89\u88c5\u5373\u53ef\u3002 1\u3001\u67e5\u8be2mingw\u7684\u8fd0\u884c\u65f6\u5e93 2\u3001\u67e5\u8be2mingw\u7684\u5f00\u53d1\u73af\u5883 3\u3001\u67e5\u8be2mingw\u6784\u5efa\u5305 4\u3001\u9009\u62e9\u9002\u5408\u81ea\u5df1\u7684\u786c\u4ef6\u5e73\u53f0\u7684\u5305\u8fdb\u884c\u5b89\u88c5 Linux\u4e0b\u4f7f\u7528MinGW\u9759\u6001\u4ea4\u53c9\u7f16\u8bd1\u5e26\u6709zlib\u7684libcurl libcurl\u662f\u4e00\u4e2a\u8de8\u5e73\u53f0\u7684\u3001\u6613\u7528\u7684\u3001\u5f3a\u5927\u7684\u7f51\u7edc\u5e93\u3002\u5728\u5927\u90e8\u5206Linux\u53d1\u884c\u7248\u4e2d\u90fd\u6709\u7f16\u8bd1\u597d\u7684\u4e8c\u8fdb\u5236\u5305\u53ef\u4f9b\u4f7f\u7528\uff0cMac\u7cfb\u7edf\u66f4\u662f\u5c06\u5176\u4f5c\u4e3a\u4e86\u4e00\u4e2a\u6838\u5fc3\u90e8\u4ef6\u3002\u4f46\u662f\u5728Windows\u5e73\u53f0\u4e0a\u5374\u9700\u8981\u624b\u5de5\u7f16\u8bd1\uff0c\u66f4\u4e0d\u5fc5\u8bf4\u4e00\u4e9b\u6709\u7279\u6b8a\u6d01\u7656\u7684\u4eba\uff08\u6bd4\u5982\u8bf4\u6211\uff09\u8fd8\u7279\u522b\u8ba8\u538c\u591a\u51fa\u6765\u51e0\u4e2aDLL,\u975e\u8981\u9759\u6001\u94fe\u63a5\u4e0d\u53ef\u3002\u672c\u6587\u4f5c\u4e3a\u6211\u4e24\u4e2a\u665a\u4e0a\u6298\u817e\u7ecf\u5386\u7684\u4e00\u4e2a\u5c0f\u5c0f\u603b\u7ed3\uff0c\u8bb2\u89e3\u5982\u4f55\u5728Linux\u4e0b\u4f7f\u7528MinGW\u7f16\u8bd1\u7ed9Windows\u4f7f\u7528\u7684libcurl\u9759\u6001\u5e93\u3002 STEP1 \u5b89\u88c5MinGW\u7f16\u8bd1\u5668 \u8fd9\u6b65\u6211\u4e0d\u6253\u7b97\u591a\u8bf4\uff0c\u5927\u90e8\u5206Linux\u53d1\u884c\u7248\u7684\u4ed3\u5e93\u5e94\u8be5\u90fd\u6709\uff0c\u4ee5\u6211\u7684ArchLinux\u4e3a\u4f8b\uff0c\u6267\u884c\uff1a ~#&nbsp;pacman&nbsp;-S&nbsp;mingw-w64 \u5373\u53ef\u3002\u5982\u679c\u4f60\u4e0d\u9700\u8981\u4ea4\u53c9\u7f16\u8bd1\uff0c\u8981\u5728Windows\u4e0a\u76f4\u63a5\u7f16\u8bd1\uff0c\u8bf7\u81ea\u884c\u53bbSourceForge\u4e0a\u4e0b\u8f7dWindows\u7248\u672c\u3002\u4e0d\u8981\u62c5\u5fc3\u90a3\u4e2aw64\u662f\u4e0d\u662f64\u4f4d\u7248\u672c\uff0c\u5b83\u65e2\u53ef\u4ee5\u7f16\u8bd132\u4f4d\u53c8\u53ef\u4ee5\u7f16\u8bd164\u4f4d\u7a0b\u5e8f\u3002\u8fd8\u662f\u4ee5\u6211\u7684\u7248\u672c\u4e3a\u4f8b: ~#&nbsp;pacman&nbsp;-Ql&nbsp;mingw-w64-gcc|&nbsp;grep&nbsp;&#8216;\/usr\/bin\/.*gcc$&#8217; mingw-w64-gcc&nbsp;\/usr\/bin\/i686-w64-mingw32-gcc mingw-w64-gcc&nbsp;\/usr\/bin\/x86_64-w64-mingw32-gcc \u53ef\u4ee5\u770b\u5230\u6709\u4e24\u4e2agcc,\u7528i686-w64-mingw32-gcc\u7f16\u8bd1\u51fa\u6765\u7684\u7a0b\u5e8f\u5c31\u662f32\u4f4d\u7684\uff0c\u800cx86_64-w64-mingw32-gcc\u7f16\u8bd1\u51fa\u6765\u7684\u5c31\u662f64\u4f4d\u7684\u3002\u73b0\u5728\uff0c\u968f\u4fbf\u5199\u4e2aHello World\uff08\u4f60\u53ef\u4ee5\u7528\u6211\u7684Hello World\u4ee3\u7801 ^_^\uff09\uff0c\u7136\u540e\u7f16\u8bd1\u8bd5\u8bd5\uff1a i686-w64-mingw32-gcc&nbsp;hello_world.c&nbsp;-o&nbsp;hello_world.exe \u628a\u5b83\u62ff\u5230\u865a\u62df\u673a\u6216\u6254\u8fdbWine\u91cc\uff0c\u5982\u679c\u80fd\u6b63\u5e38\u8fd0\u884c\uff0c\u90a3\u4e48\u606d\u559c\u4f60\uff0c\u7b2c\u4e00\u6b65\u5b8c\u6210\u4e86\u3002 STEP2 \u4e0b\u8f7d\u6e90\u7801 \u5f88\u7b80\u5355\u7684\u6b65\u9aa4\uff0c\u5982\u679c\u81ea\u5df1\u641e\u4e0d\u5b9a\u7684\u5efa\u8bae\u76f4\u63a5\u53f3\u4e0a\u89d2\u3002 LibCurl\uff1a\u6700\u4e0a\u9762\u7684Source [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-51998","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/51998","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=51998"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/51998\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=51998"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=51998"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=51998"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}