3

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

19
  • 1
    Yeah, I just tried your rcu options and it worked even if the archive wasn't there. What does your system say if you do ar --version?
    – Ted Lyngmo
    Commented Sep 24, 2020 at 17:20
  • 1
    I'm not sure, but it looks like it tries to use *nix tools. You could install WSL2 + Ubuntu 20.04 on your windows machine. It's feels pretty close to working on a linux machine. sudo apt install g++ binutils make libc-bin should then give you some basic tools.
    – Ted Lyngmo
    Commented Sep 24, 2020 at 17:29
  • 1
    You don't need to use powershell for anything if this works, only the Ubuntu bash shell. The tools I listed may not be enough though. When you do make ... it may complain about other missing tools - but at least then it'll be simple. You only need to figure out in which package the tool exists and then install that package with sudo apt install packagename
    – Ted Lyngmo
    Commented Sep 24, 2020 at 17:40
  • 1
    Okay, after a while, I've gotten back to the ar rcu part, it seems to work now on the subsystem. theres another error though ar: liblua.a: Permission denied renca@LAPTOP-JDSC2N7P:~/lua-5.3.4/src$ ar rvs liblua.a ar: liblua.a: Permission denied
    – user11605613
    Commented Sep 24, 2020 at 17:51
  • 1
    Odd... Check the permissions ls -l liblua.a. Is the file owned by root or you? It should be owned by you, so sudo chown yourusername liblua.a if it's not. Also check that it's writeable and make it so that if it isn't.
    – Ted Lyngmo
    Commented Sep 24, 2020 at 17:59

1 Answer 1

0

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.