Skip to content

Conversation

davehorner
Copy link

  • docs(readme): switch to npm run build instead of node run build
  • build: use npx for tsc, detect platform for math-lib flags and wasm compiler
  • build: introduce getMathLibFlag(), getWasmCompiler() and getPackerOutput()
  • build: validate existence of build/pack.h, throwing a clear error if missing
  • build: update clang invocations for WASM to include correct include paths and output filenames

I believe we are down to c3 issues; too much for my recreational session today.

  • construct PingMessage via struct initializer and call platform::send_message(&ping_msg)
  • change other_players to var other_players: HashMap(uint, Player)
  • streamline os::native_fwrite_fn lambda signature

Here’s a summary of what we did to get your build working:

  1. Cross-Platform Build Fixes:

    • Updated your build.js to use npx for TypeScript compilation in a way that works on both Windows and Unix.
    • Patched the script so that the C packer binary is named packer.exe on Windows and packer elsewhere, and all references use the correct name.
  2. Math Library Linking:

    • Fixed the build script to only add the -lm flag (math library) on non-Windows platforms, preventing linker errors on Windows.
  3. Wasm Compilation on Windows:

    • Switched the wasm build commands to use emcc (Emscripten) on Windows, since standard clang does not support wasm32 out of the box.
  4. Build Order and File Generation:

    • Ensured that pack.h is generated by running the packer before any compilation steps that require it.
    • Added a check to throw a clear error if pack.h is not generated.
  5. C3 Source Code Fixes:

    • Fixed struct literal usage by assigning to a temporary variable before taking its address.
    • Removed or corrected invalid type aliasing for generics in C3.
    • Corrected function literal syntax for C3.
    • Cleaned up other C3 syntax issues as reported by the compiler.

I used the following:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression1
scoop install c3

you need to install and do a emsdk_env before building. https://emscripten.org/docs/getting_started/downloads.html I installed via choco; I'm not sure I suggest it.

we're closer to a working build for windows.

- docs(readme): switch to `npm run build` instead of `node run build`
- build: use `npx` for tsc, detect platform for math-lib flags and wasm compiler
- build: introduce `getMathLibFlag()`, `getWasmCompiler()` and `getPackerOutput()`
- build: validate existence of `build/pack.h`, throwing a clear error if missing
- build: update clang invocations for WASM to include correct include paths and output filenames

I believe we are down to c3 issues; too much for my recreational
session today.
- construct `PingMessage` via struct initializer and call `platform::send_message(&ping_msg)`
- change `other_players` to `var other_players: HashMap(uint, Player)`
- streamline `os::native_fwrite_fn` lambda signature

Here’s a summary of what we did to get your build working:

1. **Cross-Platform Build Fixes:**
   - Updated your build.js to use `npx` for TypeScript compilation in a way that works on both Windows and Unix.
   - Patched the script so that the C packer binary is named `packer.exe` on Windows and `packer` elsewhere, and all references use the correct name.

2. **Math Library Linking:**
   - Fixed the build script to only add the `-lm` flag (math library) on non-Windows platforms, preventing linker errors on Windows.

3. **Wasm Compilation on Windows:**
   - Switched the wasm build commands to use `emcc` (Emscripten) on Windows, since standard clang does not support `wasm32` out of the box.

4. **Build Order and File Generation:**
   - Ensured that pack.h is generated by running the packer before any compilation steps that require it.
   - Added a check to throw a clear error if pack.h is not generated.

5. **C3 Source Code Fixes:**
   - Fixed struct literal usage by assigning to a temporary variable before taking its address.
   - Removed or corrected invalid type aliasing for generics in C3.
   - Corrected function literal syntax for C3.
   - Cleaned up other C3 syntax issues as reported by the compiler.

I used the following:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression1
scoop install c3

you need to install and do a emsdk_env before building.
https://emscripten.org/docs/getting_started/downloads.html
I installed via choco; I'm not sure I suggest it.

we're closer to a working build for windows.
@davehorner
Copy link
Author

last_build_attempt_250610.txt
attached is the full log from where I stopped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant