edubart / nelua-lang

Minimal, efficient, statically-typed and meta-programmable systems programming language heavily inspired by Lua, which compiles to C and native code.
https://nelua.io
MIT License
2k stars 62 forks source link

Problem by rpmalloc when installing on Windows 10 #36

Closed ghost closed 3 years ago

ghost commented 3 years ago

Hi there!

Anyway, I followed tutorial and tried to installed nelua, When i build on my Windows 10 device i get weird error related to rpmalloc, Here is log:

D:\msys64\home\steri\nelua-lang>make install

make --no-print-directory -C src
gcc -o nelua-lua.exe \
        -DNDEBUG -DLUA_COMPAT_5_3 -DLUAI_MAXCSTACK=16384 -DLUA_USE_RPMALLOC -DENABLE_GLOBAL_CACHE=0 -DBUILD_DYNAMIC_LINK -DLUA_ROOT='"/usr/local/"' \
        -Ilua \
        -Wall -O2 -fno-plt -fno-stack-protector -flto  \
        -s  \
        lua/onelua.c rpmalloc/rpmalloc.c lfs.c sys.c hasher.c lpeglabel/*.c  \
        -lm
rpmalloc/rpmalloc.c: In function '_rpmalloc_mmap_os':
rpmalloc/rpmalloc.c:776:68: error: 'MEM_LARGE_PAGES' undeclared (first use in this function); did you mean 'MEM_4MB_PAGES'?
  776 |  void* ptr = VirtualAlloc(0, size + padding, (_memory_huge_pages ? MEM_LARGE_PAGES : 0) | MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
      |                                                                    ^~~~~~~~~~~~~~~
      |                                                                    MEM_4MB_PAGES
rpmalloc/rpmalloc.c:776:68: note: each undeclared identifier is reported only once for each function it appears in
rpmalloc/rpmalloc.c: In function 'rpmalloc_initialize_config':
rpmalloc/rpmalloc.c:2422:31: warning: implicit declaration of function 'GetLargePageMinimum' [-Wimplicit-function-declaration]
 2422 |   size_t large_page_minimum = GetLargePageMinimum();
      |                               ^~~~~~~~~~~~~~~~~~~
lfs.c: In function 'push_link_target':
lfs.c:1115:9: warning: implicit declaration of function 'memmove_s'; did you mean 'memmove'? [-Wimplicit-function-declaration]
 1115 |         memmove_s(target, tsize - 3, target + 4, tsize - 3);
      |         ^~~~~~~~~
      |         memmove
make[1]: *** [Makefile:55: nelua-lua.exe] Error 1
make: *** [Makefile:188: install] Error 2

idk what causes this, I also tried to rename 'MEM_LARGE_PAGES' to 'MEM_4MB_PAGES' but didn't solved problem and still give error related to large page by rpmalloc...

I need help to know what causes this, Thanks for everything!

edubart commented 3 years ago

Looks like your compiler is missing GetLargePageMinimum and other symbols that is defined since Windows Vista, updating your compiler headers should hopefully fix the issue.

Nevertheless I've added a make flag to allow compiling the bundled Lua interpreter without rpmalloc enabled in commit https://github.com/edubart/nelua-lang/commit/219db0345e8948d30fd8319e48afd13139ea5db3, do make NO_RPMALLOC=true after updating and it should compile.

ghost commented 3 years ago

Thankful! I'll try to re-setup MinGW GCC on MSYS, Although it should not happen i see...

But if re-setup didn't solved anything i might tell you about it sooner...

edubart commented 3 years ago

Closing, because he confirmed that updating MSYS2 resolved the problem.