Open Lorac opened 5 years ago
Thanks - that makes things a little clearer. It looks like maybe the build of nativesdk-clang
is trying to use gold
but not finding it and reverting to the system gold
. Where should the yocto-built glibc and binutils get its copy of gold
?
It would appear that removing the -fuse-ld=gold
in clang_git.bb
"fixes" this problem for me, though it seems unlikely that it's the best solution.
that would fix it since ld.bfd is already modified to address relocatable interp section, but we also had this done for gold recently so it seems this might not be working in gold then.
I have tried building Clang in SDK for riscv64 and 0001-binutils-crosssdk-Generate-relocatable-SDKs.patch didn't help (using master of meta-clang) and a month old oe-core/meta-oe.
Works after removing:
diff --git a/recipes-devtools/clang/clang_git.bb b/recipes-devtools/clang/clang_git.bb
index a6d3f58..1728797 100644
--- a/recipes-devtools/clang/clang_git.bb
+++ b/recipes-devtools/clang/clang_git.bb
@@ -15,7 +15,6 @@ BUILD_CXX_class-nativesdk = "clang++"
BUILD_AR_class-nativesdk = "llvm-ar"
BUILD_RANLIB_class-nativesdk = "llvm-ranlib"
BUILD_NM_class-nativesdk = "llvm-nm"
-LDFLAGS_append_class-nativesdk = " -fuse-ld=lld"
inherit cmake cmake-native pkgconfig python3native
Then I was able to cross-compile C and C++ hello world with $CLANGCC
and $CLANGCXX
I think it was a workaround to avoid ld/gold relocation not working I think it could be reverted can you paste errror message you see ?
ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/clang-query, interp size = 78 and 82 is needed.
ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/llvm-cxxdump, interp size = 78 and 82 is needed.
ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/lld, interp size = 78 and 82 is needed.
ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/llvm-as, interp size = 78 and 82 is needed.
ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/dsymutil, interp size = 78 and 82 is needed.
ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/clang-offload-wrapper, interp size = 78 and 82 is needed.
ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/llvm-lipo, interp size = 78 and 82 is needed.
ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/clang-tblgen, interp size = 78 and 82 is needed.
ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/llvm-ar, interp size = 78 and 82 is needed.
ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/llvm-symbolizer, interp size = 78 and 82 is needed.
ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/llvm-strings, interp size = 78 and 82 is needed.
ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/modularize, interp size = 78 and 82 is needed.
ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/llvm-link, interp size = 78 and 82 is needed.
ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/llvm-dwp, interp size = 78 and 82 is needed.
ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/llvm-config, interp size = 78 and 82 is needed.
ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/clang-format, interp size = 78 and 82 is needed.
ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/llvm-lto, interp size = 78 and 82 is needed.
ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/clang-11, interp size = 78 and 82 is needed.
ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/llvm-bcanalyzer, interp size = 78 and 82 is needed.
ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/clang-tidy, interp size = 78 and 82 is needed.
ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/clang-change-namespace, interp size = 78 and 82 is needed.
ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/clang-rename, interp size = 78 and 82 is needed.
ld.gold is not implemented for riscv. Not sure what's the status of ld.lld (I think it might not be on the level as ld.bfd yet). Sticking to ld.bfd might be the best option right now for riscv, but again I don't follow ld.lld development closely.
ok lets stick to ld.bfd
On Fri, Nov 13, 2020 at 9:03 AM David Abdurachmanov < notifications@github.com> wrote:
ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/clang-query, interp size = 78 and 82 is needed. ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/llvm-cxxdump, interp size = 78 and 82 is needed. ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/lld, interp size = 78 and 82 is needed. ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/llvm-as, interp size = 78 and 82 is needed. ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/dsymutil, interp size = 78 and 82 is needed. ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/clang-offload-wrapper, interp size = 78 and 82 is needed. ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/llvm-lipo, interp size = 78 and 82 is needed. ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/clang-tblgen, interp size = 78 and 82 is needed. ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/llvm-ar, interp size = 78 and 82 is needed. ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/llvm-symbolizer, interp size = 78 and 82 is needed. ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/llvm-strings, interp size = 78 and 82 is needed. ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/modularize, interp size = 78 and 82 is needed. ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/llvm-link, interp size = 78 and 82 is needed. ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/llvm-dwp, interp size = 78 and 82 is needed. ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/llvm-config, interp size = 78 and 82 is needed. ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/clang-format, interp size = 78 and 82 is needed. ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/llvm-lto, interp size = 78 and 82 is needed. ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/clang-11, interp size = 78 and 82 is needed. ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/llvm-bcanalyzer, interp size = 78 and 82 is needed. ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/clang-tidy, interp size = 78 and 82 is needed. ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/clang-change-namespace, interp size = 78 and 82 is needed. ERROR: could not relocate /SDK/test2/sysroots/x86_64-oesdk-linux/usr/bin/clang-rename, interp size = 78 and 82 is needed.
ld.gold is not implemented for riscv. Not sure what's the status of ld.lld (I think it might not be on the level as ld.bfd yet). Sticking to ld.bfd might be the best option right now for riscv, but again I don't follow ld.lld development closely.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kraj/meta-clang/issues/119#issuecomment-726879341, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADRS7ZXH5URELWHKY26XZDSPVRHVANCNFSM4HDWF3RQ .
We use such hack in our company for this (in a distro config):
SDKPATH = "/usr/local/oe-sdk-meaningless-long-line-for-replace-it-on-build-path-by-sdk_relocate-script"
Hello @kraj ,
I am getting similar SDK relocation error with rust tools.
Extracting SDK....................................................................................done Setting it up...ERROR: could not relocate ...../sysroots/x86_64-pokysdk-linux/usr/lib/x86_64-poky-linux/rustlib/x86_64-unknown-linux-gnu/bin/llvm-readobj, interp size = 102 and 177 is needed. ERROR: could not relocate ...../sysroots/x86_64-pokysdk-linux/usr/lib/x86_64-poky-linux/rustlib/x86_64-unknown-linux-gnu/bin/llvm-objcopy, interp size = 102 and 177 is needed. ERROR: could not relocate ...../sysroots/x86_64-pokysdk-linux/usr/lib/x86_64-poky-linux/rustlib/x86_64-unknown-linux-gnu/bin/llvm-ar, interp size = 102 and 177 is needed. ERROR: could not relocate ...../sysroots/x86_64-pokysdk-linux/usr/lib/x86_64-poky-linux/rustlib/x86_64-unknown-linux-gnu/bin/llc, interp size = 102 and 177 is needed. ERROR: could not relocate ...../sysroots/x86_64-pokysdk-linux/usr/lib/x86_64-poky-linux/rustlib/x86_64-unknown-linux-gnu/bin/llvm-cov, interp size = 102 and 177 is needed. ERROR: could not relocate ...../sysroots/x86_64-pokysdk-linux/usr/lib/x86_64-poky-linux/rustlib/x86_64-unknown-linux-gnu/bin/llvm-profdata, interp size = 102 and 177 is needed. ERROR: could not relocate ...../sysroots/x86_64-pokysdk-linux/usr/lib/x86_64-poky-linux/rustlib/x86_64-unknown-linux-gnu/bin/llvm-dis, interp size = 102 and 177 is needed. ERROR: could not relocate ...../sysroots/x86_64-pokysdk-linux/usr/lib/x86_64-poky-linux/rustlib/x86_64-unknown-linux-gnu/bin/llvm-objdump, interp size = 102 and 177 is needed. ERROR: could not relocate ...../sysroots/x86_64-pokysdk-linux/usr/lib/x86_64-poky-linux/rustlib/x86_64-unknown-linux-gnu/bin/opt, interp size = 102 and 177 is needed. ERROR: could not relocate ...../sysroots/x86_64-pokysdk-linux/usr/lib/x86_64-poky-linux/rustlib/x86_64-unknown-linux-gnu/bin/llvm-as, interp size = 102 and 177 is needed. ERROR: could not relocate ...../sysroots/x86_64-pokysdk-linux/usr/lib/x86_64-poky-linux/rustlib/x86_64-unknown-linux-gnu/bin/llvm-nm, interp size = 102 and 177 is needed. ERROR: could not relocate ...../sysroots/x86_64-pokysdk-linux/usr/lib/x86_64-poky-linux/rustlib/x86_64-unknown-linux-gnu/bin/llvm-size, interp size = 102 and 177 is needed. ERROR: could not relocate ...../sysroots/x86_64-pokysdk-linux/usr/bin/rustdoc, interp size = 102 and 177 is needed. ERROR: could not relocate ...../sysroots/x86_64-pokysdk-linux/usr/bin/rustc, interp size = 102 and 177 is needed. ERROR: could not relocate ...../sysroots/x86_64-pokysdk-linux/usr/bin/clippy-driver, interp size = 102 and 177 is needed. ERROR: could not relocate ...../sysroots/x86_64-pokysdk-linux/usr/bin/rustfmt, interp size = 102 and 177 is needed. ERROR: could not relocate ...../sysroots/x86_64-pokysdk-linux/usr/bin/cargo, interp size = 102 and 177 is needed. ERROR: could not relocate ...../sysroots/x86_64-pokysdk-linux/usr/bin/cargo-clippy, interp size = 102 and 177 is needed. done SDK has been successfully set up and is ready to be used. Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g. $ . ...../environment-setup-core2-64-poky-linux
Below is my build configuration. Build Configuration: BB_VERSION = "2.0.0" BUILD_SYS = "x86_64-linux" NATIVELSBSTRING = "universal" TARGET_SYS = "x86_64-poky-linux" MACHINE = "qemux86-64" DISTRO = "poky" DISTRO_VERSION = "4.1+snapshot-d9dc50ccff39b91522d15258de28724dc0fb6a19" TUNE_FEATURES = "m64 core2" TARGET_FPU = "" meta meta-poky meta-yocto-bsp = "master:d9dc50ccff39b91522d15258de28724dc0fb6a19"
I could see the below patches are present in my repository. But still I could see relocation errors (may be these are irrelevant for rust pkg). meta/recipes-devtools/binutils/binutils/0001-binutils-crosssdk-Generate-relocatable-SDKs.patch 0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch
Also, in 'meta/recipe-devtools/rust/' I couldn't find and LDFLAGS/Linker info to implement similar patch. Anyway, I tried to modify the _scripts/relocationsdk.py (_changeinterpreter function) to increase the path size, but the installed SDK binaries are corrupted and not working.
Any clue where I should modify the size of .interp section to increase the sdk relocation path size and fix this issue for rust tools?
Hello @kraj,
Any hint here on how to fix this issue for rust binaries?
When I setup our SDK I get this error :
The
.....
is just to mask the path