emqx / emqx-plugin-template

EMQX Plugin Template and Demo

Home Page:https://www.emqx.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

build error 'Error: badarg'

gksrb4 opened this issue · comments

commented

Hi, I want to install plugin in windows. I occured error.
gksrb@PASSTECH-HANGYU MINGW64 /d/download/emqx-plugin-template-master $ make rel C:/ProgramData/chocolatey/lib/make/tools/install/bin/make.exe get-rebar3 make[1]: Entering directory 'D:/download/emqx-plugin-template-master' make[1]: Leaving directory 'D:/download/emqx-plugin-template-master' /c/Erlang/bin/rebar3 emqx_plugrel tar ===> Fetching emqx_plugrel (from {git,"https://github.com/emqx/emqx_plugrel.git", {tag,"0.3.0"}}) ===> Fetching jsx v3.1.0 ===> Analyzing applications... ===> Compiling jsx ===> Compiling emqx_plugrel ===> Verifying dependencies... ===> Fetching emqx (from {git_subdir,"https://github.com/emqx/emqx.git", {tag,"v5.0.25"}, "apps/emqx"}) ===> Fetching rebar3_proper v0.12.1 ===> Analyzing applications... ===> Compiling rebar3_proper ===> Fetching rebar3_path_deps v0.4.0 ===> Analyzing applications... ===> Compiling rebar3_path_deps ===> Fetching emqx_utils (from {git_subdir,"https://github.com/emqx/emqx.git", {tag,"v5.0.25"}, "apps/emqx_utils"}) ===> Fetching map_sets v1.1.0 ===> Fetching cowboy (from {git,"https://github.com/emqx/cowboy",{tag,"2.9.0"}}) ===> Fetching ekka (from {git,"https://github.com/emqx/ekka",{tag,"0.15.1"}}) ===> Fetching emqx_http_lib (from {git,"https://github.com/emqx/emqx_http_lib.git", {tag,"0.5.2"}}) ===> Skipping emqx_utils (from {path,"../emqx_utils"}) as an app of the same name has already been fetched ===> Fetching esockd (from {git,"https://github.com/emqx/esockd",{tag,"5.9.6"}}) ===> Fetching gen_rpc (from {git,"https://github.com/emqx/gen_rpc",{tag,"2.8.1"}}) ===> Fetching rebar3_hex v7.0.6 ===> Fetching hex_core v0.8.4 ===> Fetching verl v1.1.1 ===> Analyzing applications... ===> Compiling hex_core ===> Compiling verl ===> Compiling rebar3_hex ===> Fetching gproc (from {git,"https://github.com/uwiger/gproc",{tag,"0.8.0"}}) ===> Fetching hocon (from {git,"https://github.com/emqx/hocon.git",{tag,"0.39.4"}}) ===> Fetching jiffy (from {git,"https://github.com/emqx/jiffy",{tag,"1.0.5"}}) ===> Fetching pc (from {git,"https://github.com/emqx/port_compiler.git",{tag,"v1.11.1"}}) ===> Analyzing applications... ===> Compiling pc ===> Fetching lc (from {git,"https://github.com/emqx/lc.git",{tag,"0.3.2"}}) ===> Fetching pbkdf2 (from {git,"https://github.com/emqx/erlang-pbkdf2.git",{tag,"2.0.4"}}) ===> Fetching recon (from {git,"https://github.com/ferd/recon",{tag,"2.5.1"}}) ===> Fetching snabbkaffe (from {git,"https://github.com/kafka4beam/snabbkaffe.git", {tag,"1.0.8"}}) ===> Fetching cowlib (from {git,"https://github.com/ninenines/cowlib",{tag,"2.8.0"}}) ===> Fetching eetcd (from {git,"https://github.com/zhongwencool/eetcd",{tag,"v0.3.4"}}) ===> Fetching rebar3_gpb_plugin v2.13.1 ===> Fetching gpb v4.11.1 ===> Analyzing applications... ===> Compiling gpb ===> Compiling rebar3_gpb_plugin Compiling descriptor.proto... Compiling gpb_descriptor.erl... Compiling gpb_compile_descr.erl... ===> Fetching rebar3_eetcd_plugin v0.3.0 ===> Fetching providers v1.8.1 ===> Fetching getopt v1.0.1 ===> Analyzing applications... ===> Compiling getopt ===> Compiling providers ===> Compiling gpb ===> Compiling rebar3_eetcd_plugin ===> Fetching getopt v1.0.1 ===> Fetching mria (from {git,"https://github.com/emqx/mria",{tag,"0.5.2"}}) ===> Fetching ranch (from {git,"https://github.com/ninenines/ranch",{tag,"1.8.0"}}) ===> Skipping snabbkaffe (from {git,"https://github.com/kafka4beam/snabbkaffe", {tag,"1.0.0"}}) as an app of the same name has already been fetched ===> Skipping snabbkaffe (from {git,"https://github.com/kafka4beam/snabbkaffe", {tag,"0.17.1"}}) as an app of the same name has already been fetched ===> Skipping snabbkaffe v1.0.1 as an app of the same name has already been fetched ===> Fetching typerefl (from {git,"https://github.com/k32/typerefl.git",{tag,"0.9.0"}}) ===> Skipping typerefl (from {git,"https://github.com/ieQu1/typerefl.git",{tag,"0.9.1"}}) as an app of the same name has already been fetched ===> Skipping gen_rpc (from {git,"https://github.com/emqx/gen_rpc",{tag,"3.0.1"}}) as an app of the same name has already been fetched ===> Fetching gun v1.3.3 ===> Fetching mnesia_rocksdb (from {git,"https://github.com/emqx/mnesia_rocksdb", {tag,"0.1.12"}}) ===> Fetching optvar (from {git,"https://github.com/emqx/optvar",{tag,"1.0.4"}}) ===> Fetching replayq (from {git,"https://github.com/emqx/replayq",{tag,"0.3.6"}}) ===> Fetching coveralls v2.2.0 ===> Analyzing applications... ===> Compiling coveralls ===> Skipping snabbkaffe (from {git,"https://github.com/kafka4beam/snabbkaffe", {tag,"1.0.7"}}) as an app of the same name has already been fetched ===> Skipping cowlib v2.7.3 as an app of the same name has already been fetched ===> Fetching rocksdb (from {git,"https://github.com/emqx/erlang-rocksdb.git", {tag,"1.7.2-emqx-9"}}) ===> Fetching sext v1.8.0 -- Building for: Visual Studio 17 2022 -- The C compiler identification is MSVC 19.32.31329.0 -- The CXX compiler identification is MSVC 19.32.31329.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- LZ4 library: D:/download/emqx-plugin-template-master/_build/default/lib/rocksdb/_build/cmake/lz4/lib/lz4.lib -- LZ4 includes: D:/download/emqx-plugin-template-master/_build/default/lib/rocksdb/_build/cmake/lz4/include -- Snappy library: D:/download/emqx-plugin-template-master/_build/default/lib/rocksdb/_build/cmake/snappy/lib/snappy.lib -- Snappy includes: D:/download/emqx-plugin-template-master/_build/default/lib/rocksdb/_build/cmake/snappy/include -- cmake args -DCMAKE_POSITION_INDEPENDENT_CODE=ON;-DCMAKE_CXX_COMPILER=C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe;-DCMAKE_AR=C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/lib.exe;-DCMAKE_BUILD_TYPE=Release;-DFAIL_ON_WARNINGS=OFF;-DPORTABLE=ON;-DUSE_RTTI=1;-DWITH_TOOLS=OFF;-DWITH_TESTS=OFF;-DWITH_GFLAGS=OFF;-DWITH_JEMALLOC=OFF;-DWITH_TBB=;-DWITH_SNAPPY=TRUE;-DWITH_LZ4=TRUE;-DWITH_ZLIB=;-DWITH_BZ2=;-DWITH_ZSTD=;-DWITHOUT_THIRDPARTY_INC=ON;-Dsnappy_ROOT_DIR=D:/download/emqx-plugin-template-master/_build/default/lib/rocksdb/_build/cmake/snappy;-Dlz4_ROOT_DIR=D:/download/emqx-plugin-template-master/_build/default/lib/rocksdb/_build/cmake/lz4 -- Found RocksDB library: D:/download/emqx-plugin-template-master/_build/default/lib/rocksdb/_build/cmake/rocksdb-prefix/src/rocksdb-build/Release/rocksdb.lib -- Found RocksDB includes: D:/download/emqx-plugin-template-master/_build/default/lib/rocksdb/c_src/../deps/rocksdb/include -- Using OTP lib: c:/Erlang/lib - found -- Using erl_interface version: erl_interface-5.4 -- Using erts version: erts-14.0.1 -- Configuring done -- Generating done -- Build files have been written to: D:/download/emqx-plugin-template-master/_build/default/lib/rocksdb/_build/cmake ===> Compiling d:/download/emqx-plugin-template-master/c_src/decoder.c ===> Uncaught error in rebar_core. Run with DIAGNOSTIC=1 to see stacktrace or consult rebar3.crashdump ===> When submitting a bug report, please include the output of 'rebar3 report "your command"' make: *** [Makefile:49: rel] Error 1

