public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Zhihao Cheng <chengzhihao1@huawei.com>
To: Fabio Estevam <festevam@gmail.com>, <david.oberhollenzer@sigma-star.at>
Cc: <raj.khem@gmail.com>, <linux-mtd@lists.infradead.org>
Subject: Re: [PATCH v3 mtd-utils 3/4] configure.ac: Add a check for execinfo and backtrace
Date: Wed, 19 Feb 2025 09:24:01 +0800	[thread overview]
Message-ID: <5ea2d31e-0de3-5a10-b14a-d1320fc52061@huawei.com> (raw)
In-Reply-To: <20250219003329.2078308-3-festevam@gmail.com>

在 2025/2/19 8:33, Fabio Estevam 写道:
> musl relies on an external execinfo library to provide backtrace
> functionality. If musl cannot link to libexecinfo, the following link
> error happens:
> 
> | /work/festevam/oe/poky/build/tmp/work/core2-64-poky-linux-musl/mtd-utils/2.3.0/recipe-sysroot-native/usr/bin/x86_64-poky-linux-musl/../../libexec/x86_64-poky-linux-musl/gcc/x86_64-poky-linux-musl/14.2.0/ld: ubifs-utils/libubifs/mkfs_ubifs-io.o: in function `dump_stack':
> | /usr/src/debug/mtd-utils/2.3.0/ubifs-utils/common/defs.h:71:(.text+0x25): undefined reference to `backtrace'
> ....
> | collect2: error: ld returned 1 exit status
> | make: *** [Makefile:2959: mkfs.ubifs] Error 1
> 
> Fix the problem by checking for backtrace support in libc first and if not
> found, then check for backtrace support in the external libexecinfo.
> 
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
> Suggested-by: Khem Raj <raj.khem@gmail.com>
> ---
> Change since v2:
> - Check for backtrace support in libc first and if not
> found, then check libexecinfo. (Khem)
> 
>   configure.ac | 11 +++++++++++
>   1 file changed, 11 insertions(+)
> 

Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
> diff --git a/configure.ac b/configure.ac
> index 2a79ba820fc0..296901e61760 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -238,6 +238,17 @@ if test "x$need_cmocka" = "xyes"; then
>   	PKG_CHECK_MODULES(CMOCKA, [cmocka], [], [cmocka_missing="yes"])
>   fi
>   
> +AC_CHECK_FUNC([backtrace], [have_backtrace=yes], [have_backtrace=no])
> +
> +if test "x$have_backtrace" = "xno"; then
> +    AC_CHECK_LIB([execinfo], [backtrace],
> +        [LIBS="$LIBS -lexecinfo"
> +         AC_DEFINE([HAVE_BACKTRACE], [1], [backtrace is available via libexecinfo])],
> +        [AC_MSG_WARN([backtrace support not found])])
> +else
> +    AC_DEFINE([HAVE_BACKTRACE], [1], [backtrace is available via libc])
> +fi
> +
>   AC_CHECK_HEADERS([execinfo.h])
>   
>   ##### produce summary on dependencies #####
> 


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2025-02-19  1:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-19  0:33 [PATCH v3 mtd-utils 1/4] ubifs-utils: ubifs.h: Include <fcntl.h> Fabio Estevam
2025-02-19  0:33 ` [PATCH v3 mtd-utils 2/4] ubifs-utils: journal: Include <sys/stat.h> Fabio Estevam
2025-02-19  0:33 ` [PATCH v3 mtd-utils 3/4] configure.ac: Add a check for execinfo and backtrace Fabio Estevam
2025-02-19  1:24   ` Zhihao Cheng [this message]
2025-02-19  0:33 ` [PATCH v3 mtd-utils 4/4] ubifs-utils: extract_files: Include <linux/limits.h> Fabio Estevam
2025-02-19  1:46 ` [PATCH v3 mtd-utils 1/4] ubifs-utils: ubifs.h: Include <fcntl.h> Khem Raj

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=5ea2d31e-0de3-5a10-b14a-d1320fc52061@huawei.com \
    --to=chengzhihao1@huawei.com \
    --cc=david.oberhollenzer@sigma-star.at \
    --cc=festevam@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=raj.khem@gmail.com \
    /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