Skip to content

Windows build issue via cmake generated files for TIC-80 #1293

@sogaiu

Description

@sogaiu

We're trying to update the version of Janet used in TIC-80 and are encountering issues for Windows builds in CI.

When trying to build via TIC-80's cmake generated files, the following sort of output is observed:

state.obj : error LNK2019: unresolved external symbol _InterlockedIncrement referenced in function _janet_interpreter_interrupt [D:\a\TIC-80\TIC-80\build\janet.vcxproj]
state.obj : error LNK2019: unresolved external symbol _InterlockedDecrement referenced in function _janet_interpreter_interrupt_handled [D:\a\TIC-80\TIC-80\build\janet.vcxproj]
build\janet_boot.exe : fatal error LNK1120: 2 unresolved externals [D:\a\TIC-80\TIC-80\build\janet.vcxproj]

via: https://github.com/nesbox/TIC-80/actions/runs/6223953191/job/16891060122?pr=2306#step:4:1692

I noticed that some other source files under Janet's src/core have includes for the Windows case, so I tried the following patch to src/core/state.c:

diff --git a/src/core/state.c b/src/core/state.c
index 4c976da..b17fb9d 100644
--- a/src/core/state.c
+++ b/src/core/state.c
@@ -53,6 +53,10 @@ void janet_vm_load(JanetVM *from) {
     janet_vm = *from;
 }
 
+#ifdef JANET_WINDOWS
+#include "windows.h"
+#endif
+
 /* Trigger suspension of the Janet vm by trying to
  * exit the interpeter loop when convenient. You can optionally
  * use NULL to interrupt the current VM when convenient */

This made the build work for TIC-80 on Windows (at least in a local setup meant to mimick relevant aspects of GitHub's CI).

Is the above sort of change superfluous [1]?

cc: @AlecTroemel


[1] I don't understand why Janet itself (outside of the TIC-80 context) builds fine without it (via an appropriate Native command prompt -- I verified this) and the build fails for TIC-80. Both invoke build_win.bat...so I guess something may be different about TIC-80's setup but I have not succeeded in determining what that is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions