EMQ 问答社区

mac下emqx编译失败,求助,这是什么情况

环境信息

  • EMQ X 版本:4.2.13
  • 操作系统及版本:macos
  • 其他

问题描述

安装了erlang

$ brew install erlang

安装的是 stable 24.0.3 这个版本
也安装了rebar3,但是后发现包里有,就卸载了
按照github上的说明

    $ git clone https://github.com/emqx/emqx-rel.git emqx-rel
    $ cd emqx-rel
    $ git checkout $(git describe --tags $(git rev-list --tags --max-count=1))
    $ make

配置文件及日志

escript: exception error: bad argument
  in function  re:run/3
     called as re:run([65288,22836,25351,38024,22312],
                      "master|^dev/|^hotfix/",
                      [{capture,none}])
     *** argument 1: not an iodata term
/Users/myuser/Documents/project/develop/emqx_plugin/emqx-rel/ensure-rebar3.sh 3.13.2-emqx-4
escript: exception error: bad argument
  in function  re:run/3
     called as re:run([65288,22836,25351,38024,22312],
                      "master|^dev/|^hotfix/",
                      [{capture,none}])
     *** argument 1: not an iodata term
ln -snf _build/emqx/lib ./_checkouts
escript: exception error: bad argument
  in function  re:run/3
     called as re:run([65288,22836,25351,38024,22312],
                      "master|^dev/|^hotfix/",
                      [{capture,none}])
     *** argument 1: not an iodata term
EMQX_DESC="EMQ X Broker" /Users/myuser/Documents/project/develop/emqx_plugin/emqx-rel/rebar3 as emqx release
===> Verifying dependencies...
===> Fetching emqx (from {git,"https://github.com/emqx/emqx",{tag,"v4.2.13"}})
===> Fetching rebar3_proper v0.12.1
===> Version cached at /Users/myuser/.cache/rebar3/hex/hexpm/packages/rebar3_proper-0.12.1.tar is up to date, reusing it
===> Plugin rebar3_proper not available. It will not be used.
===> Fetching rebar3_proper v0.12.1
===> Version cached at /Users/myuser/.cache/rebar3/hex/hexpm/packages/rebar3_proper-0.12.1.tar is up to date, reusing it
===> Plugin rebar3_proper not available. It will not be used.
===> Fetching emqx_auth_clientid (from {git,"https://github.com/emqx/emqx-auth-clientid",
                              {tag,"v4.2.13"}})
===> Fetching emqx_auth_http (from {git,"https://github.com/emqx/emqx-auth-http",
                          {tag,"v4.2.13"}})
===> Fetching emqx_auth_jwt (from {git,"https://github.com/emqx/emqx-auth-jwt",
                         {tag,"v4.2.13"}})
===> Fetching emqx_auth_ldap (from {git,"https://github.com/emqx/emqx-auth-ldap",
                          {tag,"v4.2.13"}})
===> Fetching emqx_auth_mnesia (from {git,"https://github.com/emqx/emqx-auth-mnesia",
                            {tag,"v4.2.13"}})
===> Fetching emqx_auth_mongo (from {git,"https://github.com/emqx/emqx-auth-mongo",
                           {tag,"v4.2.13"}})
===> Fetching emqx_auth_mysql (from {git,"https://github.com/emqx/emqx-auth-mysql",
                           {tag,"v4.2.13"}})
===> Fetching emqx_auth_pgsql (from {git,"https://github.com/emqx/emqx-auth-pgsql",
                           {tag,"v4.2.13"}})
===> Fetching emqx_auth_redis (from {git,"https://github.com/emqx/emqx-auth-redis",
                           {tag,"v4.2.13"}})
===> Fetching emqx_auth_username (from {git,"https://github.com/emqx/emqx-auth-username",
                              {tag,"v4.2.13"}})
===> Fetching emqx_bridge_mqtt (from {git,"https://github.com/emqx/emqx-bridge-mqtt",
                            {tag,"v4.2.13"}})
===> Fetching emqx_coap (from {git,"https://github.com/emqx/emqx-coap",{tag,"v4.2.13"}})
===> Fetching emqx_dashboard (from {git,"https://github.com/emqx/emqx-dashboard",
                          {tag,"v4.2.13"}})
===> Fetching emqx_exproto (from {git,"https://github.com/emqx/emqx-exproto",
                        {tag,"v4.2.13"}})
===> Fetching emqx_extension_hook (from {git,"https://github.com/emqx/emqx-extension-hook",
                               {tag,"v4.2.13"}})
===> Fetching emqx_lua_hook (from {git,"https://github.com/emqx/emqx-lua-hook",
                         {tag,"v4.2.13"}})
===> Fetching emqx_lwm2m (from {git,"https://github.com/emqx/emqx-lwm2m",{tag,"v4.2.13"}})
===> Fetching emqx_management (from {git,"https://github.com/emqx/emqx-management",
                           {tag,"v4.2.13"}})
===> Fetching emqx_plugin_template (from {git,"https://github.com/emqx/emqx-plugin-template",
                                {tag,"v4.2.13"}})
===> Fetching emqx_prometheus (from {git,"https://github.com/emqx/emqx-prometheus",
                           {tag,"v4.2.13"}})
===> Fetching emqx_psk_file (from {git,"https://github.com/emqx/emqx-psk-file",
                         {tag,"v4.2.13"}})
===> Fetching emqx_recon (from {git,"https://github.com/emqx/emqx-recon",{tag,"v4.2.13"}})
===> Fetching emqx_reloader (from {git,"https://github.com/emqx/emqx-reloader",
                         {tag,"v4.2.13"}})
===> Fetching emqx_retainer (from {git,"https://github.com/emqx/emqx-retainer",
                         {tag,"v4.2.13"}})
===> Fetching emqx_rule_engine (from {git,"https://github.com/emqx/emqx-rule-engine",
                            {tag,"v4.2.13"}})
===> Fetching rebar3_proper v0.12.1
===> Version cached at /Users/myuser/.cache/rebar3/hex/hexpm/packages/rebar3_proper-0.12.1.tar is up to date, reusing it
===> Plugin rebar3_proper not available. It will not be used.
===> Fetching rebar3_proper v0.12.1
===> Version cached at /Users/myuser/.cache/rebar3/hex/hexpm/packages/rebar3_proper-0.12.1.tar is up to date, reusing it
===> Plugin rebar3_proper not available. It will not be used.
===> Fetching emqx_sasl (from {git,"https://github.com/emqx/emqx-sasl",{tag,"v4.2.13"}})
===> Fetching emqx_sn (from {git,"https://github.com/emqx/emqx-sn",{tag,"v4.2.13"}})
===> Fetching rebar3_proper v0.12.1
===> Version cached at /Users/myuser/.cache/rebar3/hex/hexpm/packages/rebar3_proper-0.12.1.tar is up to date, reusing it
===> Plugin rebar3_proper not available. It will not be used.
===> Fetching coveralls v2.2.0
===> Version cached at /Users/myuser/.cache/rebar3/hex/hexpm/packages/coveralls-2.2.0.tar is up to date, reusing it
===> Plugin coveralls not available. It will not be used.
===> Fetching emqx_stomp (from {git,"https://github.com/emqx/emqx-stomp",{tag,"v4.2.13"}})
===> Fetching coveralls v2.2.0
===> Version cached at /Users/myuser/.cache/rebar3/hex/hexpm/packages/coveralls-2.2.0.tar is up to date, reusing it
===> Plugin coveralls not available. It will not be used.
===> Fetching coveralls v2.2.0
===> Version cached at /Users/myuser/.cache/rebar3/hex/hexpm/packages/coveralls-2.2.0.tar is up to date, reusing it
===> Plugin coveralls not available. It will not be used.
===> Fetching emqx_telemetry (from {git,"https://github.com/emqx/emqx-telemetry",
                          {tag,"v4.2.13"}})
===> Fetching emqx_web_hook (from {git,"https://github.com/emqx/emqx-web-hook",
                         {tag,"v4.2.13"}})
