public inbox for debugedit@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
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
Date: Thu, 18 Nov 2021 23:11:08 +0100	[thread overview]
Message-ID: <YZbPfDrpU+QHykPK@wildebeest.org> (raw)
In-Reply-To: <tencent_1E25C97E15D4C21286B802101C48FC840909@qq.com>

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


           reply	other threads:[~2021-11-18 22:11 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <tencent_1E25C97E15D4C21286B802101C48FC840909@qq.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YZbPfDrpU+QHykPK@wildebeest.org \
    --to=mark@klomp.org \
    --cc=1771139389@qq.com \
    --cc=debugedit@sourceware.org \
    --cc=rpm-ecosystem@lists.rpm.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).