ManuelBlanc / NecroLua

NecroDancer modding via LuaJIT
GNU General Public License v3.0
5 stars 2 forks source link

Errors running `nmake all` (Cannot open include file: 'detours.h': No such file or directory) #1

Closed pancelor closed 5 years ago

pancelor commented 5 years ago

Hi! I'm trying to build the project but I'm getting this error:

λ nmake all

Microsoft (R) Program Maintenance Utility Version 14.16.27032.1
Copyright (C) Microsoft Corporation.  All rights reserved.

        rc /nologo /DEXENAME=\"NecroLua\" /DDLLNAME=\"NecroLuaAPI\" /DRELEASE=0 /DVERSION=0.3.0 /DVERSION=\"0.3.0\" /DUSERNAME=\"pancelor\" /DCOMPUTERNAME=\"PANCELOR-W-PC\" /r nl_launcher.rc
warning RC4005: 'VERSION' : redefinition
        cl /nologo /W3 /I include /DEXENAME=\"NecroLua\" /DDLLNAME=\"NecroLuaAPI\" /DRELEASE=0 /DVERSION=0.3.0 /c nl_launcher.c
nl_launcher.c
nl_launcher.c(8): fatal error C1083: Cannot open include file: 'detours.h': No such file or directory
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\cl.EXE"' : return code '0x2'
Stop.

This is probably something simple, like something involving my path? or compiler flags to say where detours.h is? or I should have installed detours into a directory that's auto-searched by the compiler? probably it's that last one but I'm new to this sort of stuff (building stuff from source + compiling things on windows) and I'm too exhausted from installing all the prerequisites to figure this out today.

ps. I'm very excited to use this! i've been wishing something like this existed for years and I'm itching to use it :D

pancelor commented 5 years ago

Okay, I've made progress: I manually created the directories "NecroLua/lib" and "NecroLua/include", and have been yolo-copying files into there whenever nmake all gives me a new error saying it can't find something. (I feel like I've got no idea what I'm doing; is there a better way to resolve these errors??)

I've added these files:

$ pwd
/c/Users/pancelor/code/NecroLua

