From 1771139389 at qq.com Sun Nov 14 12:09:08 2021 From: 1771139389 at qq.com (=?ISO-8859-1?B?YWJzdHJha3Rh?=) Date: Sun, 14 Nov 2021 20:09:08 +0800 Subject: [Rpm-ecosystem] build rpm debuginfo package when cross compiling Message-ID: Hi. I'm building some rpm packages from cross compiled binaries. My build system is x86_64.I want to build rpm package installed in arm64. I use --target option to set the target cpu architecture arm64. rpmbuild -bb abc.spec --target=arm64-linux In building debuginfo package,There are some warnings. extracting debuginfo xx from xx xz: /vat/tmp/xxxxxx No such files or Directories. objcopy: No such files /vat/tmp/xxxxxx or Directories. The console log shows this warning is from /usr/lib/rpm/find-debuginfo.sh.It's a shell script. It seems to use "nm -D" directly to get debuginfo,which use /usr/bin/nm.The command nm is architecture-specific.So the debuginfo of arm64 is not processed correctly by nm of x86_64.When I softlink /usr/bin/nm to aarch64-linux-nm,the above warnings disappeared.Debuginfo package works well. With further search,the /usr/lib/build-id/xxx.debug file is stripped using /usr/bin/eu-strip, it does strip out the debuginfo of arm64.There are other binary tool like eu-nm,eu-ld,eu-addr2line. These eu-* command is from package elfutils.Can x86_64's eu-* command support processing arm64 binaries directly?Does eu-* command support mips64 or other more arch? I define rpm macros __nm, __strip.The shell scripts in /usr/lib/rpm/ seems not to use these macros.It doesn't work.Beacause these shell scripts use nm and eu-strip directly, which is wrong in processing cross compiled binaries. Can rpmbuild support cross-packging the corresponding debuginfo pakcage when cross compiling? Are there some better ways to set the correct cross binutils with prefix aarch64-linux- for nm,strip,ld,...? Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mark at klomp.org Thu Nov 18 22:11:08 2021 From: mark at klomp.org (Mark Wielaard) Date: Thu, 18 Nov 2021 23:11:08 +0100 Subject: [Rpm-ecosystem] build rpm debuginfo package when cross compiling In-Reply-To: References: Message-ID: Hi, Adding the debugedit list to the CC because that project maintains the find-debuginfo script now: https://sourceware.org/debugedit/ On Sun, Nov 14, 2021 at 08:09:08PM +0800, abstrakta wrote: > I'm building some rpm packages from cross compiled binaries. > My build system is x86_64.I want to build rpm package installed in arm64. > I use --target option to set the target cpu architecture arm64. > > rpmbuild -bb abc.spec --target=arm64-linux > > In building debuginfo package,There are some warnings. > > extracting debuginfo xx from xx > xz: /vat/tmp/xxxxxx No such files or Directories. > objcopy: No such files /vat/tmp/xxxxxx or Directories. Those come from add_minidebug () and seems to be caused by mktemp not working as expected? > The console log shows this warning is from > /usr/lib/rpm/find-debuginfo.sh.It's a shell script. It seems to use > "nm -D" directly to get debuginfo,which use /usr/bin/nm.The command > nm is architecture-specific.So the debuginfo of arm64 is not > processed correctly by nm of x86_64.When I softlink /usr/bin/nm to > aarch64-linux-nm,the above warnings disappeared.Debuginfo package > works well. That is interesting. I hadn't realized, but yes, when doing a cross-build add_minidebug will probably not work because some of the binutils tools may not understand/work for cross-binaries (without prefix). Maybe we should rewrite the script as yet another tool based on libelf that does work for any arch. > With further search,the /usr/lib/build-id/xxx.debug file is stripped > using /usr/bin/eu-strip, it does strip out the debuginfo of > arm64.There are other binary tool like > eu-nm,eu-ld,eu-addr2line. These eu-* command is from package > elfutils.Can x86_64's eu-* command support processing arm64 binaries > directly?Does eu-* command support mips64 or other more arch? The eu- (elfutils) tools work against any architecure for which there is a backend. elfutils doesn't have an objcopy tool though (maybe it should). There is no mips64 support in elfutils though (Debian has a mips64 elfutils backend, but it was never upstreamed). > I define rpm macros __nm, __strip.The shell scripts in /usr/lib/rpm/ > seems not to use these macros.It doesn't work.Beacause these shell > scripts use nm and eu-strip directly, which is wrong in processing > cross compiled binaries. > > Can rpmbuild support cross-packging the corresponding debuginfo > pakcage when cross compiling? > > Are there some better ways to set the correct cross binutils with > prefix aarch64-linux- for nm,strip,ld,...? I am not sure what the best way is to communicate that rpmbuild is doing a crossbuild to the debugedit scripts. Cheers, Mark