我尝试在安装了MSYS2的Windows 32位上编译curl-rust时遇到此错误。似乎MSYS2 / mingw32不支持'pthread'。
error: linking with gcc failed: exit code: 1
D:/Applications/msys32/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.1.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x1a3): undefined reference to pthread_mutex_init'
D:/Applications/msys32/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.1.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0xfd9): undefined reference topthread_once'
D:/Applications/msys32/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.1.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0xfe5): undefined reference to pthread_mutex_lock'
D:/Applications/msys32/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.1.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x10f4): undefined reference topthread_once'
D:/Applications/msys32/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.1.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x1100): undefined reference to pthread_mutex_lock'
D:/Applications/msys32/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.1.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x11cb): undefined reference topthread_once'
D:/Applications/msys32/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.1.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x11d7): undefined reference to pthread_mutex_lock'
D:/Applications/msys32/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.1.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x1239): undefined reference topthread_mutex_unlock'
collect2.exe: error: ld returned 1 exit status
我的MSYS2安装中是否会遗漏一些内容?
我在网上找不到这个错误,除了这个功能不在Windows上。
示例:
main.rs
// https://crates.io/crates/curl
// http://alexcrichton.com/curl-rust/curl/index.html
extern crate curl;
use curl::easy::Easy;
fn main() {
let mut easy = Easy::new();
}
Cargo.toml
[package]
name = "linksbypage"
version = "0.1.0"
authors = ["LeMoussel"]
[dependencies]
curl = "*"
Windows(GNU ABI)Rust版本:1.11.0,货物版本:0.12.0-nightly。