Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: linking with cc failed: exit code: 1 -- when creating a session #23

Closed
mrrooijen opened this issue Oct 9, 2015 · 8 comments
Closed

Comments

@mrrooijen
Copy link

I'm trying to create a new Session:

extern crate ssh2;

use std::net::TcpStream;
use ssh2::Session;

fn main() {
    let tcp = TcpStream::connect("HOST:PORT").unwrap();
    let mut sess = Session::new().unwrap();
}

Whenever the compiler gets to:

let mut sess = Session::new().unwrap();

I receive the following output/error:

$ cargo build --verbose
   Compiling pkg-config v0.3.6
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/pkg-config-0.3.6/src/lib.rs --crate-name pkg_config --crate-type lib -g -C metadata=376a9590956a17f5 -C extra-filename=-376a9590956a17f5 --out-dir /Users/Michael/Desktop/connector/target/debug/deps --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --cap-lints allow`
   Compiling bitflags v0.1.1
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/bitflags-0.1.1/src/lib.rs --crate-name bitflags --crate-type lib -g -C metadata=dd68b8369bcd8ff0 -C extra-filename=-dd68b8369bcd8ff0 --out-dir /Users/Michael/Desktop/connector/target/debug/deps --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --cap-lints allow`
   Compiling libc v0.1.10
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/libc-0.1.10/rust/src/liblibc/lib.rs --crate-name libc --crate-type lib -g --cfg feature=\"default\" --cfg feature=\"cargo-build\" -C metadata=144c435538abd757 -C extra-filename=-144c435538abd757 --out-dir /Users/Michael/Desktop/connector/target/debug/deps --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --cap-lints allow`
       Fresh winapi-build v0.1.1
       Fresh winapi v0.2.4
   Compiling gcc v0.3.18
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/gcc-0.3.18/src/lib.rs --crate-name gcc --crate-type lib -g -C metadata=b8d5fe529fb07965 -C extra-filename=-b8d5fe529fb07965 --out-dir /Users/Michael/Desktop/connector/target/debug/deps --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --cap-lints allow`
       Fresh advapi32-sys v0.1.2
   Compiling openssl-sys v0.6.6
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-sys-0.6.6/build.rs --crate-name build_script_build --crate-type bin -g --out-dir /Users/Michael/Desktop/connector/target/debug/build/openssl-sys-33c3e25c3677ea5c --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --extern gcc=/Users/Michael/Desktop/connector/target/debug/deps/libgcc-b8d5fe529fb07965.rlib --extern pkg_config=/Users/Michael/Desktop/connector/target/debug/deps/libpkg_config-376a9590956a17f5.rlib --cap-lints allow`
   Compiling libz-sys v0.1.8
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/libz-sys-0.1.8/build.rs --crate-name build_script_build --crate-type bin -g --out-dir /Users/Michael/Desktop/connector/target/debug/build/libz-sys-e8e1552876cd3abe --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --extern pkg_config=/Users/Michael/Desktop/connector/target/debug/deps/libpkg_config-376a9590956a17f5.rlib --extern gcc=/Users/Michael/Desktop/connector/target/debug/deps/libgcc-b8d5fe529fb07965.rlib --cap-lints allow`
   Compiling cmake v0.1.7
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/cmake-0.1.7/src/lib.rs --crate-name cmake --crate-type lib -g -C metadata=0e45705c7ddf317f -C extra-filename=-0e45705c7ddf317f --out-dir /Users/Michael/Desktop/connector/target/debug/deps --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --extern gcc=/Users/Michael/Desktop/connector/target/debug/deps/libgcc-b8d5fe529fb07965.rlib --cap-lints allow`
     Running `/Users/Michael/Desktop/connector/target/debug/build/libz-sys-e8e1552876cd3abe/build-script-build`
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/libz-sys-0.1.8/src/lib.rs --crate-name libz_sys --crate-type lib -g -C metadata=e8e1552876cd3abe -C extra-filename=-e8e1552876cd3abe --out-dir /Users/Michael/Desktop/connector/target/debug/deps --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --extern libc=/Users/Michael/Desktop/connector/target/debug/deps/liblibc-144c435538abd757.rlib --cap-lints allow -L native=/usr/lib -l z`
     Running `/Users/Michael/Desktop/connector/target/debug/build/openssl-sys-33c3e25c3677ea5c/build-script-build`
   Compiling libssh2-sys v0.1.30
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/libssh2-sys-0.1.30/build.rs --crate-name build_script_build --crate-type bin -g --out-dir /Users/Michael/Desktop/connector/target/debug/build/libssh2-sys-63d236645b9d2140 --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --extern pkg_config=/Users/Michael/Desktop/connector/target/debug/deps/libpkg_config-376a9590956a17f5.rlib --extern cmake=/Users/Michael/Desktop/connector/target/debug/deps/libcmake-0e45705c7ddf317f.rlib --cap-lints allow`
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-sys-0.6.6/src/lib.rs --crate-name openssl_sys --crate-type lib -g -C metadata=33c3e25c3677ea5c -C extra-filename=-33c3e25c3677ea5c --out-dir /Users/Michael/Desktop/connector/target/debug/deps --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --extern libc=/Users/Michael/Desktop/connector/target/debug/deps/liblibc-144c435538abd757.rlib --cap-lints allow -L native=/usr/local/Cellar/openssl/1.0.2d_1/lib -L native=/Users/Michael/Desktop/connector/target/debug/build/openssl-sys-33c3e25c3677ea5c/out -l ssl -l crypto -l static=openssl_shim`
     Running `/Users/Michael/Desktop/connector/target/debug/build/libssh2-sys-63d236645b9d2140/build-script-build`
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/libssh2-sys-0.1.30/lib.rs --crate-name libssh2_sys --crate-type lib -g -C metadata=63d236645b9d2140 -C extra-filename=-63d236645b9d2140 --out-dir /Users/Michael/Desktop/connector/target/debug/deps --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --extern libc=/Users/Michael/Desktop/connector/target/debug/deps/liblibc-144c435538abd757.rlib --extern openssl_sys=/Users/Michael/Desktop/connector/target/debug/deps/libopenssl_sys-33c3e25c3677ea5c.rlib --extern libz_sys=/Users/Michael/Desktop/connector/target/debug/deps/liblibz_sys-e8e1552876cd3abe.rlib --cap-lints allow -L native=/Users/Michael/Desktop/connector/target/debug/build/libssh2-sys-63d236645b9d2140/out/lib -l static=ssh2 -L native=/usr/lib -L native=/usr/local/Cellar/openssl/1.0.2d_1/lib -L native=/Users/Michael/Desktop/connector/target/debug/build/openssl-sys-33c3e25c3677ea5c/out`
   Compiling ssh2 v0.2.8
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/ssh2-0.2.8/src/lib.rs --crate-name ssh2 --crate-type lib -g -C metadata=8434f8243d8a9d70 -C extra-filename=-8434f8243d8a9d70 --out-dir /Users/Michael/Desktop/connector/target/debug/deps --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --extern bitflags=/Users/Michael/Desktop/connector/target/debug/deps/libbitflags-dd68b8369bcd8ff0.rlib --extern libc=/Users/Michael/Desktop/connector/target/debug/deps/liblibc-144c435538abd757.rlib --extern libssh2_sys=/Users/Michael/Desktop/connector/target/debug/deps/liblibssh2_sys-63d236645b9d2140.rlib --cap-lints allow -L native=/Users/Michael/Desktop/connector/target/debug/build/libssh2-sys-63d236645b9d2140/out/lib -L native=/usr/lib -L native=/usr/local/Cellar/openssl/1.0.2d_1/lib -L native=/Users/Michael/Desktop/connector/target/debug/build/openssl-sys-33c3e25c3677ea5c/out`
   Compiling connector v0.1.0 (file:///Users/Michael/Desktop/connector)
     Running `rustc src/main.rs --crate-name connector --crate-type bin -g --out-dir /Users/Michael/Desktop/connector/target/debug --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --extern ssh2=/Users/Michael/Desktop/connector/target/debug/deps/libssh2-8434f8243d8a9d70.rlib -L native=/Users/Michael/Desktop/connector/target/debug/build/libssh2-sys-63d236645b9d2140/out/lib -L native=/usr/lib -L native=/usr/local/Cellar/openssl/1.0.2d_1/lib -L native=/Users/Michael/Desktop/connector/target/debug/build/openssl-sys-33c3e25c3677ea5c/out`
error: linking with `cc` failed: exit code: 1
note: "cc" "-m64" "-L" "/usr/local/Cellar/rust/1.3.0/lib/rustlib/x86_64-apple-darwin/lib" "/Users/Michael/Desktop/connector/target/debug/connector.0.o" "-o" "/Users/Michael/Desktop/connector/target/debug/connector" "-Wl,-force_load,/usr/local/Cellar/rust/1.3.0/lib/rustlib/x86_64-apple-darwin/lib/libmorestack.a" "-Wl,-dead_strip" "-nodefaultlibs" "/Users/Michael/Desktop/connector/target/debug/deps/libssh2-8434f8243d8a9d70.rlib" "/Users/Michael/Desktop/connector/target/debug/deps/liblibssh2_sys-63d236645b9d2140.rlib" "/Users/Michael/Desktop/connector/target/debug/deps/liblibz_sys-e8e1552876cd3abe.rlib" "/Users/Michael/Desktop/connector/target/debug/deps/libbitflags-dd68b8369bcd8ff0.rlib" "/Users/Michael/Desktop/connector/target/debug/deps/libopenssl_sys-33c3e25c3677ea5c.rlib" "/Users/Michael/Desktop/connector/target/debug/deps/liblibc-144c435538abd757.rlib" "/usr/local/Cellar/rust/1.3.0/lib/rustlib/x86_64-apple-darwin/lib/libstd-198068b3.rlib" "/usr/local/Cellar/rust/1.3.0/lib/rustlib/x86_64-apple-darwin/lib/libcollections-198068b3.rlib" "/usr/local/Cellar/rust/1.3.0/lib/rustlib/x86_64-apple-darwin/lib/librustc_unicode-198068b3.rlib" "/usr/local/Cellar/rust/1.3.0/lib/rustlib/x86_64-apple-darwin/lib/librand-198068b3.rlib" "/usr/local/Cellar/rust/1.3.0/lib/rustlib/x86_64-apple-darwin/lib/liballoc-198068b3.rlib" "/usr/local/Cellar/rust/1.3.0/lib/rustlib/x86_64-apple-darwin/lib/liblibc-198068b3.rlib" "/usr/local/Cellar/rust/1.3.0/lib/rustlib/x86_64-apple-darwin/lib/libcore-198068b3.rlib" "-L" "/Users/Michael/Desktop/connector/target/debug" "-L" "/Users/Michael/Desktop/connector/target/debug/deps" "-L" "/Users/Michael/Desktop/connector/target/debug/build/libssh2-sys-63d236645b9d2140/out/lib" "-L" "/usr/lib" "-L" "/usr/local/Cellar/openssl/1.0.2d_1/lib" "-L" "/Users/Michael/Desktop/connector/target/debug/build/openssl-sys-33c3e25c3677ea5c/out" "-L" "/usr/local/Cellar/rust/1.3.0/lib/rustlib/x86_64-apple-darwin/lib" "-L" "/Users/Michael/Desktop/connector/.rust/lib/x86_64-apple-darwin" "-L" "/Users/Michael/Desktop/connector/lib/x86_64-apple-darwin" "-l" "z" "-l" "ssl" "-l" "crypto" "-l" "c" "-l" "m" "-l" "System" "-l" "pthread" "-l" "c" "-l" "m" "-l" "compiler-rt"
note: ld: warning: directory not found for option '-L/Users/Michael/Desktop/connector/.rust/lib/x86_64-apple-darwin'
ld: warning: directory not found for option '-L/Users/Michael/Desktop/connector/lib/x86_64-apple-darwin'
Undefined symbols for architecture x86_64:
  "_EVP_aes_256_ctr", referenced from:
      _libssh2_crypt_method_aes256_ctr in liblibssh2_sys-63d236645b9d2140.rlib(crypt.c.o)
     (maybe you meant: __libssh2_EVP_aes_256_ctr)
  "_EVP_aes_192_ctr", referenced from:
      _libssh2_crypt_method_aes192_ctr in liblibssh2_sys-63d236645b9d2140.rlib(crypt.c.o)
     (maybe you meant: __libssh2_EVP_aes_192_ctr)
  "_EVP_aes_128_ctr", referenced from:
      _libssh2_crypt_method_aes128_ctr in liblibssh2_sys-63d236645b9d2140.rlib(crypt.c.o)
     (maybe you meant: __libssh2_EVP_aes_128_ctr)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: aborting due to previous error
Could not compile `connector`.

Caused by:
  Process didn't exit successfully: `rustc src/main.rs --crate-name connector --crate-type bin -g --out-dir /Users/Michael/Desktop/connector/target/debug --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --extern ssh2=/Users/Michael/Desktop/connector/target/debug/deps/libssh2-8434f8243d8a9d70.rlib -L native=/Users/Michael/Desktop/connector/target/debug/build/libssh2-sys-63d236645b9d2140/out/lib -L native=/usr/lib -L native=/usr/local/Cellar/openssl/1.0.2d_1/lib -L native=/Users/Michael/Desktop/connector/target/debug/build/openssl-sys-33c3e25c3677ea5c/out` (exit code: 101)

Any idea what might be causing this? I'm running OSX 10.11.

Thanks!

@alexcrichton
Copy link
Owner

Hm this looks like ssh2 is getting confused with openssl installed both via homebrew and present on the system. How'd you install openssl in homebrew?

@mrrooijen
Copy link
Author

brew install openssl
brew link openssl --force

Prior to installing a newer version of openssl via homebrew I was getting a different build error (when trying to compile ssh2 or one of its dependencies) which is why I installed the homebrew version.

@alexcrichton
Copy link
Owner

I'm not sure of the best way to solve this unfortunately, what's happening is that zlib is installed in /usr/lib, so there's a -L flag for that. The openssl libraries, however, are also installed there so they're being picked up there by the linker first rather than in the linked locations of /usr/local.

What were the original build errors you were seeing?

@mrrooijen
Copy link
Author

After brew unlink openssl and building ssh2 again, this is the build output:

$ cargo build --verbose
   Compiling bitflags v0.1.1
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/bitflags-0.1.1/src/lib.rs --crate-name bitflags --crate-type lib -g -C metadata=dd68b8369bcd8ff0 -C extra-filename=-dd68b8369bcd8ff0 --out-dir /Users/Michael/Desktop/connector/target/debug/deps --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --cap-lints allow`
   Compiling libc v0.1.10
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/libc-0.1.10/rust/src/liblibc/lib.rs --crate-name libc --crate-type lib -g --cfg feature=\"default\" --cfg feature=\"cargo-build\" -C metadata=144c435538abd757 -C extra-filename=-144c435538abd757 --out-dir /Users/Michael/Desktop/connector/target/debug/deps --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --cap-lints allow`
   Compiling pkg-config v0.3.6
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/pkg-config-0.3.6/src/lib.rs --crate-name pkg_config --crate-type lib -g -C metadata=376a9590956a17f5 -C extra-filename=-376a9590956a17f5 --out-dir /Users/Michael/Desktop/connector/target/debug/deps --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --cap-lints allow`
       Fresh winapi-build v0.1.1
       Fresh winapi v0.2.4
   Compiling gcc v0.3.18
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/gcc-0.3.18/src/lib.rs --crate-name gcc --crate-type lib -g -C metadata=b8d5fe529fb07965 -C extra-filename=-b8d5fe529fb07965 --out-dir /Users/Michael/Desktop/connector/target/debug/deps --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --cap-lints allow`
       Fresh advapi32-sys v0.1.2
   Compiling openssl-sys v0.6.6
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-sys-0.6.6/build.rs --crate-name build_script_build --crate-type bin -g --out-dir /Users/Michael/Desktop/connector/target/debug/build/openssl-sys-33c3e25c3677ea5c --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --extern pkg_config=/Users/Michael/Desktop/connector/target/debug/deps/libpkg_config-376a9590956a17f5.rlib --extern gcc=/Users/Michael/Desktop/connector/target/debug/deps/libgcc-b8d5fe529fb07965.rlib --cap-lints allow`
   Compiling libz-sys v0.1.8
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/libz-sys-0.1.8/build.rs --crate-name build_script_build --crate-type bin -g --out-dir /Users/Michael/Desktop/connector/target/debug/build/libz-sys-e8e1552876cd3abe --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --extern pkg_config=/Users/Michael/Desktop/connector/target/debug/deps/libpkg_config-376a9590956a17f5.rlib --extern gcc=/Users/Michael/Desktop/connector/target/debug/deps/libgcc-b8d5fe529fb07965.rlib --cap-lints allow`
   Compiling cmake v0.1.7
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/cmake-0.1.7/src/lib.rs --crate-name cmake --crate-type lib -g -C metadata=0e45705c7ddf317f -C extra-filename=-0e45705c7ddf317f --out-dir /Users/Michael/Desktop/connector/target/debug/deps --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --extern gcc=/Users/Michael/Desktop/connector/target/debug/deps/libgcc-b8d5fe529fb07965.rlib --cap-lints allow`
     Running `/Users/Michael/Desktop/connector/target/debug/build/libz-sys-e8e1552876cd3abe/build-script-build`
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/libz-sys-0.1.8/src/lib.rs --crate-name libz_sys --crate-type lib -g -C metadata=e8e1552876cd3abe -C extra-filename=-e8e1552876cd3abe --out-dir /Users/Michael/Desktop/connector/target/debug/deps --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --extern libc=/Users/Michael/Desktop/connector/target/debug/deps/liblibc-144c435538abd757.rlib --cap-lints allow -L native=/usr/lib -l z`
     Running `/Users/Michael/Desktop/connector/target/debug/build/openssl-sys-33c3e25c3677ea5c/build-script-build`
   Compiling libssh2-sys v0.1.30
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/libssh2-sys-0.1.30/build.rs --crate-name build_script_build --crate-type bin -g --out-dir /Users/Michael/Desktop/connector/target/debug/build/libssh2-sys-63d236645b9d2140 --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --extern pkg_config=/Users/Michael/Desktop/connector/target/debug/deps/libpkg_config-376a9590956a17f5.rlib --extern cmake=/Users/Michael/Desktop/connector/target/debug/deps/libcmake-0e45705c7ddf317f.rlib --cap-lints allow`
Build failed, waiting for other jobs to finish...
failed to run custom build command for `openssl-sys v0.6.6`
Process didn't exit successfully: `/Users/Michael/Desktop/connector/target/debug/build/openssl-sys-33c3e25c3677ea5c/build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-search=native=/usr/lib
cargo:rustc-link-lib=ssl
cargo:rustc-link-lib=crypto
cargo:rustc-link-lib=z
TARGET = Some("x86_64-apple-darwin")
OPT_LEVEL = Some("0")
PROFILE = Some("debug")
TARGET = Some("x86_64-apple-darwin")
debug=true opt-level=0
HOST = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
CC_x86_64-apple-darwin = None
CC_x86_64_apple_darwin = None
HOST_CC = None
CC = None
HOST = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
CFLAGS_x86_64-apple-darwin = None
CFLAGS_x86_64_apple_darwin = None
HOST_CFLAGS = None
CFLAGS = None
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-m64" "-fPIC" "-o" "/Users/Michael/Desktop/connector/target/debug/build/openssl-sys-33c3e25c3677ea5c/out/src/openssl_shim.o" "-c" "src/openssl_shim.c"
ExitStatus(Code(1))


command did not execute successfully, got: exit code: 1



--- stderr
src/openssl_shim.c:1:10: fatal error: 'openssl/hmac.h' file not found
#include <openssl/hmac.h>
         ^
1 error generated.
thread '<main>' panicked at 'explicit panic', /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/gcc-0.3.18/src/lib.rs:768

@mrrooijen
Copy link
Author

Turns out I had to brew install libssh2. Now I'm able to successfully create a session. For reference if anyone else runs into these issues on OSX:

brew install libssh2
brew install openssl
brew link --force openssl

@alexcrichton
Copy link
Owner

Aha! It shouldn't actually be necessary to install libssh2 yourself (this crate builds it from source if it's not already installed), but that'll definitely work!

Also the error you're getting otherwise is currently tracked at sfackler/rust-openssl#255 which is an unfortunate artifact of OSX removing the OpenSSL headers in 10.11 apparently. Once that issue is fixed though this should just fall out!

@mrrooijen
Copy link
Author

Gotcha, that makes sense. Until that's been resolved I'll use this workaround. Thanks! 👍

@tyrel86
Copy link

tyrel86 commented Dec 10, 2016

I fixed this by deleting the target directory from the cargo projects root and running cargo run. This forces a recompile of all source files and crates. This has resolved the CC linking issue for me several times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants