How to I tell Rust where to look for a static library?

后端 未结 2 382
余生分开走
余生分开走 2021-01-11 16:56

Is there any way to tell Rust where to look for my static library? Example code

#[link(name = \"/this/is/the/path/libfoo.a\", kind = \"static\")]
         


        
2条回答
  •  不要未来只要你来
    2021-01-11 17:53

    To add on to the accepted answer, what worked for me is as following:

    • under debug build, putting dependency files under target/debug/deps worked; but putting files under target/debug/native/* did not seem to work.

    Cargo seems to only look under target/debug/deps by default.

    You can run with cargo build --verbose to see the verbose rustc commands and the options used. -L option specifies additional link dependency directory.

提交回复
热议问题