]> code.ossystems Code Review - openembedded-core.git/commitdiff
Fix rust-native build issue when debug is enabled
authorPgowda <pgowda.cve@gmail.com>
Wed, 29 Sep 2021 13:20:54 +0000 (06:20 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 14 Oct 2021 10:55:55 +0000 (11:55 +0100)
When DEBUG_BUILD is set for building rust-native, it generated
error as follows:-
=========================================================
Building : rustdoc, rustdoc-json-types
error[E0463]: can't find crate for `rustc_llvm`
which `rustc_driver` depends on
  --> src/librustdoc/lib.rs:37:1
   |
37 | extern crate rustc_driver;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
=========================================================
On analyzing the issue, it was found that rustc_llvm crate was present
at required path. However, it was very huge due to the presence of
debugging information. Hence, it was somehow not recognized as a valid
crate. The following patch removes the debug information from
rust-llvm-native which is built prior to rust-native but retains debug
information as required in rust-native binaries.

Signed-off-by: Pgowda <pgowda.cve@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
meta/recipes-devtools/rust/rust-llvm.inc

index d7f445385be4bce22762275a08319da8800144b4..0f8fb785b7d1daf7f8b1023ca6a3f44fbcac5605 100644 (file)
@@ -15,6 +15,11 @@ DEPENDS += "ninja-native rust-llvm-native"
 ARM_INSTRUCTION_SET:armv5 = "arm"
 ARM_INSTRUCTION_SET:armv4t = "arm"
 
+# rustc_llvm with debug info is not recognized as a valid crate that's
+# generated by rust-llvm-native.
+CFLAGS:remove = "-g"
+CXXFLAGS:remove = "-g"
+
 LLVM_DIR = "llvm${LLVM_RELEASE}"
 
 EXTRA_OECMAKE = " \