How to use msys2 to compile on Windows requires a "vendored" project.
sorry,I checked the document carefully, but still failed to compile it. Who can provide me with detailed help. and ,I don't want to install visual studio, can I just use the msys toolchain to compile?
toml
[dependencies]
lua-src = "543.1.0"
luajit-src = "210.3.2+resty1085a4d"
mlua = { version = "0.7.0", features = ["async","lua53","vendored"] }
error
error: linking with `x86_64-w64-mingw32-gcc` failed: exit code: 1
|
= note: "x86_64-w64-mingw32-gcc" "-fno-use-linker-plugin" "-Wl,--dynamicbase" "-Wl,--disable-auto-image-base" "-m64" "-Wl,--high-entropy-va" "C:\\msys64\\mingw64\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsbegin.o" "C:\\Users\\xm111\\CLionProjects\\luatest\\target\\debug\\deps\\luatest-51689e175075d24c.1eqqo8ew6wzou5u4.rcgu.o" "C:\\Users\\xm111\\CLionProjects\\luatest\\target\\debug\\deps\\luatest-51689e175075d24c.20np30qiahf8bhd.rcgu.o" "C:\\Users\\xm111\\CLionProjects\\luatest\\target\\debug\\deps\\luatest-51689e175075d24c.28ev03ear6gyoz1p.rcgu.o" "C:\\Users\\xm111\\CLionProjects\\luatest\\target\\debug\\deps\\luatest-51689e175075d24c.4e7v323hxpp76rfx.rcgu.o" "C:\\Users\\xm111\\CLionProjects\\luatest\\target\\debug\\deps\\luatest-51689e175075d24c.524vfdj03fvw6xwf.rcgu.o" "C:\\Users\\xm111\\CLionProjects\\luatest\\target\\debug\\deps\\luatest-51689e175075d24c.v2pgiz1pkq73kfb.rcgu.o" "C:\\Users\\xm111\\CLionProjects\\luatest\\target\\debug\\deps\\luatest-51689e175075d24c.3qxuo4qr7y20g867.rcgu.o" "-L" "C:\\Users\\xm111\\CLionProjects\\luatest\\target\\debug\\deps" "-L" "C:\\Users\\xm111\\CLionProjects\\luatest\\target\\debug\\build\\mlua-2713a4c1069670ee\\out\\lua-build\\lib" "-L" "C:\\msys64\\mingw64\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-Wl,-Bstatic" "C:\\Users\\xm111\\CLionProjects\\luatest\\target\\debug\\deps\\libmlua-5d3eaafe7d7b0eda.rlib" "C:\\Users\\xm111\\CLionProjects\\luatest\\target\\debug\\deps\\libonce_cell-cdcb6886771093d3.rlib" "C:\\Users\\xm111\\CLionProjects\\luatest\\target\\debug\\deps\\librustc_hash-999ac205fa5865d4.rlib" "C:\\Users\\xm111\\CLionProjects\\luatest\\target\\debug\\deps\\libfutures_util-be148da700b0b943.rlib" "C:\\Users\\xm111\\CLionProjects\\luatest\\target\\debug\\deps\\libslab-14301e23a09bff45.rlib" "C:\\Users\\xm111\\CLionProjects\\luatest\\target\\debug\\deps\\libpin_project_lite-162119a1aeda1c94.rlib" "C:\\Users\\xm111\\CLionProjects\\luatest\\target\\debug\\deps\\libfutures_task-22d0763b724973a2.rlib" "C:\\Users\\xm111\\CLionProjects\\luatest\\target\\debug\\deps\\libpin_utils-e0537f442681e5dd.rlib" "C:\\Users\\xm111\\CLionProjects\\luatest\\target\\debug\\deps\\libfutures_core-46b9b49c2e274209.rlib" "C:\\Users\\xm111\\CLionProjects\\luatest\\target\\debug\\deps\\libnum_traits-b05e99648da353fb.rlib" "C:\\Users\\xm111\\CLionProjects\\luatest\\target\\debug\\deps\\libbstr-ebd94af289e8bc4b.rlib" "C:\\Users\\xm111\\CLionProjects\\luatest\\target\\debug\\deps\\libmemchr-02d034273d4d4815.rlib" "-Wl,--start-group" "C:\\msys64\\mingw64\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd-149330ca1e04a517.rlib" "C:\\msys64\\mingw64\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libpanic_unwind-4c5dcb1760a5478b.rlib" "C:\\msys64\\mingw64\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libobject-f9271b6459d06ab4.rlib" "C:\\msys64\\mingw64\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libmemchr-4cf6a52d42470612.rlib" "C:\\msys64\\mingw64\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libaddr2line-6019cba8dd104689.rlib" "C:\\msys64\\mingw64\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libgimli-381d394e9d49d9a3.rlib" "C:\\msys64\\mingw64\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd_detect-2b6fd618e0832dc3.rlib" "C:\\msys64\\mingw64\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_demangle-a00b0e95e0bf510c.rlib" "C:\\msys64\\mingw64\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libhashbrown-f273a985581c8386.rlib" "C:\\msys64\\mingw64\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_std_workspace_alloc-ed945d150df4b57d.rlib" "C:\\msys64\\mingw64\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libunwind-6925ad9439eb3236.rlib" "C:\\msys64\\mingw64\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcfg_if-e6119dc9e3e0fe20.rlib" "C:\\msys64\\mingw64\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liblibc-afb45b8119fa9933.rlib" "C:\\msys64\\mingw64\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc-b1e174e86d3e925f.rlib" "C:\\msys64\\mingw64\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_std_workspace_core-fb0808a79685b668.rlib" "C:\\msys64\\mingw64\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcore-8ec2687293020ad1.rlib" "-Wl,--end-group" "C:\\msys64\\mingw64\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcompiler_builtins-f3f58b6ed174ea39.rlib" "-Wl,-Bdynamic" "-lkernel32" "-lws2_32" "-lbcrypt" "-ladvapi32" "-luserenv" "-lkernel32" "-lgcc_eh" "-l:libpthread.a" "-lmsvcrt" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-luser32" "-lkernel32" "-Wl,--nxcompat" "-L" "C:\\msys64\\mingw64\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-o" "C:\\Users\\xm111\\CLionProjects\\luatest\\target\\debug\\deps\\luatest-51689e175075d24c.exe" "-Wl,--gc-sections" "-no-pie" "-nodefaultlibs" "C:\\msys64\\mingw64\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsend.o"
= note: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\CLionProjects\luatest\target\debug\deps\libmlua-5d3eaafe7d7b0eda.rlib(lstrlib.o): in function `str_upper':
C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\lstrlib.c:116: undefined reference to `__locale_ctype_ptr'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\CLionProjects\luatest\target\debug\deps\libmlua-5d3eaafe7d7b0eda.rlib(lstrlib.o): in function `match_class':
C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\lstrlib.c:284: undefined reference to `__locale_ctype_ptr'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\lstrlib.c:285: undefined reference to `__locale_ctype_ptr'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\lstrlib.c:298: undefined reference to `__locale_ctype_ptr'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\lstrlib.c:286: undefined reference to `__locale_ctype_ptr'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\CLionProjects\luatest\target\debug\deps\libmlua-5d3eaafe7d7b0eda.rlib(lstrlib.o):C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\lstrlib.c:287: more undefined references to `__locale_ctype_ptr' follow
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\CLionProjects\luatest\target\debug\deps\libmlua-5d3eaafe7d7b0eda.rlib(liolib.o): in function `opencheck':
C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\liolib.c:252: undefined reference to `__errno'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\CLionProjects\luatest\target\debug\deps\libmlua-5d3eaafe7d7b0eda.rlib(liolib.o): in function `read_number':
C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\liolib.c:451: undefined reference to `__locale_ctype_ptr'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\CLionProjects\luatest\target\debug\deps\libmlua-5d3eaafe7d7b0eda.rlib(liolib.o): in function `luaopen_io':
C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\liolib.c:773: undefined reference to `__getreent'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\liolib.c:774: undefined reference to `__getreent'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\liolib.c:775: undefined reference to `__getreent'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\CLionProjects\luatest\target\debug\deps\libmlua-5d3eaafe7d7b0eda.rlib(lapi.o): in function `index2addr':
C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\lapi.c:64: undefined reference to `__assert_func'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\lapi.c:69: undefined reference to `__assert_func'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\lapi.c:76: undefined reference to `__assert_func'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\CLionProjects\luatest\target\debug\deps\libmlua-5d3eaafe7d7b0eda.rlib(lapi.o): in function `auxgetstr':
C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\lapi.c:593: undefined reference to `__assert_func'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\lapi.c:597: undefined reference to `__assert_func'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\CLionProjects\luatest\target\debug\deps\libmlua-5d3eaafe7d7b0eda.rlib(lapi.o):C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\lapi.c:746: more undefined references to `__assert_func' follow
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\CLionProjects\luatest\target\debug\deps\libmlua-5d3eaafe7d7b0eda.rlib(ldblib.o): in function `db_debug':
C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\ldblib.c:411: undefined reference to `__getreent'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\ldblib.c:411: undefined reference to `__getreent'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\ldblib.c:405: undefined reference to `__getreent'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\ldblib.c:405: undefined reference to `__getreent'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\ldblib.c:406: undefined reference to `__getreent'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\CLionProjects\luatest\target\debug\deps\libmlua-5d3eaafe7d7b0eda.rlib(lauxlib.o): in function `errfile':
C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\lauxlib.c:661: undefined reference to `__errno'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\CLionProjects\luatest\target\debug\deps\libmlua-5d3eaafe7d7b0eda.rlib(lauxlib.o): in function `panic':
C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\lauxlib.c:1025: undefined reference to `__getreent'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\lauxlib.c:1025: undefined reference to `__getreent'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\CLionProjects\luatest\target\debug\deps\libmlua-5d3eaafe7d7b0eda.rlib(lauxlib.o): in function `luaL_fileresult':
C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\lauxlib.c:235: undefined reference to `__errno'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\lauxlib.c:235: undefined reference to `__errno'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\CLionProjects\luatest\target\debug\deps\libmlua-5d3eaafe7d7b0eda.rlib(lauxlib.o): in function `luaL_loadfilex':
C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\lauxlib.c:711: undefined reference to `__getreent'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\CLionProjects\luatest\target\debug\deps\libmlua-5d3eaafe7d7b0eda.rlib(lstate.o): in function `lua_newthread':
C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\lstate.c:269: undefined reference to `__assert_func'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\CLionProjects\luatest\target\debug\deps\libmlua-5d3eaafe7d7b0eda.rlib(lbaselib.o): in function `luaB_print':
C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\lbaselib.c:37: undefined reference to `__getreent'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\lbaselib.c:38: undefined reference to `__getreent'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\lbaselib.c:41: undefined reference to `__getreent'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\lbaselib.c:41: undefined reference to `__getreent'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\CLionProjects\luatest\target\debug\deps\libmlua-5d3eaafe7d7b0eda.rlib(lbaselib.o): in function `b_str2int':
C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\lbaselib.c:54: undefined reference to `__locale_ctype_ptr'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\lbaselib.c:62: undefined reference to `__locale_ctype_ptr'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\lbaselib.c:57: undefined reference to `__locale_ctype_ptr'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\lbaselib.c:58: undefined reference to `__locale_ctype_ptr'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\CLionProjects\luatest\target\debug\deps\libmlua-5d3eaafe7d7b0eda.rlib(ldo.o): in function `resume_error':
C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\ldo.c:606: undefined reference to `__assert_func'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\CLionProjects\luatest\target\debug\deps\libmlua-5d3eaafe7d7b0eda.rlib(ldo.o): in function `finishCcall':
C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\ldo.c:535: undefined reference to `__assert_func'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\CLionProjects\luatest\target\debug\deps\libmlua-5d3eaafe7d7b0eda.rlib(ldo.o): in function `luaD_precall':
C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\ldo.c:436: undefined reference to `__assert_func'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\CLionProjects\luatest\target\debug\deps\libmlua-5d3eaafe7d7b0eda.rlib(ldo.o): in function `resume':
C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\ldo.c:638: undefined reference to `__assert_func'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\CLionProjects\luatest\target\debug\deps\libmlua-5d3eaafe7d7b0eda.rlib(ldo.o): in function `lua_resume':
C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\ldo.c:663: undefined reference to `__assert_func'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\xm111\CLionProjects\luatest\target\debug\deps\libmlua-5d3eaafe7d7b0eda.rlib(ldo.o):C:\Users\xm111\.cargo\registry\src\github.com-1ecc6299db9ec823\lua-src-543.1.0\lua-5.3.6\ldo.c:697: more undefined references to `__assert_func' follow
collect2.exe: error: ld returned 1 exit status
= help: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
= note: use the `-l` flag to specify native libraries to link
= note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)
Cannot reproduce, everything works fine on fresh msys2 installation with rust installed via pacman (1.57.0).
msys is also used in CI to test mlua modules on windows: https://github.com/khvzak/mlua/blob/master/.github/workflows/main.yml#L193
Thank you for helping me.
I don't know why, there is a problem with the environment I configured before, and I don't know what went wrong. The mingw-64 installed by msys2 I used is also the mingw-64-rust installed in msys2.
The ide I use is clion. For example, there is no problem compiling println!("hello world"), but compiling mlua always fails, even if I enable vendored.
After raising issues that could not be compiled, I found that other libraries could not be compiled. Installed vs2020 when there was no way. And changed the tool chain. Now mlua can be compiled. But when I use luaxpath, lxp cannot be loaded normally. Raised this issue
Today I noticed that the library compiled in msys is .so. I deleted the window environment variable of msys2, and installed the mingw of https://nuwen.net/mingw.html in the window system. And lua, luarock. Trying to recompile the lxp file on the window. But luarock prompts when compiling
PS C:\lua\luarocks-3.8.0-win32> luarocks.bat install luaexpat
Installing https://luarocks.org/luaexpat-1.3.3-1.src.rock
Error: Could not find header file for EXPAT
No file expat.h in c:/external/include
No file expat.h in c:/mingw/include
No file expat.h in c:/windows/system32/include
You may have to install EXPAT in your system and/or pass EXPAT_DIR or EXPAT_INCDIR to the luarocks command.
Example: luarocks install luaexpat EXPAT_DIR=/usr/local
I found lxp.dll in the installation directory of lua for window.
But mlua doesn't seem to find the dll to load.
This is it' log.
C:/Users/xm111/.cargo/bin/cargo.exe run --color=always --package luatest --bin luatest
warning: version requirement `210.3.2+resty1085a4d` for dependency `luajit-src` includes semver metadata which will be ignored, removing the metadata is recommended to avoid confusion
Finished dev [unoptimized + debuginfo] target(s) in 0.03s
Running `target\debug\luatest.exe`
1
C:\Users\xm111\CLionProjects\luatest\resources\lua\share\?.lua;C:\Users\xm111\CLionProjects\luatest\resources\lua\share\?\init.lua;C:\Users\xm111\CLionProjects\luatest\resources\lua\share\?\?.lua
C:\\Users\xm111\CLionProjects\luatest\resources\lua\lib\?.dll;C:\\Users\xm111\CLionProjects\luatest\resources\lua\lib\?\?.dll
2
3
expected CallbackError, got RuntimeError("...11\\CLionProjects\\luatest\\resources\\lua\\share\\lxp\\lom.lua:3: module 'lxp' not found:\n\tno field package.preload['lxp']\n\tno file 'C:\\Users\\xm111\\CLionProjects\\luatest\\resources\\lua\\share\\lxp.lua'\n\tno file 'C:\\Users\\xm111\\CLionProjects\\luatest\\resources\\lua\\share\\lxp\\init.lua'\n\tno file 'C:\\Users\\xm111\\CLionProjects\\luatest\\resources\\lua\\share\\lxp\\lxp.lua'\n\t\n\tcan't load C modules in safe mode\nstack traceback:\n\t[C]: in ?\n\t[C]: in function 'require'\n\t...11\\CLionProjects\\luatest\\resources\\lua\\share\\lxp\\lom.lua:3: in main chunk\n\t[C]: in function 'require'\n\t[string \"src\\main.rs:20:15\"]:12: in main chunk")
ss
Process finished with exit code 0
and rs
use std::fs::File;
use std::io::Read;
use std::path::Path;
use mlua::Lua;
fn main() {
let lua = Lua::new();
// let cd = env::current_dir().unwrap();
// let path = format!("package.path=\"{0}\\lua\\share\\?.lua;{0}\\lua\\share\\?\\init.lua\"", cd.to_str().unwrap());
// println!("{}",path);
// let cpath = format!("package.cpath=\"{0}\\lua\\lib\\?.so\"", cd.to_str().unwrap());
// println!("{}",cpath);
let lua_file = File::open(Path::new("./resources/test.lua"));
let mut lua_str = String::new();
lua_file.unwrap().read_to_string(&mut lua_str).unwrap();
// lua.load_from_std_lib(&"")
match lua.load(&lua_str).exec() {
Err(e) => println!("expected CallbackError, got {:?}", e),
Ok(_) => println!("expected CallbackError, got no error"),
};
println!("ss")
}
and lua code:
package.path = 'C:\\Users\\xm111\\CLionProjects\\luatest\\resources\\lua\\share\\?.lua;C:\\Users\\xm111\\CLionProjects\\luatest\\resources\\lua\\share\\?\\init.lua;C:\\Users\\xm111\\CLionProjects\\luatest\\resources\\lua\\share\\?\\?.lua'
package.cpath = 'C:\\\\Users\\xm111\\CLionProjects\\luatest\\resources\\lua\\lib\\?.dll;C:\\\\Users\\xm111\\CLionProjects\\luatest\\resources\\lua\\lib\\?\\?.dll'
--package.cpath = 'C:\\Users\\xm111\\CLionProjects\\luatest\\resources\\lua\\lib\\?.so'
--package.cpath = './lxp.dll'
-- package.path="./lua/share/?.lua;./lua/share/?/init.lua;./lua/lib/?.lua;./lua/lib/?/init.lua"
print("1");
print(package.path)
print(package.cpath)
print("2");
print("3");
local lxp = require "lxp"
print("4");
local x = require "luaxpath"
print("5")
and toml
[package]
name = "luatest"
version = "0.1.0"
edition = "2021"
#build = "build.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
lua-src = "543.1.0"
luajit-src = "210.3.2+resty1085a4d"
mlua = { version = "0.7.0", features = ["async","vendored","lua54"] }
The help I need is:
- I don't know how to compile mlua using the msys2 installation environment. I need to know what to do.
- Why I project not find
.dllto load.
Is there any platform such as discord for this project that can help me?
One of the warning messages you got is:
can't load C modules in safe mode
mlua unable to load C modules unless created inside an unsafe block using unsafe_new method.
It's mentioned in the documentation for the methods new and unsafe_new.
The features of my project are lua54.In lua-src lua version is lua-5.4.3.
To ensure that the lxp.dll file is correct. I compiled and installed lua-5.4.3 and luarocks-3.8.0 in Windows. Use luarocks install luaexpat to compile and install to get the lxp.dll file.
I think this picture can prove that the lxp.dll file I want to load is correct.

But I still failed to load.
mian.rs
use std::fs::File;
use std::io::Read;
use std::path::Path;
use mlua::Lua;
fn main() {
unsafe {
let lua = Lua::unsafe_new();
// let cd = env::current_dir().unwrap();
// let path = format!("package.path=\"{0}\\lua\\share\\?.lua;{0}\\lua\\share\\?\\init.lua\"", cd.to_str().unwrap());
// println!("{}",path);
// let cpath = format!("package.cpath=\"{0}\\lua\\lib\\?.so\"", cd.to_str().unwrap());
// println!("{}",cpath);
let lua_file = File::open(Path::new("D:\\lua\\test.lua"));
let mut lua_str = String::new();
lua_file.unwrap().read_to_string(&mut lua_str).unwrap();
// lua.load_from_std_lib(&"")
match lua.load(&lua_str).exec() {
Err(e) => println!("expected CallbackError, got {:?}", e),
Ok(_) => println!("expected CallbackError, got no error"),
};
}
println!("ss")
}
log
C:/Users/Admin/.cargo/bin/cargo.exe run --color=always --package luatest --bin luatest
warning: version requirement `210.3.2+resty1085a4d` for dependency `luajit-src` includes semver metadata which will be ignored, removing the metadata is recommended to avoid confusion
Finished dev [unoptimized + debuginfo] target(s) in 0.07s
Running `target\debug\luatest.exe`
1
D:\lua\lua\share\?.lua;D:\lua\lua\share\?\init.lua;D:\lua\lua\share\?\?.lua
D:\lua\lua\lib\?.dll;D:\lua\lib\?\?.dll
2
expected CallbackError, got RuntimeError("error loading module 'lxp' from file 'D:\\lua\\lua\\lib\\lxp.dll':\n\t找不到指定的模块。\r\n\nstack traceback:\n\t[C]: in ?\n\t[C]: in ?\n\t[C]: in function 'require'\n\t[string \"src\\main.rs:22:15\"]:11: in main chunk")
ss
Process finished with exit code 0
What is wrong? I want to add xpath function to lua.
The .lua files and .dll files that require require are compiled and installed by luarocks on the window.
Can you provide an example of loading these libraries?
@khvzak
Can you help me with the content in lua.zip above?
Please reopen if this still actual