===> Fetching rebar3_proper v0.12.1
===> Version cached at /Users/myuser/.cache/rebar3/hex/hexpm/packages/rebar3_proper-0.12.1.tar is up to date, reusing it
===> Plugin rebar3_proper not available. It will not be used.
===> Fetching rebar3_proper v0.12.1
===> Version cached at /Users/myuser/.cache/rebar3/hex/hexpm/packages/rebar3_proper-0.12.1.tar is up to date, reusing it
===> Plugin rebar3_proper not available. It will not be used.
===> Fetching cowboy (from {git,"https://github.com/emqx/cowboy",{tag,"2.7.1"}})
===> Fetching cowlib (from {git,"https://github.com/ninenines/cowlib",{tag,"2.7.0"}})
===> Fetching cuttlefish (from {git,"https://github.com/emqx/cuttlefish",{tag,"v3.0.0"}})
===> Fetching rebar3_neotoma_plugin v0.2.0
===> Version cached at /Users/myuser/.cache/rebar3/hex/hexpm/packages/rebar3_neotoma_plugin-0.2.0.tar is up to date, reusing it
===> Plugin rebar3_neotoma_plugin not available. It will not be used.
===> Fetching rebar3_neotoma_plugin v0.2.0
===> Version cached at /Users/myuser/.cache/rebar3/hex/hexpm/packages/rebar3_neotoma_plugin-0.2.0.tar is up to date, reusing it
===> Plugin rebar3_neotoma_plugin not available. It will not be used.
===> Fetching ecpool (from {git,"https://github.com/emqx/ecpool",{tag,"v0.4.2"}})
===> Fetching ehttpc (from {git,"https://github.com/emqx/ehttpc",{tag,"0.1.6"}})
===> Fetching rebar3_proper v0.12.1
===> Version cached at /Users/myuser/.cache/rebar3/hex/hexpm/packages/rebar3_proper-0.12.1.tar is up to date, reusing it
===> Plugin rebar3_proper not available. It will not be used.
===> Fetching rebar3_proper v0.12.1
===> Version cached at /Users/myuser/.cache/rebar3/hex/hexpm/packages/rebar3_proper-0.12.1.tar is up to date, reusing it
===> Plugin rebar3_proper not available. It will not be used.
===> Fetching ekka (from {git,"https://github.com/emqx/ekka",{tag,"0.7.7"}})
===> Fetching eldap2 (from {git,"https://github.com/emqx/eldap2",{tag,"v0.2.2"}})
===> Fetching provider_asn1 v0.2.3
===> Version cached at /Users/myuser/.cache/rebar3/hex/hexpm/packages/provider_asn1-0.2.3.tar is up to date, reusing it
===> Plugin {provider_asn1,"0.2.3"} not available. It will not be used.
===> Fetching provider_asn1 v0.2.3
===> Version cached at /Users/myuser/.cache/rebar3/hex/hexpm/packages/provider_asn1-0.2.3.tar is up to date, reusing it
===> Plugin {provider_asn1,"0.2.3"} not available. It will not be used.
===> Fetching emqtt (from {git,"https://github.com/emqx/emqtt",{tag,"1.2.0"}})
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx (from checkout) as an app of the same name has already been fetched
===> Skipping emqx_management (from {git,"https://github.com/emqx/emqx-management",
                           {tag,"4.2.9"}}) as an app of the same name has already been fetched
===> Skipping emqx_management (from checkout) as an app of the same name has already been fetched
===> Skipping emqx_management (from checkout) as an app of the same name has already been fetched
===> Skipping emqx_management (from checkout) as an app of the same name has already been fetched
===> Skipping emqx_management (from checkout) as an app of the same name has already been fetched
===> Skipping emqx_management (from checkout) as an app of the same name has already been fetched
===> Skipping emqx_management (from checkout) as an app of the same name has already been fetched
===> Skipping emqx_management (from checkout) as an app of the same name has already been fetched
===> Skipping emqx_management (from checkout) as an app of the same name has already been fetched
===> Skipping emqx_management (from checkout) as an app of the same name has already been fetched
===> Fetching emqx_passwd (from {git,"https://github.com/emqx/emqx-passwd",{tag,"v1.1.1"}})
===> Skipping emqx_passwd (from {git,"https://github.com/emqx/emqx-passwd.git",
                       {tag,"v1.1.1"}}) as an app of the same name has already been fetched
