nim-lang / nimforum

Lightweight alternative to Discourse written in Nim
https://forum.nim-lang.org/
MIT License
760 stars 70 forks source link

cannot compile on windows with mingw (bcrypt; "u_int32_t unknown type name") #329

Closed enthus1ast closed 2 years ago

enthus1ast commented 2 years ago
PS C:\Users\david\projects\nimforum> nimble backend
  Executing task backend in C:\Users\david\projects\nimforum\nimforum.nimble
  Verifying dependencies for nimforum@2.2.0
   Warning: No .nimble or .nimble-link file found for C:\Users\david\.nimble\pkgs\autome-0.1.2
   Warning: No .nimble or .nimble-link file found for C:\Users\david\.nimble\pkgs\bcrypt-#440c5676ff6
   Warning: No .nimble or .nimble-link file found for C:\Users\david\.nimble\pkgs\karax-1.1.2
   Warning: No .nimble or .nimble-link file found for C:\Users\david\.nimble\pkgs\strenc-0.1.0
   Warning: No .nimble or .nimble-link file found for C:\Users\david\.nimble\pkgs\with-0.4.0
   Warning: No .nimble or .nimble-link file found for C:\Users\david\.nimble\pkgs\zip-0.2.1
      Info: Dependency on httpbeast@>= 0.4.0 already satisfied
  Verifying dependencies for httpbeast@0.4.0
      Info: Dependency on asynctools@#0e6bdc3ed5bae8c7cc9 already satisfied
  Verifying dependencies for asynctools@#0e6bdc3ed5bae8c7cc9
      Info: Dependency on jester@#405be2e already satisfied
  Verifying dependencies for jester@#405be2e
      Info: Dependency on https://github.com/timotheecour/asynctools@#pr_fix_compilation already satisfied
  Verifying dependencies for asynctools@#pr_fix_compilation
 Installing bcrypt@#440c5676ff6
Downloading https://github.com/ithkuil/bcryptnim using git
  Verifying dependencies for bcrypt@#440c5676ff6
 Installing bcrypt@#440c5676ff6
   Success: bcrypt installed successfully.
      Info: Dependency on hmac@#9c61ebe2fd134cf97 already satisfied
  Verifying dependencies for hmac@#9c61ebe2fd134cf97
      Info: Dependency on nimSHA2@any version already satisfied
  Verifying dependencies for nimSHA2@0.1.1
      Info: Dependency on sha1@any version already satisfied
  Verifying dependencies for sha1@1.1
      Info: Dependency on recaptcha@#d06488e already satisfied
  Verifying dependencies for recaptcha@#d06488e
      Info: Dependency on sass@#649e0701fa5c already satisfied
  Verifying dependencies for sass@#649e0701fa5c
      Info: Dependency on karax@#5f21dcd already satisfied
  Verifying dependencies for karax@#5f21dcd
      Info: Dependency on webdriver@#429933a already satisfied
  Verifying dependencies for webdriver@#429933a
  Compiling src/forum (from package nimforum) using c backend
