- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 DarkEld3r's os_info repository 中打开了一个拉取请求检索实际的 Windows 版本和版本名称。
应用程序需要链接到 ntdll.dll 才能使用 RtlGetVersion()
.当目标设置为 x86_64-pc-windows-msvc
并使用 Cygwin 和普通 Windows 控制台时,DLL 链接正确。当目标是 x86_64-pc-windows-gnu
时,the linker returns an error :
Running `rustc --crate-name print_version examples\print_version.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=ec9720acb7c740b3 -C extra-filename=-ec9720acb7c740b3 --out-dir C:\projects\os-info\target\debug\examples -L dependency=C:\projects\os-info\target\debug\deps --extern kernel32=C:\projects\os-info\target\debug\deps\libkernel32-beacffc979f26c46.rlib --extern user32=C:\projects\os-info\target\debug\deps\libuser32-fbb28ae30109687c.rlib --extern winapi=C:\projects\os-info\target\debug\deps\libwinapi-bb7af3f2a31ea235.rlib --extern os_info=C:\projects\os-info\target\debug\deps\libos_info-c5887b186deb8679.rlib`
error: linking with `gcc` failed: exit code: 1
|
= note: "gcc" "-Wl,--enable-long-section-names" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-nostdlib" "-m64" "C:\\Users\\appveyor\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\crt2.o" "C:\\Users\\appveyor\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsbegin.o" "-L" "C:\\Users\\appveyor\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "C:\\projects\\os-info\\target\\debug\\examples\\print_version-ec9720acb7c740b3.print_version0.rust-cgu.o" "C:\\projects\\os-info\\target\\debug\\examples\\print_version-ec9720acb7c740b3.print_version1.rust-cgu.o" "C:\\projects\\os-info\\target\\debug\\examples\\print_version-ec9720acb7c740b3.print_version10.rust-cgu.o" "C:\\projects\\os-info\\target\\debug\\examples\\print_version-ec9720acb7c740b3.print_version11.rust-cgu.o" "C:\\projects\\os-info\\target\\debug\\examples\\print_version-ec9720acb7c740b3.print_version12.rust-cgu.o" "C:\\projects\\os-info\\target\\debug\\examples\\print_version-ec9720acb7c740b3.print_version2.rust-cgu.o" "C:\\projects\\os-info\\target\\debug\\examples\\print_version-ec9720acb7c740b3.print_version3.rust-cgu.o" "C:\\projects\\os-info\\target\\debug\\examples\\print_version-ec9720acb7c740b3.print_version4.rust-cgu.o" "C:\\projects\\os-info\\target\\debug\\examples\\print_version-ec9720acb7c740b3.print_version5.rust-cgu.o" "C:\\projects\\os-info\\target\\debug\\examples\\print_version-ec9720acb7c740b3.print_version6.rust-cgu.o" "C:\\projects\\os-info\\target\\debug\\examples\\print_version-ec9720acb7c740b3.print_version7.rust-cgu.o" "C:\\projects\\os-info\\target\\debug\\examples\\print_version-ec9720acb7c740b3.print_version8.rust-cgu.o" "C:\\projects\\os-info\\target\\debug\\examples\\print_version-ec9720acb7c740b3.print_version9.rust-cgu.o" "-o" "C:\\projects\\os-info\\target\\debug\\examples\\print_version-ec9720acb7c740b3.exe" "C:\\projects\\os-info\\target\\debug\\examples\\print_version-ec9720acb7c740b3.crate.allocator.rust-cgu.o" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "C:\\projects\\os-info\\target\\debug\\deps" "-L" "C:\\Users\\appveyor\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-Wl,-Bstatic" "C:\\projects\\os-info\\target\\debug\\deps\\libos_info-c5887b186deb8679.rlib" "C:\\projects\\os-info\\target\\debug\\deps\\libkernel32-beacffc979f26c46.rlib" "C:\\projects\\os-info\\target\\debug\\deps\\libuser32-fbb28ae30109687c.rlib" "C:\\projects\\os-info\\target\\debug\\deps\\libwinapi-bb7af3f2a31ea235.rlib" "C:\\Users\\appveyor\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd-60d4a252bdda9250.rlib" "C:\\Users\\appveyor\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libpanic_unwind-0b63e20460046692.rlib" "C:\\Users\\appveyor\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libunwind-7daa32005d584d8a.rlib" "C:\\Users\\appveyor\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liblibc-49ff25caaa6e945f.rlib" "C:\\Users\\appveyor\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc_system-a05404e5e059417a.rlib" "C:\\Users\\appveyor\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc-f824a78e715239af.rlib" "C:\\Users\\appveyor\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd_unicode-2abaea46f194a6e1.rlib" "C:\\Users\\appveyor\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librand-81cbf6f1d5a19206.rlib" "C:\\Users\\appveyor\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcore-f2bd2d524c6ace24.rlib" "C:\\Users\\appveyor\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcompiler_builtins-c6139fac5e899293.rlib" "-Wl,-Bdynamic" "-l" "ntdll" "-l" "kernel32" "-l" "user32" "-l" "advapi32" "-l" "ws2_32" "-l" "userenv" "-l" "shell32" "-Wl,-Bstatic" "-l" "gcc_eh" "-l" "pthread" "-Wl,-Bdynamic" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-luser32" "-lkernel32" "C:\\Users\\appveyor\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsend.o"
= note: ld: cannot find -lntdll
NTDLL.DLL 已链接 on line 12 of this file .
我还没有发现任何关于链接到 NTDLL 的问题。我找到了 How do I specify the linker path in Rust? ,但该解决方案对我也不起作用。我在 Cygwin 的 /usr/lib/w32api
目录中找到了“libntdll.a”库,但似乎 GCC 没有使用它。
有没有什么方法可以在以 GNU 为目标的情况下让它在 Windows 上运行,或者在链接系统 DLL 时我是否被迫使用 MSVC 目标?
最佳答案
我通过查看 winapi crate repository 找到了解决方法.
因为 0.2.8 的 crate 不支持 RtlGetVersion() DLL 函数,我不得不在 repo 中包含 libntdll.a。完成后,我必须创建一个自定义构建脚本以包含库的源路径。
```
/// build.rs
/// Run custom functionality when a build executes
fn main() {
use std::env::var;
use std::path::Path;
// When targeting x86_64-pc-windows-gnu, we need to include the DLL libraries
// found in the lib/x86_64 directory
if var("TARGET").map(|target| target == "x86_64-pc-windows-gnu").unwrap_or(false) {
let dir = var("CARGO_MANIFEST_DIR").unwrap();
println!("cargo:rustc-link-search=native={}", Path::new(&dir).join("lib/x86_64").display());
}
// When targeting i686-pc-windows-gnu, we need to include the DLL libraries
// found in the lib/i686 directory
if var("TARGET").map(|target| target == "i686-pc-windows-gnu").unwrap_or(false) {
let dir = var("CARGO_MANIFEST_DIR").unwrap();
println!("cargo:rustc-link-search=native={}", Path::new(&dir).join("lib/i686").display());
}
}
```
关于rust - 在以 x86_64-pc-windows-gnu 为目标时使用 Cygwin 在 Rust 应用程序中链接 NTDLL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47744477/
过去几天我一直试图解决这个问题,但我做不到。我正在尝试生成 _ _ _ 形式的随机数。 _ _ _ _ 小数点前 3 位,然后是 4 位小数。 非常感谢任何帮助。谢谢, 院长 最佳答案 您发布的代码有
我的方法有问题。我需要从主类调用的方法的输出打印我: 需要这个输出:_ _ _ _ _ 我知道我可以将 System 的静态方法放入循环中,但这不是我想要的解决方案。我需要它来打印主类中方法的输出。
我正在学习 Scala,有一个非常基本的问题。考虑以下两个使用占位符语法的表达式 - // Syntax A val fnA = (_: Int, _: Int) => _ / _ // Synta
我正在使用图书馆 URLEmbeddedView 它在其库中定义了以下代码: func addConstraints(with view: UIView, center: CGPoint, multi
我一直在许多受人尊敬的文档中看到这个相当令人尴尬的事情:_|_ 或 (_|_) 找不到它的定义(Google 不能很好地处理符号)。那到底是什么呢? 最佳答案 来自 here :- Bottom Th
,_,( ){ ,_,| ,_,&};,_, 不知道是什么意思... 看起来像一个 bash 命令,但它可能是 s bash shell 指令或其他东西如果有人可以帮助理解这一点,我们将不胜感激。当我
所以我正在尝试构建一个函数,它接受一个元组列表并找到具有最大第二个元素的元组。但是我遇到了模式匹配错误。 这是我的代码。 resultTuple :: [((Int,Int),Int)] ->
我在 try Flow 编辑器中重现了我的情况,可以访问 here . 以下是链接发生问题时的代码: /* @flow */ type PayloadType = 1 | 2 | 3; type Tr
我在plfa读到这样一段代码。 import Relation.Binary.PropositionalEquality as Eq open Eq using (_≡_; refl; cong; s
这个问题在这里已经有了答案: Swift 3.0: compiler error when calling global func min(T,T) in Array or Dictionary e
是否有理由使用一个而不是另一个?似乎 _.some 和 _.map 更易于使用或适用于更多情况(根据我非常有限的经验),但从阅读它来看,它们听起来好像应该做同样的事情。我敢肯定还有其他这样的例子,我很
在 Xcode 7 Beta 中开始使用 Swift 2 后,出现错误 cannot invoke。是什么导致了这个问题? 我试图通过以下两个问题找出我的问题,但我仍然收到错误:Question 1
所以我玩了一会儿,试图写一些关于存在和变化的东西,我遇到了这段有趣的代码。 final case class Box[+T](val value: T) { def >>=[U](f: T =>
Here is the screenshot for the error. 遵循本教程 https://developers.google.com/places/ios-api/start 在本教程中
我正在为许多标准的 Underscore.js 函数重写底层代码,以提高我的 JavaScript 技能,但我有点受困于 _.every/ _.全部。似乎在库本身中,_.every/_.all 函数仅
我在 shell 脚本中多次看到他们在 if 比较中使用 "_",如下所示: if [ "_$str" = "_" ]; then ....; fi 上面的代码通过比较 if [ "_$str"= "
我正在尝试快速过滤字典: var data: [String: String] = [:] data = data.filter { $0.1 == "Test" } 上面的过滤器代码在 Swift
我在 Entity Framework 核心映射方面遇到了问题。我收到此异常“不支持从‘付款’到‘购买。付款’的关系,因为拥有的实体类型‘购买’不能位于非所有权关系的主要方面。”在调试此功能的测试时。
我正在尝试模拟groovy.sql.Sql调用(查询,params [],闭包)类。 下面是我正在尝试在DatabaseService类文件中的方法。 public void getUsers(Lis
在阅读 dart 代码时,我经常看到一些仅使用下划线 _ 参数调用的函数。这让我困扰了一段时间,由于 flutter 改进了它的分析消息,我有了一些线索......但我觉得我并没有真正理解这个概念:-
我是一名优秀的程序员,十分优秀!