paranim / paranim_examples

The Unlicense
10 stars 0 forks source link

cannot build voxel_explorer web version #2

Open levshx opened 1 year ago

levshx commented 1 year ago

Nim Compiler Version 1.6.6 [Windows: amd64] emcc 3.1.31

\voxel_explorer>
 *  Журнал восстановлен 

  Verifying dependencies for voxel_explorer@0.1.0
      Info: Dependency on paranim@>= 0.12.0 already satisfied
  Verifying dependencies for paranim@0.12.0
      Info: Dependency on nimgl@>= 1.1.9 already satisfied
  Verifying dependencies for nimgl@1.3.2
      Info: Dependency on glm@>= 1.1.1 already satisfied
  Verifying dependencies for glm@1.1.1
      Info: Dependency on pararules@>= 1.4.0 already satisfied
  Verifying dependencies for pararules@1.4.0
      Info: Dependency on stb_image@>= 2.5 already satisfied
  Verifying dependencies for stb_image@2.5
      Info: Dependency on paravim@>= 0.18.4 already satisfied
  Verifying dependencies for paravim@0.18.4
      Info: Dependency on paranim@>= 0.12.0 already satisfied
  Verifying dependencies for paranim@0.12.0
      Info: Dependency on nimgl@>= 1.1.9 already satisfied
  Verifying dependencies for nimgl@1.3.2
      Info: Dependency on glm@>= 1.1.1 already satisfied
  Verifying dependencies for glm@1.1.1
      Info: Dependency on pararules@>= 1.2.0 already satisfied
  Verifying dependencies for pararules@1.4.0
      Info: Dependency on paratext@>= 0.13.0 already satisfied
  Verifying dependencies for paratext@0.13.0
      Info: Dependency on illwill@>= 0.2.0 already satisfied
  Verifying dependencies for illwill@0.3.0
   Building voxel_explorer/voxel_explorer.exe using c backend
C:\Users\user\.nimble\pkgs\glm-1.1.1\glm\vec.nim(408, 20) Warning: the .deprecated pragma is unreliable for routines [User]
C:\Users\user\.nimble\pkgs\glm-1.1.1\glm\vec.nim(409, 22) Warning: the .deprecated pragma is unreliable for routines [User]
C:\Users\user\Documents\Projects\nim\CriticEngine\voxel_explorer\src\stb_voxel_render.nim(261, 90) Warning: use `csize_t` instead; csize is deprecated [Deprecated]
C:\Users\user\Documents\Projects\nim\CriticEngine\voxel_explorer\src\mesh_builder.nim(29, 41) Warning: use `csize_t` instead; csize is deprecated [Deprecated]
C:\Users\user\Documents\Projects\nim\CriticEngine\voxel_explorer\src\mesh_builder.nim(2, 26) Warning: imported and not used: 'u_noise' [UnusedImport]
C:\Users\user\Documents\Projects\nim\CriticEngine\voxel_explorer\src\core.nim(3, 30) Warning: imported and not used: 'entities' [UnusedImport]
C:\Users\user\Documents\Projects\nim\CriticEngine\voxel_explorer\src\voxel_explorer.nim(3, 6) Warning: imported and not used: 'mesh_builder' [UnusedImport]
C:\Users\user\Documents\Projects\nim\CriticEngine\voxel_explorer\src\mesh_builder.c:233:16: error: call to undeclared library function 'memset'
      with type 'void *(void *, int, unsigned long)'; ISO C99 and later do not support implicit function declarations
      [-Wimplicit-function-declaration]
               memset(gcp->block[j][i], BT_empty, Z_SEGMENT_SIZE);
               ^
C:\Users\user\Documents\Projects\nim\CriticEngine\voxel_explorer\src\mesh_builder.c:233:16: note: include the header <string.h> or explicitly
      provide a declaration for 'memset'
C:\Users\user\Documents\Projects\nim\CriticEngine\voxel_explorer\src\mesh_builder.c:350:16: error: call to undeclared library function 'memcpy'

     with type 'void *(void *, const void *, unsigned long)'; ISO C99 and later do not support implicit function declarations
      [-Wimplicit-function-declaration]
               memcpy(&bd->segment_blocktype[y+y_off][x + x_off][0], &gcp->block   [y][x][0], 16);
               ^
C:\Users\user\Documents\Projects\nim\CriticEngine\voxel_explorer\src\mesh_builder.c:350:16: note: include the header <string.h> or explicitly
      provide a declaration for 'memcpy'
C:\Users\user\Documents\Projects\nim\CriticEngine\voxel_explorer\src\mesh_builder.c:370:24: error: incompatible integer to pointer conversion
      assigning to 'unsigned char *' from 'unsigned char'; take the address with & [-Wint-conversion]
   map->block_geometry = geom_for_blocktype[0];
                       ^ ~~~~~~~~~~~~~~~~~~~~~
                         &
3 errors generated.
emcc: error: 'C:/Users/user/Documents/emsdk/upstream/bin\clang.exe -target wasm32-unknown-emscripten -fignore-exceptions -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -DEMSCRIPTEN -Werror=implicit-function-declaration --sysroot=C:\Users\user\Documents\emsdk\upstream\emscripten\cache\sysroot -Xclang -iwithsysroot/include\fakesdl -Xclang -iwithsysroot/include\compat -c -w -ferror-limit=3 -Os "-IC:\Program Files\nim\nim-1.6.6\lib" -IC:\Users\user\Documents\Projects\nim\CriticEngine\voxel_explorer\src C:\Users\user\Documents\Projects\nim\CriticEngine\voxel_explorer\src\mesh_builder.c -o C:\Users\user\Documents\Projects\nim\CriticEngine\voxel_explorer\tmp\mesh_builder.c.o' failed (returned 1)
Error: execution of an external compiler program 'emcc.bat -c -w -ferror-limit=3 -Os   -I"C:\Program Files\nim\nim-1.6.6\lib" -IC:\Users\user\Documents\Projects\nim\CriticEngine\voxel_explorer\src -o C:\Users\user\Documents\Projects\nim\CriticEngine\voxel_explorer\tmp\mesh_builder.c.o C:\Users\user\Documents\Projects\nim\CriticEngine\voxel_explorer\src\mesh_builder.c' failed with exit code: 1

       Tip: 25 messages have been suppressed, use --verbose to show them.
     Error: Build failed for package: voxel_explorer
        ... Execution failed with exit code 1
        ... Command: "C:\Program Files\nim\nim-1.6.6\bin\nim.exe" c --colors:on --noNimblePath -d:release -d:emscripten -d:NimblePkgVersion=0.1.0 --path:C:\Users\user\.nimble\pkgs\paranim-0.12.0 --path:C:\Users\user\.nimble\pkgs\nimgl-1.3.2 --path:C:\Users\user\.nimble\pkgs\glm-1.1.1 --path:C:\Users\user\.nimble\pkgs\pararules-1.4.0 --path:C:\Users\user\.nimble\pkgs\stb_image-2.5 --path:C:\Users\user\.nimble\pkgs\paravim-0.18.4 --path:C:\Users\user\.nimble\pkgs\paranim-0.12.0 --path:C:\Users\user\.nimble\pkgs\nimgl-1.3.2 --path:C:\Users\user\.nimble\pkgs\glm-1.1.1 --path:C:\Users\user\.nimble\pkgs\pararules-1.4.0 --path:C:\Users\user\.nimble\pkgs\paratext-0.13.0 --path:C:\Users\user\.nimble\pkgs\illwill-0.3.0 --hints:off -o:C:\Users\user\Documents\Projects\nim\CriticEngine\voxel_explorer\voxel_explorer.exe C:\Users\user\Documents\Projects\nim\CriticEngine\voxel_explorer\src\voxel_explorer.nim
oakes commented 1 year ago

Yeah this never actually worked, despite the README giving instructions for it. What you ran into was a minor compile error, which I just fixed in the latest commit. However, it will still fail during linking with this error:

error: undefined symbol: glTexBuffer (referenced by top-level compiled C/C++ code)

This is because it uses buffer textures, which aren't supported in webgl. The voxel code comes from obbg which was never meant to run in webgl. It would be cool to change it no longer use buffer textures but I'm not sure how much work that'd be.