C:\Users\david\.choosenim\toolchains\nim-1.6.4\lib\impure\db_sqlite.nim(184, 1) Warning: Circular dependency detected. `codeReordering` 
pragma may not be able to reorder some nodes properly [User]
C:\Users\david\projects\nimforum\src\frontend\karaxutils.nim(21, 10) Warning: See corresponding Defect; OverflowError is deprecated [Deprecated]
C:\Users\david\projects\nimforum\src\frontend\karaxutils.nim(34, 10) Warning: See corresponding Defect; OverflowError is deprecated [Deprecated]
C:\Users\david\projects\nimforum\src\frontend\karaxutils.nim(1, 41) Warning: imported and not used: 'tables' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\karaxutils.nim(1, 18) Warning: imported and not used: 'strformat' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\error.nim(1, 8) Warning: imported and not used: 'httpcore' [UnusedImport]
C:\Users\david\projects\nimforum\src\utils.nim(32, 17) Warning: inherit from a more precise exception type like ValueError, IOError or OSError. If these don't suit, inherit from CatchableError or Defect. [InheritFromException]
C:\Users\david\projects\nimforum\src\utils.nim(1, 8) Warning: imported and not used: 'asyncdispatch' [UnusedImport]
C:\Users\david\projects\nimforum\src\utils.nim(1, 23) Warning: imported and not used: 'smtp' [UnusedImport]
C:\Users\david\projects\nimforum\src\utils.nim(3, 6) Warning: imported and not used: 'times' [UnusedImport]
C:\Users\david\projects\nimforum\src\utils.nim(2, 36) Warning: imported and not used: 'options' [UnusedImport]
C:\Users\david\projects\nimforum\src\utils.nim(10, 16) Warning: imported and not used: 'karaxutils' [UnusedImport]
C:\Users\david\projects\nimforum\src\buildcss.nim(12, 10) Warning: use dirExists; existsDir is deprecated [Deprecated]
C:\Users\david\projects\nimforum\src\frontend\threadlist.nim(1, 8) Warning: imported and not used: 'strformat' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\threadlist.nim(1, 19) Warning: imported and not used: 'times' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\threadlist.nim(1, 26) Warning: imported and not used: 'options' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\threadlist.nim(1, 35) Warning: imported and not used: 'json' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\threadlist.nim(1, 41) Warning: imported and not used: 'httpcore' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\threadlist.nim(1, 51) Warning: imported and not used: 'sugar' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\postlist.nim(6, 20) Warning: imported and not used: 'category' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\postlist.nim(3, 8) Warning: imported and not used: 'options' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\postlist.nim(3, 17) Warning: imported and not used: 'json' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\postlist.nim(3, 23) Warning: imported and not used: 'times' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\postlist.nim(3, 30) Warning: imported and not used: 'httpcore' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\postlist.nim(3, 40) Warning: imported and not used: 'sugar' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\postlist.nim(3, 47) Warning: imported and not used: 'strutils' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\postlist.nim(4, 8) Warning: imported and not used: 'sequtils' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\postlist.nim(6, 36) Warning: imported and not used: 'user' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\header.nim(1, 17) Warning: imported and not used: 'httpcore' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\profile.nim(1, 8) Warning: imported and not used: 'options' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\profile.nim(1, 17) Warning: imported and not used: 'httpcore' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\profile.nim(1, 27) Warning: imported and not used: 'json' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\profile.nim(1, 33) Warning: imported and not used: 'sugar' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\profile.nim(1, 40) Warning: imported and not used: 'times' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\profile.nim(1, 47) Warning: imported and not used: 'strutils' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\profile.nim(3, 8) Warning: imported and not used: 'threadlist' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\profile.nim(3, 20) Warning: imported and not used: 'post' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\profile.nim(3, 26) Warning: imported and not used: 'error' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\profile.nim(3, 33) Warning: imported and not used: 'user' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\search.nim(2, 39) Warning: imported and not used: 'times' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\search.nim(2, 14) Warning: imported and not used: 'options' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\search.nim(2, 23) Warning: imported and not used: 'httpcore' [UnusedImport]
C:\Users\david\projects\nimforum\src\frontend\search.nim(2, 33) Warning: imported and not used: 'json' [UnusedImport]
C:\Users\david\projects\nimforum\src\forum.nim(817, 1) template/generic instantiation of `routes` from here
C:\Users\david\.nimble\pkgs\jester-#405be2e\jester.nim(1297, 35) template/generic instantiation of `async` from here
C:\Users\david\.choosenim\toolchains\nim-1.6.4\lib\pure\asyncmacro.nim(231, 24) Warning: 'sendResetPasswordNimAsyncContinue' is not GC-safe as it calls 'nameIterVar`gensym16' [GcUnsafe2]
C:\Users\david\projects\nimforum\src\forum.nim(817, 1) template/generic instantiation of `routes` from here
C:\Users\david\.nimble\pkgs\jester-#405be2e\jester.nim(1297, 35) template/generic instantiation of `async` from here
C:\Users\david\projects\nimforum\src\forum.nim(93, 6) Warning: 'sendResetPassword' is not GC-safe as it calls 'sendResetPasswordNimAsyncContinue' [GcUnsafe2]
C:\Users\david\projects\nimforum\src\forum.nim(817, 1) template/generic instantiation of `routes` from here
C:\Users\david\.nimble\pkgs\jester-#405be2e\jester.nim(1297, 35) template/generic instantiation of `async` from here
C:\Users\david\.choosenim\toolchains\nim-1.6.4\lib\pure\asyncmacro.nim(200, 31) Warning: 'matchIter' is not GC-safe as it calls 'sendResetPassword' [GcUnsafe2]
C:\Users\david\projects\nimforum\src\forum.nim(13, 3) Warning: imported and not used: 'strformat' [UnusedImport]
C:\Users\david\projects\nimforum\src\forum.nim(11, 26) Warning: imported and not used: 'asyncnet' [UnusedImport]
C:\Users\david\projects\nimforum\src\forum.nim(12, 3) Warning: imported and not used: 'parseutils' [UnusedImport]
C:\Users\david\projects\nimforum\src\forum.nim(20, 16) Warning: imported and not used: 'profile' [UnusedImport]
C:\Users\david\projects\nimforum\src\forum.nim(10, 38) Warning: imported and not used: 'math' [UnusedImport]
In file included from C:\Users\david\.nimble\pkgs\bcrypt-#440c5676ff6\bcrypt\blowfish.c:53:
C:\Users\david\.nimble\pkgs\bcrypt-#440c5676ff6\bcrypt\blowfish.h:56:2: C:\Users\david\.nimble\pkgs\bcrypt-#440c5676ff6\bcrypt\arc4random.c:48:2:        C:\Users\david\.nimble\pkgs\bcrypt-#440c5676ff6\bcrypt\crypt-blowfish.c:74:10:                   error:  u_int32_tunknown type name 'fatal error: '
   56 |  u_int8_tpwd.h: No such file or directory
   74 | #include          '
   48 |          S[4][256]; /* S-Boxes */
      |  u_int8_t
      |          ^~~~~~~~~ i;
      |  ^~~~~~~
