Search code examples
c++makefileluaemscriptenunix-ar

hit roadblock while trying to compile lua for emscripten usage, using windows, "unable to find ar rcu"


i've been stuck on this problem for hours, without finding any solutions. I'm currently trying to compile lua 5.3.4 for Emscripten for use in my project. ive hit a roadblock thought, I need to compile it to a liblua.a file which ill later use when doing the emcc command line. but theres problems. heres the console output and what i do. ive gotten it to output .o files already. how do i put these in the .a (since i assume thats what its doing)

E:\code\liblua>make generic CC="emcc -s WASM=1"
cd src && make generic
make[1]: se ingresa al directorio `E:/code/liblua/src'
ar rcu liblua.a lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o 1lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o lauxlib.o lbaselib.o lbitlib.o lcorolib.o ldblib.o liolib.o lmathlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o loadlib.o linit.o
process_begin: CreateProcess(NULL, ar rcu liblua.a lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o lauxlib.o lbaselib.o lbitlib.o lcorolib.o ldblib.o liolib.o lmathlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o loadlib.o linit.o, ...) failed.
make (e=2): El sistema no puede encontrar el archivo especificado. (system cannot find the specified file)
make[1]: *** [liblua.a] Error 2
make[1]: se sale del directorio `E:/code/liblua/src'
make: *** [generic] Error 2

what it says is that it cant find ar rcu, how do i use it on my system?

for reference, the system im trying to use can be found here https://github.com/vvanders/wasm_lua if its required


Solution

  • It looks like the requires Un*x tools so I suggest:

    • Install Windows Subsystem for Linux 2 (WSL2).
    • Install the Ubuntu 20.04 distribution in WSL2.
    • Start a shell by double clicking the Ubuntu 20.04 LTS icon.
    • From the shell, install the tools needed. A minimal set for this whould be:
      sudo apt install g++ binutils make libc-bin
      ... or for a more complete set of packages:
      sudo apt install build-essential
    • Unpack the lua distribution (as yourself, not the root user) somewhere in your home directory and try building.