runvnc / bcryptnim

15 stars 4 forks source link

Does not compile on windows with mingw (error: u_int32_t unknown type name) #5

Open enthus1ast opened 2 years ago

enthus1ast commented 2 years ago

Also affects nimforum https://github.com/nim-lang/nimforum/issues/329

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: error: unknown type name 'u_int32_t'
   56 |  u_int32_t S[4][256]; /* S-Boxes */
      |  ^~~~~~~~~
c:\Users\david\.nimble\pkgs\bcrypt-#440c5676ff6\bcrypt\arc4random.c:48:2:  c:\Users\david\.nimble\pkgs\bcrypt-#440c5676ff6\bcrypt\blowfish.h:57:2:fatal error:         pwd.h: No such file or directory
   74 | #include                    error: <pwd.h>u_int8_t
      |          '
   48 |                  u_int8_t'
   57 |
 i;
         c         o        m P[BLF_N + 2]; /* Subkeys */
      |
 i^~~~~~~~~l                                                                         a
t   c:\Users\david\.nimble\pkgs\bcrypt-#440c5676ff6\bcrypt\blowfish.h:66:35:error:   unknown type name ' t u_int8_terror:  munknown type name ''
   49 |    u_int32_tau_int8_tt                 e j;
      |  d        .
'?
   66 | void Blowfish_encipher(blf_ctx *,
u_int32_tc:\Users\david\.nimble\pkgs\bcrypt-#440c5676ff6\bcrypt\arc4random.c:50:2: *, u_int32_t *);
      |                                    ^~~~~~~~~error:
      |                                                      uint32_tu_int8_t
c'
   50 |  o pu_int8_til s[256];
      |  a i^~~~~~~~on
 ctoemError: prexecutimioilnna otf anai eotxternal encompiler program 'gcc.exe -c  -w -fmax-errors=3 -mno-ms-bitfields   -IC:\Users\david\.choosenim\toolchains\nim-1.6.4\lib -Ic:\Users\david\.nimble\pkgs\bcrypt-#440c5676ff6 -o C:\Users\david\nimcache\testi_d\crypt-blowfish.c.o c:\Users\david\.nid mble\pkgs\bcrypt-#440c5676ff6\bcrypt\cryptt -bldeourwemf iisnth.c'oa failed t -ewfdim thda uxee-x eitrtor o cr-sode: 1

=f3
.m
ax-errors=3.
jyapayne commented 2 years ago

The u_int32_t the BSD equivalent to uint32_t. It would just take another header to define that one and all of the others. The reason why this works on other platforms is that they have headers to handle these separate typedefs, I'm assuming because of BSD. Not sure why MinGW doesn't do this.