rebar3.crashdump
Error: badarg [{re,replace, [[77,105,99,114,111,115,111,102,116,32,40,82,41,32,67,47,67,43,43,32, 52572,51201,54868,32,52980,54028,51068,47084,32,48260,51204,32,49,57, 46,51,50,46,51,49,51,50,57,40,120,54,52,41,10,67,111,112,121,114,105, 103,104,116,32,40,99,41,32,77,105,99,114,111,115,111,102,116,32,67,111, 114,112,111,114,97,116,105,111,110,46,32,65,108,108,32,114,105,103,104, 116,115,32,114,101,115,101,114,118,101,100,46,10,10,100,101,99,111,100, 101,114,46,99,10,99,95,115,114,99,47,100,101,99,111,100,101,114,46,99, 40,52,41,58,32,102,97,116,97,108,32,101,114,114,111,114,32,67,49,48,56, 51,58,32,54252,54632,32,54028,51068,51012,32,50676,32,49688,32,50630, 49845,45768,45796,46,32,39,97,115,115,101,114,116,46,104,39,58,32,78, 111,32,115,117,99,104,32,102,105,108,101,32,111,114,32,100,105,114,101, 99,116,111,114,121,10], "c_src/decoder.c", "d:/download/emqx-plugin-template-master/c_src/decoder.c", [{return,list},global]], [{file,"re.erl"},{line,987},{error_info,#{module => erl_stdlib_errors}}]}, {pc_compilation,exec_compiler,4, [{file,"d:/download/emqx-plugin-template-master/_build/default/plugins/pc/src/pc_compilation.erl"}, {line,197}]}, {pc_compilation,compile_each,5, [{file,"d:/download/emqx-plugin-template-master/_build/default/plugins/pc/src/pc_compilation.erl"}, {line,135}]}, {pc_compilation,'-compile_sources/2-lists^foldl/2-0-',3, [{file,"d:/download/emqx-plugin-template-master/_build/default/plugins/pc/src/pc_compilation.erl"}, {line,96}]}, {pc_compilation,compile_sources,2, [{file,"d:/download/emqx-plugin-template-master/_build/default/plugins/pc/src/pc_compilation.erl"}, {line,96}]}, {pc_compilation,compile_and_link,2, [{file,"d:/download/emqx-plugin-template-master/_build/default/plugins/pc/src/pc_compilation.erl"}, {line,42}]}, {pc_prv_compile,'-do/1-lc$^0/1-0-',2, [{file,"d:/download/emqx-plugin-template-master/_build/default/plugins/pc/src/pc_prv_compile.erl"}, {line,53}]}, {pc_prv_compile,do,1, [{file,"d:/download/emqx-plugin-template-master/_build/default/plugins/pc/src/pc_prv_compile.erl"}, {line,54}]}]

$ rebar3 --version rebar 3.22.0 on Erlang/OTP 26 Erts 14.0.1

erlang version is otp_win64_26.0.1

How can I fix this?

The error message is:

Microsoft (R) C/C++ 최적화 컴파일러 버전 19.32.31329(x64)
Copyright (c) Microsoft Corporation. All rights reserved.

decoder.c
c_src/decoder.c(4): fatal error C1083: 포함 파일을 열 수 없습니다. 'assert.h': No such file or directory

This is due to the lack of header files to build the durable storage part.
Please try:

1. delete {emqx_durable_storage, {git_subdir, "https://github.com/emqx/emqx.git", {tag, "v5.1.3"},~~ ~~"apps/emqx_durable_storage"}} from rebar.config
2. delete the _build dir
3. make

To setup the build environment in windows, please follow this guide: https://github.com/emqx/emqx/blob/master/Windows.md

BTW, EMQX is still on OTP 25. Plugins built no OTP 26 won't load.