3

我通过以下步骤设法让 Rust 在 10.12-beta2 上编译,但是,我无法让 Cargo 编译。

$ git clone https://github.com/rust-lang/rust.git
$ cd rust

我通过手动修补文件应用了拉取请求 #34686 。接下来我编辑src/stage0.txt指向最新的夜间解决问题 #34674

rustc: beta-2016-07-10
rustc_key: 411fd48b
cargo: nightly-2016-07-05

由于我使用自制软件,因此我将 Rust 安装在了brew install rust --HEAD放置它的位置:

$ ./configure --prefix=/usr/local/Cellar/rust/HEAD --disable-rpath --enable-clang --release-channel=nightly
$ make
$ make install

我让自制软件将 Rust 与brew link rust. Rust 安装得很好。

$ rustc --version
rustc 1.12.0-nightly (46e7f4b8c 2016-07-10)

现在当我编译 Cargo 时:

$ git clone --recursive https://github.com/rust-lang/cargo
$ cd cargo
$ ./configure --prefix=/usr/local/Cellar/rust/HEAD --local-rust-root=/usr/local/Cellar/rust/HEAD --enable-optimize
$ make
error: linking with `cc` failed: exit code: 1
note: "cc" "-m64" "-L" "/usr/local/Cellar/rust/HEAD/lib/rustlib/x86_64-apple-darwin/lib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/cargo.0.o" "-o" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/cargo" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release" "-L" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps" "-L" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/build/libgit2-sys-599545024e7f41ea/out/lib" "-L" "/usr/lib" "-L" "/usr/local/Cellar/libssh2/1.7.0/lib" "-L" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/build/miniz-sys-fcf0df5bde59c9aa/out" "-L" "/usr/local/Cellar/rust/HEAD/lib/rustlib/x86_64-apple-darwin/lib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libgit2_curl-e2cdc94c821ad0d9.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/libcargo.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libtempdir-2cdf7b3a831e6ac5.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/librand-c724acb3942597d1.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libsemver-b9dbfa773edeea01.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libnum_cpus-a5254d7bdb51bb96.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libdocopt-bf1b771f6864695e.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libfs2-9b8deaf67d029f85.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libterm-585dc449d37783e7.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libcrates_io-208ce28c14c99801.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libstrsim-7ec45c0f17103caa.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libnom-2a6c96954e73df9d.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libtoml-cd71fbce840828ea.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/librustc_serialize-e1b49f9d5f55eb83.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libgit2-a06ed9c4a2306fd3.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/liblibgit2_sys-f6a7bda0ca37fd89.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/liblibssh2_sys-6ef236223a7a29af.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libopenssl_sys-2e99e5f7a9a32616.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/liburl-3c116f81be85494f.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libcrossbeam-243e902fbb9fd1fe.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libglob-0ffe4874535835d5.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libcurl-03671fa2ef8a3330.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libtar-542b9b641a4c3944.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libfiletime-c297f1d53d29af71.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libenv_logger-927e8cf4058b3b7c.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/liblog-0ec442df0ecb416b.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libregex-08fd4c31cabb9147.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libutf8_ranges-a6119bc781af556b.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libregex_syntax-99f5da5a82737304.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libaho_corasick-13668caf93db7fdf.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libmemchr-6b607a0dde114fba.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libcurl_sys-1dc2ea5da01c5626.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/liblibz_sys-1b2511f78c024041.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libflate2-857dff75f2932d8a.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libminiz_sys-d3fcc71d21a3cba8.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/liblibc-036fbedefddee9e8.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libidna-cfd533a97becc7e1.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libunicode_normalization-f33127ef3e902b05.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libunicode_bidi-7a56a7dec369a022.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libmatches-030a774745cc4f96.rlib" "/Users/frankjmattia/Library/Caches/Homebrew/rust--cargo--git/target/x86_64-apple-darwin/release/deps/libbitflags-d88a99e5825ec8bf.rlib" "/usr/local/Cellar/rust/HEAD/lib/rustlib/x86_64-apple-darwin/lib/libstd-c8005792.rlib" "/usr/local/Cellar/rust/HEAD/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-c8005792.rlib" "/usr/local/Cellar/rust/HEAD/lib/rustlib/x86_64-apple-darwin/lib/libunwind-c8005792.rlib" "/usr/local/Cellar/rust/HEAD/lib/rustlib/x86_64-apple-darwin/lib/librand-c8005792.rlib" "/usr/local/Cellar/rust/HEAD/lib/rustlib/x86_64-apple-darwin/lib/libcollections-c8005792.rlib" "/usr/local/Cellar/rust/HEAD/lib/rustlib/x86_64-apple-darwin/lib/liballoc-c8005792.rlib" "/usr/local/Cellar/rust/HEAD/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-c8005792.rlib" "/usr/local/Cellar/rust/HEAD/lib/rustlib/x86_64-apple-darwin/lib/liblibc-c8005792.rlib" "/usr/local/Cellar/rust/HEAD/lib/rustlib/x86_64-apple-darwin/lib/librustc_unicode-c8005792.rlib" "/usr/local/Cellar/rust/HEAD/lib/rustlib/x86_64-apple-darwin/lib/libcore-c8005792.rlib" "-l" "iconv" "-framework" "Security" "-framework" "CoreFoundation" "-l" "ssh2" "-l" "ssl" "-l" "crypto" "-l" "curl" "-l" "z" "-l" "System" "-l" "pthread" "-l" "c" "-l" "m" "-l" "compiler-rt"
note: ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: aborting due to previous error
error: Could not compile `cargo`.

我已经使用自制软件安装了 OpenSSL,并通过brew link openssl --force. 还是没有骰子。

4

1 回答 1

4

在重试构建之前,我没有正确清除 Cargo 缓存目录,也没有告诉构建过程如何找到 OpenSSL

从 Cargo 存储库中:

$ make clean
$ export OPENSSL_INCLUDE_DIR=`brew --prefix openssl`/include
$ export DEP_OPENSSL_INCLUDE=${OPENSSL_INCLUDE_DIR}
$ ./configure --prefix=/usr/local/Cellar/rust/HEAD --local-rust-root=/usr/local/Cellar/rust/HEAD --enable-optimize
$ make
$ make install

然后我跑去brew unlink rust && brew link rust创建符号链接。

于 2016-07-10T22:24:33.420 回答