$ ls include lib
include:
detours.h       lj_bc.h         lj_dispatch.h    lj_meta.h        lj_tab.c
host            lj_bc.o         lj_dispatch.o    lj_meta.o        lj_tab.h
jit             lj_bcdef.h      lj_emit_arm.h    lj_obj.c         lj_tab.o
lauxlib.h       lj_bcdump.h     lj_emit_arm64.h  lj_obj.h         lj_target.h
lib_aux.c       lj_bcread.c     lj_emit_mips.h   lj_obj.o         lj_target_arm.h
lib_aux.o       lj_bcread.o     lj_emit_ppc.h    lj_opt_dce.c     lj_target_arm64.h
lib_base.c      lj_bcwrite.c    lj_emit_x86.h    lj_opt_dce.o     lj_target_mips.h
lib_base.o      lj_bcwrite.o    lj_err.c         lj_opt_fold.c    lj_target_ppc.h
lib_bit.c       lj_buf.c        lj_err.h         lj_opt_fold.o    lj_target_x86.h
lib_bit.o       lj_buf.h        lj_err.o         lj_opt_loop.c    lj_trace.c
lib_debug.c     lj_buf.o        lj_errmsg.h      lj_opt_loop.o    lj_trace.h
lib_debug.o     lj_carith.c     lj_ff.h          lj_opt_mem.c     lj_trace.o
lib_ffi.c       lj_carith.h     lj_ffdef.h       lj_opt_mem.o     lj_traceerr.h
lib_ffi.o       lj_carith.o     lj_ffrecord.c    lj_opt_narrow.c  lj_udata.c
lib_init.c      lj_ccall.c      lj_ffrecord.h    lj_opt_narrow.o  lj_udata.h
lib_init.o      lj_ccall.h      lj_ffrecord.o    lj_opt_sink.c    lj_udata.o
lib_io.c        lj_ccall.o      lj_folddef.h     lj_opt_sink.o    lj_vm.h
lib_io.o        lj_ccallback.c  lj_frame.h       lj_opt_split.c   lj_vm.o
lib_jit.c       lj_ccallback.h  lj_func.c        lj_opt_split.o   lj_vmevent.c
lib_jit.o       lj_ccallback.o  lj_func.h        lj_parse.c       lj_vmevent.h
lib_math.c      lj_cconv.c      lj_func.o        lj_parse.h       lj_vmevent.o
lib_math.o      lj_cconv.h      lj_gc.c          lj_parse.o       lj_vmmath.c
lib_os.c        lj_cconv.o      lj_gc.h          lj_profile.c     lj_vmmath.o
lib_os.o        lj_cdata.c      lj_gc.o          lj_profile.h     ljamalg.c
lib_package.c   lj_cdata.h      lj_gdbjit.c      lj_profile.o     lua.h
lib_package.o   lj_cdata.o      lj_gdbjit.h      lj_recdef.h      lua.hpp
lib_string.c    lj_char.c       lj_gdbjit.o      lj_record.c      luaconf.h
lib_string.o    lj_char.h       lj_ir.c          lj_record.h      luajit.c
lib_table.c     lj_char.o       lj_ir.h          lj_record.o      luajit.h
lib_table.o     lj_clib.c       lj_ir.o          lj_snap.c        luajit.o
lj.supp         lj_clib.h       lj_ircall.h      lj_snap.h        lualib.h
lj_alloc.c      lj_clib.o       lj_iropt.h       lj_snap.o        Makefile
lj_alloc.h      lj_cparse.c     lj_jit.h         lj_state.c       Makefile.dep
lj_alloc.o      lj_cparse.h     lj_lex.c         lj_state.h       msvcbuild.bat
lj_api.c        lj_cparse.o     lj_lex.h         lj_state.o       ps4build.bat
lj_api.o        lj_crecord.c    lj_lex.o         lj_str.c         psvitabuild.bat
lj_arch.h       lj_crecord.h    lj_lib.c         lj_str.h         vm_arm.dasc
lj_asm.c        lj_crecord.o    lj_lib.h         lj_str.o         vm_arm64.dasc
lj_asm.h        lj_ctype.c      lj_lib.o         lj_strfmt.c      vm_mips.dasc
lj_asm.o        lj_ctype.h      lj_libdef.h      lj_strfmt.h      vm_mips64.dasc
lj_asm_arm.h    lj_ctype.o      lj_load.c        lj_strfmt.o      vm_ppc.dasc
lj_asm_arm64.h  lj_debug.c      lj_load.o        lj_strfmt_num.c  vm_x64.dasc
lj_asm_mips.h   lj_debug.h      lj_mcode.c       lj_strfmt_num.o  vm_x86.dasc
lj_asm_ppc.h    lj_debug.o      lj_mcode.h       lj_strscan.c     xb1build.bat
lj_asm_x86.h    lj_def.h        lj_mcode.o       lj_strscan.h     xedkbuild.bat
lj_bc.c         lj_dispatch.c   lj_meta.c        lj_strscan.o

lib:
detours.lib

The current error I'm getting is:

λ nmake all

Microsoft (R) Program Maintenance Utility Version 14.16.27032.1
Copyright (C) Microsoft Corporation.  All rights reserved.

        cl /Fe:NecroLuaAPI.dll nl_payload.obj nl_luainit.obj /LD /link /nologo /LIBPATH:lib
LINK : fatal error LNK1104: cannot open file 'lua51.lib'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\cl.EXE"' : return code '0x2'
Stop.

I searched for lua51.lib (I ran find . -name 'lua51.lib' in the source and built directories for luajit) but can't find it. Any ideas?

(oh btw in case this was confusing: I'm using bash for most of my commands (the ones that start with $) because I'm more familiar with it, but I'm using cmder (the commands that start with λ) to run nmake b/c that was the easy thing to do, because of the way vcvarsall seems to work)

pancelor commented 5 years ago

Okay, after some DMs with @ManuelBlanc, everything is now working!!

For any future people with the same problems:

  1. I was using the 64 bit msvc toolchain. Don't use vcvarsall.bat x64; use vcvarsall.bat x86 to load the toolchain instead
  2. I was originally building luajit using mingw32-make; this was wrong (the docs say it doesn't work on windows, but I didn't read that part). Running mingw32-make clean to remove the bad binaries and then running src/msvcbuild.bat worked. This also generated a lua51.lib file (which is what I was stuck on as of my last comment in this thread)
  3. These are the required include and lib files:
    
    $ pwd
    /c/Users/pancelor/code/NecroLua

$ ls lib/ include/ include/: detours.h lauxlib.h lua.h luaconf.h luajit.h lualib.h

lib/: detours.lib lua51.dll lua51.lib



I've added info about all of this to the README in #2