nanoid.nim
nanoid.nim copied to clipboard
Doesn't compile with Nim 0.19.0 on Windows
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);
...
This appears to be an issue with nim-random, a dependency for this project. I'm going to loop in @oprypin.
Nah, don't loop me in, please investigate a bit and open a direct issue if that's the case.
Very well then. I don't have a Windows machine to test on, but I'll see what I can do.
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?
I had to use nim-random for precisely that, urandom. The stdlib doesn't have any API for it.
I heard that urandom might be in stdlib now
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.
@oprypin
Why do you ignore this issue? This does not make any sense.
theAkito [email protected] wrote:
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.
Sad! I didn't realize I was working on a timeline. If you need this fixed, send a patch, or stop complaining.
Neither the author of the upstream library, nor I, owe you anything. Stop acting like we do.
-- Anirudh Oppiliappan https://icyphox.sh
@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.
lol
Now you can try std/sysrand, though it is on devel and expermental. https://github.com/nim-lang/Nim/pull/16459
Or use nimcrypto/sysrand.
https://github.com/cheatfate/nimcrypto