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

Linking error #1

Closed
chills42 opened this issue Apr 21, 2016 · 2 comments
Closed

Linking error #1

chills42 opened this issue Apr 21, 2016 · 2 comments

Comments

@chills42
Copy link

I thought I'd try this out, but immediately ran into a linking error:

⇒  cargo build
   Compiling ruru v0.5.0
   Compiling libc v0.1.12
/Users/craig.hills/.cargo/registry/src/github.com-88ac128001ac3a9a/libc-0.1.12/rust/src/liblibc/lib.rs:81:21: 81:39 warning: lint raw_pointer_derive has been removed: using derive with raw pointers is ok
/Users/craig.hills/.cargo/registry/src/github.com-88ac128001ac3a9a/libc-0.1.12/rust/src/liblibc/lib.rs:81 #![allow(bad_style, raw_pointer_derive)]
                                                                                                                              ^~~~~~~~~~~~~~~~~~
/Users/craig.hills/.cargo/registry/src/github.com-88ac128001ac3a9a/ruru-0.5.0/src/types.rs:16:1: 16:85 warning: trait bounds are not (yet) enforced in type definitions [E0122]
/Users/craig.hills/.cargo/registry/src/github.com-88ac128001ac3a9a/ruru-0.5.0/src/types.rs:16 pub type Callback<I: Object, O: Object> = extern fn(Argc, *const AnyObject, I) -> O;
                                                                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/craig.hills/.cargo/registry/src/github.com-88ac128001ac3a9a/ruru-0.5.0/src/types.rs:16:1: 16:85 help: run `rustc --explain E0122` to see a detailed explanation
error: linking with `cc` failed: exit code: 1
note: "cc" "-m64" "-L" "/Users/craig.hills/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/craig.hills/code/bruw/target/debug/deps/ruru-89284decc76f4754.0.o" "-o" "/Users/craig.hills/code/bruw/target/debug/deps/libruru-89284decc76f4754.dylib" "/Users/craig.hills/code/bruw/target/debug/deps/ruru-89284decc76f4754.metadata.o" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/Users/craig.hills/code/bruw/target/debug/deps" "-L" "/Users/craig.hills/code/bruw/target/debug/deps" "-L" "/usr/local/opt/rbenv/versions/2.3.0/lib" "-L" "/Users/craig.hills/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "-l" "ruby" "-l" "ruby" "-l" "ruby" "-l" "ruby" "-l" "ruby" "-l" "ruby" "-l" "ruby" "-l" "ruby" "-l" "ruby" "-Wl,-force_load,/var/folders/0j/s2tz5nh135325kr5czrkq_0m274bbw/T/rustc.sQqN26Zd1r6K/liblibc-dd3420cb049117bb.rlib" "-L" "/Users/craig.hills/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "-l" "std-4fda350b" "-l" "c" "-l" "m" "-l" "System" "-l" "pthread" "-l" "c" "-l" "m" "-dynamiclib" "-Wl,-dylib" "-l" "compiler-rt"
note: Undefined symbols for architecture x86_64:
  "_rb_funcallv", referenced from:
      binding::util::call_method::h19b8a2c489e1971cRia in ruru-89284decc76f4754.0.o
  "_rb_sym2id", referenced from:
      binding::symbol::sym_to_id::hfeed45964b43a6ffRha in ruru-89284decc76f4754.0.o
  "_rb_id2sym", referenced from:
      binding::symbol::id_to_sym::h4480ba545371b02cnha in ruru-89284decc76f4754.0.o
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 `ruru`.
⇒  rbenv version
2.3.0 (set by /usr/local/opt/rbenv/version)
⇒  rustc -V
rustc 1.8.0 (db2939409 2016-04-11)
⇒  cc --version
Apple LLVM version 7.3.0 (clang-703.0.29)
Target: x86_64-apple-darwin15.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
@d-unsed
Copy link
Owner

d-unsed commented Apr 21, 2016

Hi @chills42!

It turned out that one additional step was missing in the Readme. For now the crate cannot be used as static library, but MRI is built without any dynamic libraries by default (rbenv/ruby-build#35)

Please run

CONFIGURE_OPTS=--enable-shared rbenv install 2.3.0

to build ruby along with dylibs and rebuild the crate.

I've updated Readme. Thanks for creating the issue!

@chills42
Copy link
Author

Thanks! Built fine this time!

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

2 participants