poanetwork / vdf

An implementation of Verifiable Delay Functions in Rust
Apache License 2.0
169 stars 53 forks source link

linking with `link.exe` failed: exit code: 1181 #23

Open royokello opened 1 year ago

royokello commented 1 year ago

Including library as a dependency causes the error in title with additional message "LINK : fatal error LNK1181: cannot open input file 'gmp.lib'"

ienlaw commented 11 months ago

我在Windows上遇见这个问题并成功修复,步骤大致如下 下载gmp头文件放到磁盘某个地方 编辑classgroup\Cargo.toml 文件 在[package]添加 build = "build.rs" 新建 build.rs :

fn main() { 
    //将rustc-link-search设定为我们自己实际的C库路径就好。 
    println!(r"cargo:rustc-link-search=你的gmp.lib路径"); 
}

重新运行 cargo install --path=vdf-cli 不出意外应该编译成功并安装成功 接下来将gmp头文件中提供的gmp.dll复制到程序所在目录 cargo install安装路径是C:\Users\用户名.cargo\bin

royokello commented 11 months ago

Thanks ... will try.