Skip to content

Linker Error when using rust-http in a dylib (plugin) #17763

Closed
@reem

Description

@reem

Reproduce: https://github.com/reem/rust-http-content-type

The linker error goes away if you remove the implementation of this method: https://github.com/reem/rust-http-content-type/blob/master/generator/src/download.rs#L7-L24, which is the only usage of rust-http.

The actual error, I believe, has to do with rust-https usage of rust-openssl, but I don't really know how to debug any further.

Opening this issue because @huonw suggested it after we tried to debug.

Actual Error Log:

   Compiling generator v0.1.0 (https://github.com/reem/rust-http-content-type.git#6f656bbe)
error: linking with `cc` failed: exit code: 1
note: cc '-m64' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-o' '/Users/Jonathan/hackreactor/iron-middleware/cookie/target/deps/libgenerator-e170cac01c08bdc6.dylib' '/Users/Jonathan/hackreactor/iron-middleware/cookie/target/deps/generator-e170cac01c08bdc6.o' '-Wl,-force_load,/usr/local/lib/rustlib/x86_64-apple-darwin/lib/libmorestack.a' '/Users/Jonathan/hackreactor/iron-middleware/cookie/target/deps/generator-e170cac01c08bdc6.metadata.o' '-nodefaultlibs' '-fno-lto' '-Wl,-dead_strip' '-L' '/Users/Jonathan/hackreactor/iron-middleware/cookie/target/deps' '-lphf_mac-78b8694be35c3487' '/Users/Jonathan/hackreactor/iron-middleware/cookie/target/deps/libhttp-b27c1e7938f5a5d0.rlib' '/Users/Jonathan/hackreactor/iron-middleware/cookie/target/deps/libopenssl-fbe75530f7eda428.rlib' '/Users/Jonathan/hackreactor/iron-middleware/cookie/target/deps/liburl-921578b148f50e06.rlib' '/Users/Jonathan/hackreactor/iron-middleware/cookie/target/deps/libencoding-4805bc5305f7cd87.rlib' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-lrustc-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-lrbml-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-lrustc_llvm-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-lflate-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-lgraphviz-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-lgetopts-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-lrustc_back-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-lsyntax-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-larena-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-ldebug-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-lfmt_macros-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-lterm-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-ltime-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-lserialize-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-llog-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-lregex-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-lstd-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-lsync-4e7c5e5c' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-lrustrt-4e7c5e5c' '-L' '/Users/Jonathan/hackreactor/iron-middleware/cookie/target/deps' '-L' '/Users/Jonathan/hackreactor/iron-middleware/cookie/target/deps' '-L' '/Users/Jonathan/hackreactor/iron-middleware/cookie/target/native/http-b27c1e7938f5a5d0' '-L' '/Users/Jonathan/.cargo/git/checkouts/rust-http-content-type-e95bbac12cca2eca/master/generator/.rust' '-L' '/Users/Jonathan/.cargo/git/checkouts/rust-http-content-type-e95bbac12cca2eca/master/generator' '-lssl' '-lcrypto' '-lpthread' '-ledit' '-lm' '-lc++' '-lSystem' '-lpthread' '-lc' '-lm' '-dynamiclib' '-Wl,-dylib' '-lcompiler-rt'
note: ld: warning: directory not found for option '-L/Users/Jonathan/.cargo/git/checkouts/rust-http-content-type-e95bbac12cca2eca/master/generator/.rust'
Undefined symbols for architecture x86_64:
  "_BN_is_zero", referenced from:
      bn::BigNum.Zero::is_zero::h0dfd42cc0d9b593ebTa in libopenssl-fbe75530f7eda428.rlib(openssl-fbe75530f7eda428.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions