From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id 980C53857C6D for ; Thu, 18 Nov 2021 22:11:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 980C53857C6D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from reform (deer0x10.wildebeest.org [172.31.17.146]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 9D913302FBAF; Thu, 18 Nov 2021 23:11:09 +0100 (CET) Received: by reform (Postfix, from userid 1000) id EC36C2E80421; Thu, 18 Nov 2021 23:11:08 +0100 (CET) Date: Thu, 18 Nov 2021 23:11:08 +0100 From: Mark Wielaard To: rpm-ecosystem@lists.rpm.org Cc: abstrakta <1771139389@qq.com>, debugedit@sourceware.org Subject: Re: [Rpm-ecosystem] build rpm debuginfo package when cross compiling Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: debugedit@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: debugedit development mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Nov 2021 22:11:13 -0000 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