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

shared library error when using indoc #15

Closed
glennpierce opened this issue Oct 20, 2017 · 8 comments
Closed

shared library error when using indoc #15

glennpierce opened this issue Oct 20, 2017 · 8 comments

Comments

@glennpierce
Copy link

I am using a nightly compiler and when I use indow I get the error

./target/debug/lasso: error while loading shared libraries: libstd-9f780c2031976271.so: cannot open shared object file: No such file or directory

When running my executable directly.

@dtolnay
Copy link
Owner

dtolnay commented Oct 20, 2017

I have not been able to reproduce this yet. Could you provide some more details? Are you using indoc from a no_std crate? Is your crate a library or binary? What is the date of the nightly you are using? Does it work with the stable compiler? What platform are you on? Do other procedural macro crates work? Can you share a minimal piece of code that reproduces this?

@glennpierce
Copy link
Author

So I have a library I developed and some tests that use this library.

In my Cargo.toml I have included indoc = "0.2"
That's works.

when I include the lib in lib.rs with

#[macro_use]
extern crate indoc;

I get

./target/release/lasso: error while loading shared libraries: libstd-9f780c2031976271.so: cannot open shared object file: No such file or directory

My compiler is

nightly-x86_64-unknown-linux-gnu
rustc 1.21.0-nightly (b75d1f0ce 2017-08-02)

Trying with the crate quote = "0.3" things seem to work.

I can't try stable as I depend on cron crate that does not work on stable. If you still can't replicate I can start trying to remove code.

Thanks

@dtolnay
Copy link
Owner

dtolnay commented Oct 21, 2017

Also on nightly-x86_64-unknown-linux-gnu, this script succeeds for me. Any idea what is different in your setup?

#!/bin/bash

cargo new repro
cat >> repro/Cargo.toml <<-'EOF'
    indoc = "0.2"
EOF

cat > repro/src/lib.rs <<-'EOF'
    #[macro_use]
    extern crate indoc;
    
    pub fn f() -> &'static str {
        indoc!("1
                2")
    }
    
    #[test]
    fn test_indoc() {
        assert_eq!(f(), "1\n2");
    }
EOF

rustc +nightly-2017-08-03 --version
cargo +nightly-2017-08-03 build --manifest-path repro/Cargo.toml
cargo +nightly-2017-08-03 test --manifest-path repro/Cargo.toml

@glennpierce
Copy link
Author

Ok

Change Cargo.toml to

[package]
name = "repro"
version = "0.1.0"
authors = ["Glenn Pierce glennpierce@gmail.com"]

[dependencies]
indoc = "0.2"

[lib]
name = "libtest"
path = "src/lib.rs"
test = false
bench = false

[[bin]]
name = "test"
path = "test/test.rs"

test/test.rs

extern crate libtest;

fn main() {

}

cargo build --release --bin test
./target/release/test
./target/release/test: error while loading shared libraries: libstd-8eeda694d27cc3ba.so: cannot open shared object file: No such file or directory

@glennpierce
Copy link
Author

I also tested this on stable with the same result

@dtolnay
Copy link
Owner

dtolnay commented Oct 21, 2017

Thanks, I was able to reproduce this. I reported it in rust-lang/cargo#4651 as a Cargo bug.

@dtolnay
Copy link
Owner

dtolnay commented Oct 23, 2017

I implemented a workaround in ac5c069. Could you confirm that you are able to run binaries depending on indoc 0.2.2?

@glennpierce
Copy link
Author

Yep that seems like it is fixed. Thanks

@dtolnay dtolnay closed this as completed Oct 23, 2017
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