The -C crate_hash option does not work if multiple versions of the same
crate are being linked into a binary. This can happen if different
dependencies depend on different versions of the same crate. The -C
crate_hash argument causes all versions of a given crate to have the
same crate hash which in turn causes the compiler to select the wrong
one internally and crash. This works around issue #126 for Cargo builds
but does not fix the underlying cause.
rust-bin.bbclass now only contains what is necessary to build crates
using the rust compiler directly and rust.bbclass contains information
shared between rust-bin and cargo.
Signed-off-by: Tyler Hall <tylerwhall@gmail.com>
With multilib, we may want to install under lib64 but the rust libraries
get published in the build sysroot under the libdir for the build
machine which is usually just lib. Support these being different.
Poky 1.7 uses RPATH is now RUNPATH, so update our grep string appropriately.
Additionally, bitbake is having trouble with the automatic RDEPENDS on
rustlib. Make it explicit for now.
poky 1.7 changes where it publishes cross output to so this recipe
needs to follow that. Unfortunately this path is defined in
cross.bbclass and we can't inherit that since we aren't cross.
Rust library names may have sonames that overlap with C/C++ libraries.
This causes bitbake to not be able to create the correct automatic
RDEPENDS between packages. The result is that dependencies may not get
automatically installed.
Add -rs to the file name and soname. The crate name remains the same,
and rust is not dependent on the file name to look up the crate inside
the library.
Libraries that overlap with the standard library must have explicit
extern declarations. Without something like pkg-config where the
libraries can publish this info, it's easiest to just hard-code the list
of troublesome libraries.
We control static/dynamic by only making one or the other available.
Apparently the default of prefer static causes duplicate symbols for the
standard library.
This provides more defaults that aren't required for compiling with
rustc, but standardize the output for inclusion in a distro.
Things like
- Where to install libraries
- Stripping rustc note sections
- Optimization by default