public inbox for debugedit@sourceware.org
 help / color / mirror / Atom feed
* Re: [Rpm-ecosystem] build rpm debuginfo package when cross compiling
       [not found] <tencent_1E25C97E15D4C21286B802101C48FC840909@qq.com>
@ 2021-11-18 22:11 ` Mark Wielaard
  0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2021-11-18 22:11 UTC (permalink / raw)
  To: rpm-ecosystem; +Cc: abstrakta, debugedit

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-18 22:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <tencent_1E25C97E15D4C21286B802101C48FC840909@qq.com>
2021-11-18 22:11 ` [Rpm-ecosystem] build rpm debuginfo package when cross compiling Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).