当前位置: 首页 > 工具软件 > Cowboy > 使用案例 >

Win11安装MSYS2,并编译cowboy

宗穆冉
2023-12-01

安装并配置MSYS2

给 MSYS2 添加国内的源
msys2使用教程

windows上msys2配置及填坑

注意:MSYS2进入E盘的命令是cd /E,可进入任意windows路径

cmd中使用make

msys2中的make名称为C:\msys64\mingw64\bin\mingw32-make.exe,可以复制一份,重命名为make,然后将该路径添加到环境变量,就可以在cmd中使用了。
Windows10+msys2+cmake编译C++程序

构建Cowboy

Windows下搭建Erlang.mk开发环境

make cowboy时遇到的问题

过程

$ make
 DEP    ranch (1.7.1)
fatal: unable to access 'https://github.com/ninenines/ranch/': Recv failure: Connection reset by peer
/bin/sh: line 1: cd: /desktop/talkroom/deps/cowboy/deps/ranch: No such file or directory
make: *** [erlang.mk:4871: /desktop/talkroom/deps/cowboy/deps/ranch] Error 1
$
$ git config --global -l
url.git://.insteadof=http://
$
$ make
 DEP    ranch (1.7.1)
fatal: unable to connect to github.com:
github.com[0: 20.205.243.166]: errno=Connection timed out

/bin/sh: line 1: cd: /desktop/talkroom/deps/cowboy/deps/ranch: No such file or directory
make: *** [erlang.mk:4871: /desktop/talkroom/deps/cowboy/deps/ranch] Error 1
$
$ git config --global --unset url.git://.insteadof
$
$ make
 DEP    ranch (1.7.1)
make[1]: Entering directory '/desktop/talkroom/deps/cowboy/deps/cowlib'
 DEPEND cowlib.d
 ERLC   cow_base64url.erl cow_cookie.erl cow_date.erl cow_hpack.erl cow_http.erl cow_http2.erl cow_http2_machine.erl cow_http_hd.erl cow_http_te.erl cow_iolists.erl cow_mimetypes.erl cow_multipart.erl cow_qs.erl cow_spdy.erl cow_sse.erl cow_uri.erl cow_ws.erl
 APP    cowlib
make[1]: Leaving directory '/desktop/talkroom/deps/cowboy/deps/cowlib'
make[1]: Entering directory '/desktop/talkroom/deps/cowboy/deps/ranch'
 DEPEND ranch.d
 ERLC   ranch.erl ranch_acceptor.erl ranch_acceptors_sup.erl ranch_app.erl ranch_conns_sup.erl ranch_crc32c.erl ranch_listener_sup.erl ranch_protocol.erl ranch_proxy_header.erl ranch_server.erl ranch_ssl.erl ranch_sup.erl ranch_tcp.erl ranch_transport.erl
 APP    ranch
make[1]: Leaving directory '/desktop/talkroom/deps/cowboy/deps/ranch'
 DEPEND cowboy.d
 ERLC   cowboy.erl cowboy_app.erl cowboy_bstr.erl cowboy_children.erl cowboy_clear.erl cowboy_clock.erl cowboy_compress_h.erl cowboy_constraints.erl cowboy_handler.erl cowboy_http.erl cowboy_http2.erl cowboy_loop.erl cowboy_metrics_h.erl cowboy_middleware.erl cowboy_req.erl cowboy_rest.erl cowboy_router.erl cowboy_static.erl cowboy_stream.erl cowboy_stream_h.erl cowboy_sub_protocol.erl cowboy_sup.erl cowboy_tls.erl cowboy_tracer_h.erl cowboy_websocket.erl
 APP    cowboy
 GEN    rebar.config

# 碰到的都是git仓库连不上的问题,先是输入这个命令,再make,还是连不上,但报错不一样了
git config --global url."git://".insteadOf https://
# 然后unset,再make,就成功了,不知道为什么
git config --global --unset url.git://.insteadof
 类似资料: