Closed Chuongv closed 8 years ago
Hm. Does it compile with LDFLAGS=-L/user/local/lib
?
I should of mention that I am using cargo build. Is there a way for me to add a linker flag to it?
I added the /user/local/lib
to this, not sure if it's the same thing? But same issue.
cvu at cvu-macpro in ~/Github/demo/RustChat
$ cc -m64 -L /usr/local/lib /usr/local/lib/rustlib/x86_64-apple-darwin/lib /Users/cvu/Github/demo/RustChat/target/debug/RustChat.0.o -o /Users/cvu/Github/demo/RustChat/target/debug/RustChat -Wl,-dead_strip -nodefaultlibs /Users/cvu/Github/demo/RustChat/target/debug/deps/librstox-ab1806e399b3d68b.rlib /Users/cvu/Github/demo/RustChat/target/debug/deps/liblibc-f654c8036439f8ef.rlib /usr/local/lib/rustlib/x86_64-apple-darwin/lib/libstd-a5fc0d6c.rlib /usr/local/lib/rustlib/x86_64-apple-darwin/lib/libcollections-a5fc0d6c.rlib /usr/local/lib/rustlib/x86_64-apple-darwin/lib/librustc_unicode-a5fc0d6c.rlib /usr/local/lib/rustlib/x86_64-apple-darwin/lib/librand-a5fc0d6c.rlib /usr/local/lib/rustlib/x86_64-apple-darwin/lib/liballoc-a5fc0d6c.rlib /usr/local/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-a5fc0d6c.rlib /usr/local/lib/rustlib/x86_64-apple-darwin/lib/liblibc-a5fc0d6c.rlib /usr/local/lib/rustlib/x86_64-apple-darwin/lib/libcore-a5fc0d6c.rlib -L /Users/cvu/Github/demo/RustChat/target/debug -L /Users/cvu/Github/demo/RustChat/target/debug/deps -L /usr/local/lib/rustlib/x86_64-apple-darwin/lib -L /Users/cvu/Github/demo/RustChat/.rust/lib/x86_64-apple-darwin -L /Users/cvu/Github/demo/RustChat/lib/x86_64-apple-darwin -l toxcore -l toxav -l System -l pthread -l c -l m -l compiler-rt
ld: warning: directory not found for option '-L/Users/cvu/Github/demo/RustChat/.rust/lib/x86_64-apple-darwin'
ld: warning: directory not found for option '-L/Users/cvu/Github/demo/RustChat/lib/x86_64-apple-darwin'
ld: can't map file, errno=22 file '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Well, weird. But the issue doesn't seem to depend on rstox. Does it compile anything else?
I have been going through the rust tutorial and doing the sample programs and they have been compiling fine. But yea, it doesn't seem to depend on rstox. I can't find anywhere in the rstox project where this issue might be. Anyways, feel free to close this one.
Closing this one, I don't think this is rstox related. Thanks for the help though! :smile:
@suhr
Hm. Does it compile with LDFLAGS=-L/user/local/lib?
Ooops I didn't add that linker flag correctly. It compiles now. I wonder why cargo doesn't add that originally?
Okay figured it out, LIBRARY_PATH
was not set. Since cargo/rust looks at that to figure out where the libs are located. I thought it would look at pkg-config
to figure out where that is.
I create a new cargo project
cargo new project --bin
Then I add the line to my Cargo.toml[dependencies.rstox] git = "https://github.com/suhr/rstox.git"
I also confirmed that libtoxcore and libtoxav are in my
/user/local/lib
Get the following error when trying to build