Antti / rust-amqp

AMQP client in pure rust. Corresponds to rabbitmq spec.
MIT License
247 stars 45 forks source link

can not link when cargo build #21

Closed liutaihua closed 9 years ago

liutaihua commented 9 years ago

Undefined symbols for architecture x86_64: "_TLSv1_1_method", referenced from: ssl::SslMethod::to_raw::h686151258a67edaffOd in libopenssl-9e4539c913eed78d.rlib(openssl-9e4539c913eed78d.0.o) ssl::SslMethod::from_raw::hc309ec26131750e5FOd in libopenssl-9e4539c913eed78d.rlib(openssl-9e4539c913eed78d.0.o) "_TLSv1_2_method", referenced from: ssl::SslMethod::to_raw::h686151258a67edaffOd in libopenssl-9e4539c913eed78d.rlib(openssl-9e4539c913eed78d.0.o) ssl::SslMethod::from_raw::hc309ec26131750e5FOd in libopenssl-9e4539c913eed78d.rlib(openssl-9e4539c913eed78d.0.o) ld: symbol(s) not found for architecture x86_64

[dependencies] amqp = "0.0.13" env_logger = "0.3.2"

rustc version: rustc 1.4.0 (8ab8581f6 2015-10-27)

build the example consume code

Antti commented 9 years ago

Try running cargo build --no-default-features to disable openssl. If you're running this on MacOS X, the issue is that they ship old openssl version, which does not support TLS1.1. You need to use newer openssl >=0.9.8zg or 1.0.2d or 1.0.1p or 1.0.0s. On Mac OS X you can install openssl with brew and force link it: brew link --force openssl.

liutaihua commented 9 years ago

thanks reply!

i try to renew sample project, execute:

brew link --force openssl
Linking /usr/local/Cellar/openssl/1.0.2d_1... 1548 symlinks created

and i see the openssl 0.6.7 when cargo build: cargo build --no-default-features
Compiling lazy_static v0.1.15 Compiling matches v0.1.2 Compiling libc v0.2.2 Compiling rustc-serialize v0.3.16 Compiling byteorder v0.3.13 Compiling bit-vec v0.4.2 Compiling libc v0.1.12 Compiling bitflags v0.3.3 Compiling pkg-config v0.3.6 Compiling num v0.1.27 Compiling regex-syntax v0.2.2 Compiling gcc v0.3.19 Compiling log v0.3.3 Compiling memchr v0.1.7 Compiling aho-corasick v0.3.4 Compiling openssl-sys v0.6.7 //<----------------- Compiling enum_primitive v0.1.0 Compiling regex v0.1.41 Compiling openssl v0.6.7 Compiling env_logger v0.3.2 Compiling url v0.2.37 Compiling amqp v0.0.13 note: Undefined symbols for architecture x86_64: "_TLSv1_1_method", referenced from: ssl::SslMethod::to_raw::h686151258a67edaffOd in libopenssl-9e4539c913eed78d.rlib(openssl-9e4539c913eed78d.0.o) ssl::SslMethod::from_raw::hc309ec26131750e5FOd in libopenssl-9e4539c913eed78d.rlib(openssl-9e4539c913eed78d.0.o) "_TLSv1_2_method", referenced from: ssl::SslMethod::to_raw::h686151258a67edaffOd in libopenssl-9e4539c913eed78d.rlib(openssl-9e4539c913eed78d.0.o) ssl::SslMethod::from_raw::hc309ec26131750e5FOd in libopenssl-9e4539c913eed78d.rlib(openssl-9e4539c913eed78d.0.o) ld: symbol(s) not found for architecture x86_64

i show my openssl version is: openssl version OpenSSL 0.9.8zg 14 July 2015

liutaihua commented 9 years ago

I got it. the reason is the older verion default path /usr/lib/libssl.0.9.7.dylib, and cargo build's link include this system path, so it should use that old verion default.

so, I copy that link cmd, execute it manually! exclude the /usr/lib/ and join my /usr/local/lib, link success.

PS: is there any argument to make the cargo build's link cmd not include the default path?

thanks prompt.

Antti commented 9 years ago

I am not sure, I had the same issue few times, but then if you do a clean rust/cargo install, it picks a correct location.