===> Skipping emqx_passwd (from {git,"https://github.com/emqx/emqx-passwd.git",
                       {tag,"v1.1.1"}}) as an app of the same name has already been fetched
===> Skipping emqx_rule_engine (from checkout) as an app of the same name has already been fetched
===> Fetching epgsql (from {git,"https://github.com/epgsql/epgsql",{tag,"4.4.0"}})
===> Fetching eredis_cluster (from {git,"https://github.com/emqx/eredis_cluster",
                          {tag,"0.6.4"}})
===> Fetching erlport (from {git,"https://github.com/emqx/erlport",{tag,"v1.2.2"}})
===> Fetching rebar3_proper v0.12.1
===> Version cached at /Users/myuser/.cache/rebar3/hex/hexpm/packages/rebar3_proper-0.12.1.tar is up to date, reusing it
===> Plugin rebar3_proper not available. It will not be used.
===> Fetching rebar3_proper v0.12.1
===> Version cached at /Users/myuser/.cache/rebar3/hex/hexpm/packages/rebar3_proper-0.12.1.tar is up to date, reusing it
===> Plugin rebar3_proper not available. It will not be used.
===> Fetching esockd (from {git,"https://github.com/emqx/esockd",{tag,"5.7.4"}})
===> Fetching gen_coap (from {git,"https://github.com/emqx/gen_coap",{tag,"v0.3.0"}})
===> Fetching gen_rpc (from {git,"https://github.com/emqx/gen_rpc",{tag,"2.5.0"}})
===> Fetching rebar3_hex v6.11.5
===> Version cached at /Users/myuser/.cache/rebar3/hex/hexpm/packages/rebar3_hex-6.11.5.tar is up to date, reusing it
===> Plugin rebar3_hex not available. It will not be used.
===> Fetching rebar3_hex v6.11.5
===> Version cached at /Users/myuser/.cache/rebar3/hex/hexpm/packages/rebar3_hex-6.11.5.tar is up to date, reusing it
===> Plugin rebar3_hex not available. It will not be used.
===> Fetching getopt v1.0.1
===> Version cached at /Users/myuser/.cache/rebar3/hex/hexpm/packages/getopt-1.0.1.tar is up to date, reusing it
===> Failed to fetch and copy dep: {pkg,<<"getopt">>,<<"1.0.1">>,
                                   <<"C73A9FA687B217F2FF79F68A3B637711BB1936E712B521D8CE466B29CBF7808A">>,
                                   #{api_key => undefined,
                                     api_organization => undefined,
                                     api_repository => undefined,
                                     api_url => <<"https://hex.pm/api">>,
                                     http_adapter => r3_hex_http_httpc,
                                     http_adapter_config =>
                                         #{profile => rebar},
                                     http_etag => undefined,
                                     http_user_agent_fragment =>
                                         <<"(rebar3/3.13.2-emqx-4) (httpc)">>,
                                     name => <<"hexpm">>,
                                     repo_key => undefined,
                                     repo_name => <<"hexpm">>,
                                     repo_organization => undefined,
                                     repo_public_key =>
                                         <<"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApqREcFDt5vV21JVe2QNB\nEdvzk6w36aNFhVGWN5toNJRjRJ6m4hIuG4KaXtDWVLjnvct6MYMfqhC79HAGwyF+\nIqR6Q6a5bbFSsImgBJwz1oadoVKD6ZNetAuCIK84cjMrEFRkELtEIPNHblCzUkkM\n3rS9+DPlnfG8hBvGi6tvQIuZmXGCxF/73hU0/MyGhbmEjIKRtG6b0sJYKelRLTPW\nXgK7s5pESgiwf2YC/2MGDXjAJfpfCd0RpLdvd4eRiXtVlE9qO9bND94E7PgQ/xqZ\nJ1i2xWFndWa6nfFnRxZmCStCOZWYYPlaxr+FZceFbpMwzTNs4g3d4tLNUcbKAIH4\n0wIDAQAB\n-----END PUBLIC KEY-----">>,
                                     repo_url => <<"https://repo.hex.pm">>,
                                     repo_verify => true,
                                     repo_verify_origin => true}}
