ThomasTJdev / nim_websitecreator

Nim fullstack website framework - deploy a website within minutes
https://nimwc.org
MIT License
175 stars 7 forks source link

SYS_getrandom undefined #142

Closed cvanelteren closed 1 year ago

cvanelteren commented 2 years ago

Hi, I was trying out your package and ran into some compilations issues. I had some looking around and found a related error call (here), but I am not running the mentioned kernel there (<3.17 vs 5.19.4) do you perhaps know how to solve this underlying issue?

Detail: nim 1.6.4

output ``` /home/casper/.cache/nim/nimwc_main_r/stdlib_sysrand.nim.c: In function 'urandomInternalImpl__stdZsysrand_17': /home/casper/.cache/nim/nimwc_main_r/stdlib_sysrand.nim.c:61:56: error: 'SYS_getrandom' undeclared (first use in this function); did you mean 'SYS_getuid'? 61 | readBytesX60gensym0_ = syscall(SYS_getrandom, ((void*) ((&dest[result]))), ((int) ((NI)(TM__sT0fWggTrXhnxQ79bl9a8nHg_2))), ((unsigned int) 0)); | ^~~~~~~~~~~~~ | SYS_getuid /home/casper/.cache/nim/nimwc_main_r/stdlib_sysrand.nim.c:61:56: note: each undeclared identifier is reported only once for each function it appears in Error: execution of an external compiler program 'gcc -c -w -fmax-errors=3 -O3 -fno-strict-aliasing -fno-ident -I/home/casper/.choosenim/toolchains/nim-1.6.4/lib -I/home/casper/projects/nimwc/nimwcpkg -o /home/casper/.cache/nim/nimwc_main_r/stdlib_sysrand.nim.c.o /home/casper/.cache/nim/nimwc_main_r/stdlib_sysrand.nim.c' failed with exit code: 1 ```
ThomasTJdev commented 2 years ago

Hi @cvanelteren

That is a new one to me. Could you try adding -d:nimNoGetRandom to nimwc.nim.cfg before compiling?

ThomasTJdev commented 2 years ago

The problem is coming from this: https://github.com/ThomasTJdev/nim_websitecreator/blob/25da50c01a15338336d9a624c729f8f51c9697a0/nimwcpkg/passwords/passwords.nim

let useUrandom = urandom.open("/dev/urandom")

You could try setting that to false. That will affect the makeSalt() procedure to not using urandom.

cvanelteren commented 2 years ago

Unfortunately, same error when setting it to false. It seems like it is not an issue with nimwc, the error originates from the stdlib it seems.

cvanelteren commented 1 year ago

This automagically fixed itself, closed!

ThomasTJdev commented 1 year ago

Perfect 😃

tor. 29. sep. 2022 20.47 skrev Casper van Elteren @.***

:

This automagically fixed itself, closed!

— Reply to this email directly, view it on GitHub https://github.com/ThomasTJdev/nim_websitecreator/issues/142#issuecomment-1262680279, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAONDOHFVJNVUTVJ7W453UDWAXP43ANCNFSM6AAAAAAQIZULFI . You are receiving this because you commented.Message ID: @.***>