0.8.2 is the last version before the breaking "flags" keyword change.
For now, no_std crates need to be rlibs because rustc complains about
missing lang items on dylibs even though it would eventually be resolved
in the final link.
Ignore pub_use_of_private_extern_crate as there exists no version with
this fixed that uses the old API.
Patchelf should be reserved for when the ELF cannot be generated
correctly in the first place. This is not the case here because we have
control over the linker flags. The limitation is that -C link-args can
only be specified once, so consolidate the generation of link-args. Also
introduce some new intermediate variables in link-args generation for
customization.
Patchelf was running only in ${PKGD} because patching the ELF in ${D}
would cause objcopy to fail when splitting the debug sections. This is
not a problem when setting it correctly in the linker. The benefit is
that the rpath is correct in the sysroot as well.
This also switches the rpaths to be relative so that they work in both
the sysroot and the target in the same way.
Signed-off-by: Tyler Hall <tyler.hall@lexmark.com>
Signed-off-by: Steven Walter <swalter@lexmark.com>
Commit 864fe95 ("classes: create proper compiler and linker wrappers")
introduced wrapper scripts for the OE toolchain. Specifying the sysroot
manually ceased to function in rust-bin, so use the wrapper where rustc
is called directly.
This should be more reliable than trying to repeat what OE puts in the
$CC variable.
Since commit 06a138a ("rust: drop custom target finding patch"), rustc
is no longer self-sufficient in finding its target specifications. Any
usage of rustc needs RUST_TARGET_PATH set in the environment.
Move the declaration to rust-common.bbclass and add the export to
rust-bin where rustc is invoked.
Switch the build process to using Rust's new build system called
rustbuild. At the same time stop using jemalloc on all platforms and
switch to the system allocator since that was simplier to do.
We'll need the prior version of cargo to boot strap ourselves going
forward so include the version info so we can support multiple versions
in the tree.
rustbuild is a cargo based way to build Rust but all of our helper bits
in cargo.bbclass would create a chicken/egg issue with dependencies
since we pull down pre-built binaries and use those for boot strapping.
Generate the Cargo recipe with cargo-bitbake instead of having a
handcrafted recipe. This should make future version bumps easier.
Three known issues:
- license checksum of the Apache license is a generateme value
due to the license file having a difference name then what's in
Cargo.toml.
- branch= value was wrong for tags. Pointed to HEAD instead of the
branch that the underlying tag commit came from.
- Use https protocol when the repo is publicly accessible.
There was a bbnote that showed the path to the rustc and cargo binaries
being used but this was not necessarily correct since it didn't use the
exact variables used.
For similar reasons to the C and linker wrappers, using rustbuild
requires a C++ wrapper to ensure that the right flags that Yocto needs
are passed to the underlying compiler.
Technically these dependencies change between versions. It just happens
that these two versions didn't change the dependencies but future
versions will so preemptively make the adjustment.
The path to the rust source changes from 1.15 so preemptively make
changes to prepare for that.
Signed-off-by: Derek Straka <derek@asterius.io>
Signed-off-by: Doug Goldstein <cardoe@cardoe.com>