Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't compile with Nim 0.19.0 on Windows #1

Open
moigagoo opened this issue Oct 4, 2018 · 12 comments
Open

Doesn't compile with Nim 0.19.0 on Windows #1

moigagoo opened this issue Oct 4, 2018 · 12 comments

Comments

@moigagoo
Copy link

moigagoo commented Oct 4, 2018

Firstly, thanks a lot for the package! NanoID is really cool, it's so cool we can have it in Nim.

Here's the error I'm getting:

$ nimble build
  Verifying dependencies for [email protected]
      Info: Dependency on websocket@any version already satisfied
  Verifying dependencies for [email protected]
 Installing nanoid@any version
    Prompt: nanoid not found in any local packages.json, check internet for updated packages? [y/N]
    Answer: y
Downloading Official package list
    Success Package list downloaded.
Downloading https://github.com/icyphox/nanoid.nim using git
  Verifying dependencies for [email protected]
 Installing random@>= 0.5.5
Downloading https://github.com/oprypin/nim-random using git
  Verifying dependencies for [email protected]
 Installing [email protected]
   Success: random installed successfully.
 Installing [email protected]
   Building nanoid/nanoid.exe using c backend
       Tip: 31 messages have been suppressed, use --verbose to show them.
     Error: nimble.nim(1106)         nimble
        ... nimble.nim(1064)         doAction
        ... nimble.nim(507)          build
        ... nimble.nim(183)          processDeps
        ... nimble.nim(483)          install
        ... nimble.nim(359)          installFromDir
        ... nimble.nim(253)          buildFromDir
        ... nimble.nim(245)          buildFromDir
        ... Build failed for package: nanoid
        ... Details:
        ... nimble.nim(1106)         nimble
        ... nimble.nim(1064)         doAction
        ... nimble.nim(507)          build
        ... nimble.nim(183)          processDeps
        ... nimble.nim(483)          install
        ... nimble.nim(359)          installFromDir
        ... nimble.nim(253)          buildFromDir
        ... nimble.nim(237)          buildFromDir
        ... tools.nim(37)            doCmd
        ... Execution failed with exit code 1
        ... Command: "C:\Users\moigagoo\.nimble\bin\nim.exe" c --noBabelPath -d:release --path:"C:\Users\moigagoo\AppData\Local\Temp\nimble_15848\githubcom_oprypinnimrandom_0.5.5\src"  -o:"C:\Users\moigagoo\AppData\Local\Temp\nimble_15848\githubcom_icyphoxnanoidnim\nanoid.exe" "C:\Users\moigagoo\AppData\Local\Temp\nimble_15848\githubcom_icyphoxnanoidnim\src\nanoid.nim"
        ... Output: Hint: used config file 'C:\Users\moigagoo\.choosenim\toolchains\nim-0.19.0\config\nim.cfg' [Conf]
        ... Hint: system [Processing]
        ... Hint: nanoid [Processing]
        ... Hint: math [Processing]
        ... Hint: bitops [Processing]
        ... Hint: lenientops [Processing]
        ... Hint: typetraits [Processing]
        ... Hint: random [Processing]
        ... Hint: times [Processing]
        ... Hint: strutils [Processing]
        ... Hint: parseutils [Processing]
        ... Hint: algorithm [Processing]
        ... Hint: unicode [Processing]
        ... Hint: options [Processing]
        ... Hint: strformat [Processing]
        ... Hint: macros [Processing]
        ... Hint: winlean [Processing]
        ... Hint: dynlib [Processing]
        ... Hint: mersenne [Processing]
        ... Hint: common [Processing]
        ... Hint: intsets [Processing]
        ... Hint: hashes [Processing]
        ... Hint: util [Processing]
        ... Hint: random_real [Processing]
        ... Hint: mt19937ar [Processing]
        ... Hint: urandom [Processing]
        ... CC: nanoid_nanoid
        ... CC: stdlib_system
        ... CC: stdlib_math
        ... CC: stdlib_lenientops
        ... CC: stdlib_bitops
        ... CC: stdlib_typetraits
        ... CC: random_random
        ... CC: stdlib_times
        ... CC: stdlib_macros
        ... CC: stdlib_strutils
        ... CC: stdlib_parseutils
        ... CC: stdlib_algorithm
        ... CC: stdlib_unicode
        ... CC: stdlib_options
        ... CC: stdlib_strformat
        ... CC: stdlib_winlean
        ... CC: stdlib_dynlib
        ... CC: random_mersenne
        ... CC: random_common
        ... CC: stdlib_intsets
        ... CC: stdlib_hashes
        ... CC: random_util
        ... CC: random_random_real
        ... CC: random_mt19937ar
        ... CC: random_urandom
        ... Error: execution of an external compiler program 'gcc.exe -c  -w -mno-ms-bitfields -DWIN32_LEAN_AND_MEAN -O3 -fno-strict-aliasing  -IC:\Users\moigagoo\.choosenim\toolchains\nim-0.19.0\lib -o C:\Users\moigagoo\nimcache\nanoid_r\stdlib_math.c.o C:\Users\moigagoo\nimcache\nanoid_r\stdlib_math.c' failed with exit code: 1
        ... C:\Users\moigagoo\nimcache\nanoid_r\random_urandom.c: In function 'urandomInit_kN1KeADYBcNXBL31s4ZpOg':
        ... C:\Users\moigagoo\nimcache\nanoid_r\random_urandom.c:299:81: error: 'PROV_RSA_FULL' undeclared (first use in this function)
        ...   success = Dl_260201_((&cryptProv_QYmaJrNrOSePQ9c9bh9bYJIDA), NIM_NIL, NIM_NIL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
        ...                                                                                  ^
        ... C:\Users\moigagoo\nimcache\nanoid_r\random_urandom.c:299:81: note: each undeclared identifier is reported only once for
each function it appears in
        ... C:\Users\moigagoo\nimcache\nanoid_r\random_urandom.c:299:96: error: 'CRYPT_VERIFYCONTEXT' undeclared (first use in this
function)
        ...   success = Dl_260201_((&cryptProv_QYmaJrNrOSePQ9c9bh9bYJIDA), NIM_NIL, NIM_NIL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
        ... 
@icyphox
Copy link
Owner

icyphox commented Oct 5, 2018

This appears to be an issue with nim-random, a dependency for this project. I'm going to loop in @oprypin.

@oprypin
Copy link

oprypin commented Oct 5, 2018

Nah, don't loop me in, please investigate a bit and open a direct issue if that's the case.

@icyphox
Copy link
Owner

icyphox commented Oct 5, 2018

Very well then. I don't have a Windows machine to test on, but I'll see what I can do.

@moigagoo
Copy link
Author

moigagoo commented Oct 5, 2018

It seems that the issue is caused by CryptGenRandom being deprecated: https://docs.microsoft.com/en-us/windows/desktop/api/wincrypt/nf-wincrypt-cryptgenrandom. It must be missing in my Windows 10 Insider build.

nim-random uses it for urandom on Windows: https://github.com/oprypin/nim-random#randomurandom

Why can't we switch to the random module from stdlib?

@icyphox
Copy link
Owner

icyphox commented Oct 5, 2018

I had to use nim-random for precisely that, urandom. The stdlib doesn't have any API for it.

@oprypin
Copy link

oprypin commented Oct 5, 2018

I heard that urandom might be in stdlib now

@theAkito
Copy link

theAkito commented Nov 3, 2020

This project is so great and seemed to be the only ID generator for Nim, that fit my needs.
Now, I am stuck with this error and very sad to see, that this is chilling here for over 2 years.
My disappointment is immeasurable.

@theAkito
Copy link

theAkito commented Nov 3, 2020

@oprypin

Why do you ignore this issue? This does not make any sense.

@icyphox
Copy link
Owner

icyphox commented Nov 4, 2020 via email

@theAkito
Copy link

theAkito commented Nov 4, 2020

@icyphox

It's not about me, it's about a project you made. You owe it to yourself. You owe it to your work.

This issue already predicted the shown behaviour and I expected nothing more. That's why I already fixed this issue shortly after being appalled by this void of respect.

@icyphox
Copy link
Owner

icyphox commented Nov 4, 2020

lol

@ringabout
Copy link

ringabout commented Feb 20, 2021

Now you can try std/sysrand, though it is on devel and expermental.
nim-lang/Nim#16459

Or use nimcrypto/sysrand.
https://github.com/cheatfate/nimcrypto

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

No branches or pull requests

5 participants