jcmoyer / rust-lua53

Lua 5.3 bindings for Rust
MIT License
158 stars 45 forks source link

Can't compile on Windows "No rule to make target" #93

Open Tyde opened 5 years ago

Tyde commented 5 years ago

Hi, when I try to compile the crate I do get the following error:

--- stdout
cargo:rustc-link-lib=static=lua
OPT_LEVEL = Some("0")
TARGET = Some("x86_64-pc-windows-gnu")
HOST = Some("x86_64-pc-windows-gnu")
TARGET = Some("x86_64-pc-windows-gnu")
TARGET = Some("x86_64-pc-windows-gnu")
HOST = Some("x86_64-pc-windows-gnu")
CC_x86_64-pc-windows-gnu = None
CC_x86_64_pc_windows_gnu = None
HOST_CC = None
CC = None
TARGET = Some("x86_64-pc-windows-gnu")
HOST = Some("x86_64-pc-windows-gnu")
CFLAGS_x86_64-pc-windows-gnu = None
CFLAGS_x86_64_pc_windows_gnu = None
HOST_CFLAGS = None
CFLAGS = None
DEBUG = Some("true")
make -e -f "C:/Users/Tyde/.cargo/git/checkouts/rust-lua53-382fc6466662b050/c855949/lua-source/src/Makefile" "LUA_A=lua53.dll" "LUA_T=lua.exe" \
        "AR=gcc.exe -shared -o" "RANLIB=strip --strip-unneeded" \
        "SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe
make[1]: Entering directory `/c/Users/Tyde/rustws/lua_interop/target/debug/build/lua-400f40c450b96a19/out'
make[1]: Leaving directory `/c/Users/Tyde/rustws/lua_interop/target/debug/build/lua-400f40c450b96a19/out'

--- stderr
make[1]: *** No rule to make target `lua.c', needed by `lua.o'.  Stop.
make.exe": *** [mingw] Error 2
thread 'main' panicked at 'Error: The command
        "make" "-e" "-f" "C:\\Users\\Tyde\\.cargo\\git\\checkouts\\rust-lua53-382fc6466662b050\\c855949\\lua-source/src\\Makefile" "mingw"
did not run successfully.', C:\Users\Tyde\.cargo\git\checkouts\rust-lua53-382fc6466662b050\c855949\build.rs:176:19
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

this error message seems to indicate, that the makefile isn't able to find lua.c. I also tried running that exact make task in the lua-source/src/ folder and it seems to work here. Is there something needed to allow the makefile to find lua.c?

Tyde commented 5 years ago

I've found the reason for this error. On windows (at least in my build environment) the VPATH needs the backslashes which are replaced with slashes in the build.rs. When I fixed it, it compiled (see https://github.com/Tyde/rust-lua53/commit/2d2a2c5778bfe4af6daf4791767316ab459555b6)