Absolucy / Absolucy/nanorand-rs

I tried the example in the document, but it wouldn't compile!

Open
#55 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
251
Forks
24
PR merge metrics
No merged PRs in 30d

Description

```rust
use nanorand::{Rng, WyRand};

let mut rng = WyRand::new();
println!("Random number: {}", rng.generate::());
```
log
```
Running `C:\Users\Admin\scoop\shims\sccache.exe C:\Users\Admin\.rustup\toolchains\stable-x86_64-pc-windows-msvc\bin\rustc.exe --crate-name random --edition=2024 src\main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=102 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --check-cfg cfg(docsrs,test) --check-cfg "cfg(feature, values())" -C metadata=c81260ed2b3d825c --out-dir C:\Users\Admin\repos\try-rs\random\target\debug\deps -C incremental=C:\Users\Admin\repos\try-rs\random\target\debug\incremental -L dependency=C:\Users\Admin\repos\try-rs\random\target\debug\deps --extern nanorand=C:\Users\Admin\repos\try-rs\random\target\debug\deps\libnanorand-812c2cf660e27061.rlib`
error: linking with `link.exe` failed: exit code: 1120
|
= note: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.44.35207\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "C:\\Users\\Admin\\AppData\\Local\\Temp\\rustcD0fBFH\\symbols.o"
"<18 object files omitted>" "C:\\Users\\Admin\\repos\\try-rs\\random\\target\\debug\\deps/libnanorand-812c2cf660e27061.rlib" "\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib/{libstd-*,libpanic_unwind-*,libcfg_if-*,libwindows_targets-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libunwind-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "kernel32.lib" "kernel32.lib" "kernel32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "dbghelp.lib" "/defaultlib:msvcrt" "/NXCOMPAT" "/OUT:C:\\Users\\Admin\\repos\\try-rs\\random\\target\\debug\\deps\\random.exe" "/OPT:REF,NOICF" "/DEBUG" "/PDBALTPATH:%_PDB%" "/NATVIS:\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:\\lib\\rustlib\\etc\\libstd.natvis"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: libnanorand-812c2cf660e27061.rlib(nanorand-812c2cf660e27061.nanorand.732d8b2c3b481fbd-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol SystemFunction036 referenced in function _ZN8nanorand7entropy7windows7entropy17h22f5209f19f3618eE␍
C:\Users\Admin\repos\try-rs\random\target\debug\deps\random.exe : fatal error LNK1120: 1 unresolved externals␍

error: could not compile `random` (bin "random") due to 1 previous error

Caused by:
process didn't exit successfully: `C:\Users\Admin\scoop\shims\sccache.exe C:\Users\Admin\.rustup\toolchains\stable-x86_64-pc-windows-msvc\bin\rustc.exe --crate-name random --edition=2024 src\main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=102 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --check-cfg cfg(docsrs,test) --check-cfg "cfg(feature, values())" -C metadata=c81260ed2b3d825c --out-dir C:\Users\Admin\repos\try-rs\random\target\debug\deps -C incremental=C:\Users\Admin\repos\try-rs\random\target\debug\incremental -L dependency=C:\Users\Admin\repos\try-rs\random\target\debug\deps --extern nanorand=C:\Users\Admin\repos\try-rs\random\target\debug\deps\libnanorand-812c2cf660e27061.rlib` (exit code: 1)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

The error shows an unresolved external symbol `SystemFunction036` in the Windows entropy function. Look at `nanorand::entropy::windows::entropy` in the source code, likely in `src/entropy/windows.rs`. Investigate the linker issue on Windows, possibly missing a library like `advapi32.lib`. Check the build configuration and dependencies for Windows targets. Verify the fix by compiling the example on a Windows system or using CI.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.