^~~~~~~~
cC:\Users\david\.nimble\pkgs\bcrypt-#440c5676ff6\bcrypt\blowfish.h:57:2:
o  p                                                                         i       l aunknown type name 't       i         ounknown type name 'n'
   57 |   u_int8_ttu_int32_te'
   49 |  r P[BLF_N + 2]; /* Subkeys */
      |  m        i         n j;
      |  a
t^~~~~~~~ d
C:\Users\david\.nimble\pkgs\bcrypt-#440c5676ff6\bcrypt\blowfish.h:66:35:.
 C:\Users\david\.nimble\pkgs\bcrypt-#440c5676ff6\bcrypt\arc4random.c:50:2:error:                     error: u_int32_tunknown type name  
'; did you mean 'u_int8_tuint32_t'
   50 |  '?
   66 | v                                 u_int8_tu_int32_t s[256];
      |   *, u_int32_t *);
      |                                   ^~~~~~~~^~~~~~~~~
c
      |                                   o puint32_til
Error: acexecution of otamin openix lttaeetrrinmoialnn c aottmeeprdilem rid nuproeagr tatemod   -'dfgumceac.x exe t--ecor  r -wo- rf-fsmmax-errors=3 -m=ano-x3ms-bi.-t
efields -DWIN32_LEAN_AND_MEAN r  r-IoC:r\Userss\d=av3id.\.choosenim
\toolchains\nim-1.6.4\lib -IC:\Users\david\projects\nimforum\src -o C:\Users\david\nimcache\forum_d\crypt-blowfish.c.o C:\Users\david\.nimble\pkgs\bcrypt-#440c5676ff6\bcrypt\crypt-blowfish.c' failed with exit code: 1

       Tip: 37 messages have been suppressed, use --verbose to show them.
     Error: Execution failed with exit code 1
        ... Command: C:\Users\david\.nimble\bin\nim.exe c --noNimblePath -d:NimblePkgVersion=2.2.0 --path:C:\Users\david\.nimble\pkgs\httpbeast-0.4.0 --path:C:\Users\david\.nimble\pkgs\asynctools-#0e6bdc3ed5bae8c7cc9 --path:C:\Users\david\.nimble\pkgs\jester-#405be2e --path:C:\Users\david\.nimble\pkgs\asynctools-#pr_fix_compilation --path:C:\Users\david\.nimble\pkgs\bcrypt-#440c5676ff6 --path:C:\Users\david\.nimble\pkgs\hmac-#9c61ebe2fd134cf97 --path:C:\Users\david\.nimble\pkgs\nimSHA2-0.1.1 --path:C:\Users\david\.nimble\pkgs\sha1-1.1 --path:C:\Users\david\.nimble\pkgs\recaptcha-#d06488e --path:C:\Users\david\.nimble\pkgs\sass-#649e0701fa5c --path:C:\Users\david\.nimble\pkgs\karax-#5f21dcd --path:C:\Users\david\.nimble\pkgs\webdriver-#429933a --hints:off src/forum
stack trace: (most recent call last)
C:\Users\david\AppData\Local\Temp\nimblecache-0\nimscriptapi_288710931.nim(187, 16)
C:\Users\david\projects\nimforum\nimforum.nimble(30, 8) backendTask
C:\Users\david\.choosenim\toolchains\nim-1.6.4\lib\system\nimscript.nim(273, 7) exec
C:\Users\david\.choosenim\toolchains\nim-1.6.4\lib\system\nimscript.nim(273, 7) Error: unhandled exception: FAILED: nimble c src/forum.nim [OSError]
     Error: Exception raised during nimble script execution
PS C:\Users\david\projects\nimforum> 
dom96 commented 2 years ago

We don't really support Windows. But AFAIK in the past we just disabled bcrypt on Windows, guessing that was changed to prevent security problems.

dom96 commented 2 years ago

You're better off using WSL.

enthus1ast commented 2 years ago

there is no (good) reason that a crypto lib fails on windows.

enthus1ast commented 2 years ago

skimming through the forums code, i see no reason why it should not run on windows...

ringabout commented 2 years ago

Shouldn't this be reported to bcrypt?

ringabout commented 2 years ago

See also https://github.com/runvnc/bcryptnim/issues/3