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
Rust's symbol hashes break sstate, because a subsequent build of the same
input hash may generate different symbol hashes. This means that
packages that previously built against the "same" (from bitbake's
perspective) rustc would no longer run, and bitbake would not know to
rebuild them because the input hash is the same. This is because the
crate metadata contains some data that differs from build-to-build.
This problem actually extends beyond the compiler to any arbitrary
crate, for the same reason. If a crate in the middle of the dependency
chain had to be rebuilt, bitbake wouldn't realized that all its
dependencies have to be relink, and the dependent packages would fail
due to missing symbols.
Fortunately, bitbake's input hash makes this mechanism largely
unnecessary; any change to rust's source or configuration will cause
rustc and all dependencies to rebuild. Therefore, it's safe to remove
crate metadata from the hashing.
rust takes a painfully long time to build. A non-trivial part of that
is building LLVM. Fortuitiously, the LLVM component is common between
the -native compiler and all variants of the -cross compiler. That
means we can build it once, and reuse the output for any flavor of rust.
That saves build time, and it utilizes bitbake's sstate more
efficiently. It's win/win!
This gets split out in do_package, so there's no harm in including it.
It is useful to be able to get debug info for the standard library by
installing the -dbg package.
This resolves https://github.com/jmesmon/meta-rust/issues/1. This
change is only necessary for systems (like dizzy) that do not
contain poky commit 60d504b431fa7cdc6ded141def7ae18edb1834e5.
Without that commit or this change, do_compile for libgit2 would fail
with the following error:
CMAKE_AR-NOTFOUND cr libgit2.a ...
Error running link command: No such file or directory
Signed-off-by: Paul Osborne <osbpau@gmail.com>
In dizzy, the following error was encountered when running do_install
on the rust recipe:
pushd: not found
According to the bitbake user manual, /bin/sh is used and bashisms
(like pushd) should be avoided. In my case, /bin/sh turns out to
be zsh (with no extra configuration, so pushd is not present).
Signed-off-by: Paul Osborne <osbpau@gmail.com>