make: *** [emqx] Error 1


brew list erlang 看下你的erlang版本是?

erlang: stable 24.0.3 (bottled), HEAD
Programming language for highly scalable real-time systems
https://www.erlang.org/
/usr/local/Cellar/erlang/24.0.3 (7,619 files, 483.4MB) *
  Poured from bottle on 2021-07-08 at 10:59:30
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/erlang.rb
License: Apache-2.0
==> Dependencies
Required: openssl@1.1 ✔, wxmac ✔
==> Options
--HEAD
	Install HEAD version
==> Caveats
Man pages can be found in:
  /usr/local/opt/erlang/lib/erlang/man

暂时还没有支持到otp24版本,降级到23或22。MAC下可以使用

brew uninstall erlang

brew install erlang@23

erlang试了23 和22. 都报错。下面的是macos下,brew安装erlang 22版本的make日志:

escript: exception error: bad argument
  in function  re:run/3
     called as re:run([65288,22836,25351,38024,22312],
                      "master|^dev/|^hotfix/",
                      [{capture,none}])
/Users/terry/Downloads/emqx-rel/ensure-rebar3.sh 3.13.2-emqx-4
escript: exception error: bad argument
  in function  re:run/3
     called as re:run([65288,22836,25351,38024,22312],
                      "master|^dev/|^hotfix/",
                      [{capture,none}])
ln -snf _build/emqx/lib ./_checkouts
escript: exception error: bad argument
  in function  re:run/3
     called as re:run([65288,22836,25351,38024,22312],
                      "master|^dev/|^hotfix/",
                      [{capture,none}])
EMQX_DESC="EMQ X Broker" /Users/terry/Downloads/emqx-rel/rebar3 as emqx release
===> Plugin {relup_helper,{git,"https://github.com/emqx/relup_helper",
                                      {branch,"master"}}} not available. It will not be used.
=ERROR REPORT==== 9-Jul-2021::23:59:49.414428 ===
Loading of /Users/terry/Downloads/emqx-rel/_build/default/plugins/relup_helper/ebin/relup_helper.beam failed: badfile

=ERROR REPORT==== 9-Jul-2021::23:59:49.414418 ===
beam/beam_load.c(1883): Error loading module relup_helper:
  This BEAM file was compiled for a later version of the run-time system than 22.
  To fix this, please recompile this module with an 22 compiler.
  (Use of opcode 169; this emulator supports only up to 168.)


中间省略很多。。。。


=ERROR REPORT==== 9-Jul-2021::23:59:53.170325 ===
Loading of /Users/terry/Downloads/emqx-rel/_build/emqx/plugins/pc/ebin/pc.beam failed: badfile

===> Compiling esockd
===> Failed to restore /Users/terry/Downloads/emqx-rel/_checkouts/esockd/.rebar3/rebar_compiler_erl/source.dag file. Discarding it.

=ERROR REPORT==== 9-Jul-2021::23:59:53.390862 ===
Loading of /Users/terry/Downloads/emqx-rel/_build/default/plugins/relup_helper/ebin/mod_vsn.beam failed: badfile

=ERROR REPORT==== 9-Jul-2021::23:59:53.390856 ===
beam/beam_load.c(1883): Error loading module mod_vsn:
  This BEAM file was compiled for a later version of the run-time system than 22.
  To fix this, please recompile this module with an 22 compiler.
  (Use of opcode 169; this emulator supports only up to 168.)


===> Compiling _checkouts/esockd/src/esockd_listener_sup.erl failed
_checkouts/esockd/src/esockd_listener_sup.erl:none: undefined parse transform 'mod_vsn'

make: *** [emqx] Error 1

重装了 OTP 23 之后,你得删了工作目录重新拉取代码,重新编译。