From: Gao Xiang <xiang@kernel.org>
To: Yifan Zhao <zhaoyifan28@huawei.com>
Cc: linux-erofs@lists.ozlabs.org, guoxuenan@huawei.com,
zhukeqian1@huawei.com
Subject: Re: [PATCH] erofs-utils: build: link tools with liberofs dependencies
Date: Wed, 3 Jun 2026 22:36:50 +0800 [thread overview]
Message-ID: <aiA8AhQvFtK_QMwb@debian> (raw)
In-Reply-To: <20260529071702.981596-1-zhaoyifan28@huawei.com>
Hi Yifan,
On Fri, May 29, 2026 at 03:17:02PM +0800, Yifan Zhao wrote:
> liberofs.la is a noinst libtool archive, so relying on its
> dependency_libs to carry external libraries is not enough for
> static-only dependencies.
>
> For example, when liblzma is installed as a static libtool archive,
> libtool consumes -llzma while creating liberofs.la but does not record it
> in dependency_libs. The final tools then link only with liberofs.la and
> fail with undefined lzma_* references.
>
> Collect liberofs external libraries in LIBEROFS_LIBS and use it for both
> liberofs.la and the final tools, so final executable links see the
> pkg-config supplied liblzma flags directly.
>
> Reported-by: Guo Xuenan <guoxuenan@huawei.com>
> Fixes: 6c2a000782b2 ("erofs-utils: lib: add test for s3erofs_prepare_url()")
> Assisted-by: Codex:GPT-5.5
> Signed-off-by: Yifan Zhao <zhaoyifan28@huawei.com>
> ---
> To reproduce link error:
>
> ./autogen.sh
> PKG_CONFIG_PATH=/path/to/xz-static/lib/pkgconfig ./configure
> make -j
>
> Then {mkfs,dump,fsck}.erofs reports missing lzma_* symbol as `-llzma`
> missing in ld flags.
>
> configure.ac | 17 +++++++++++++++++
> dump/Makefile.am | 2 +-
> fsck/Makefile.am | 4 ++--
> fuse/Makefile.am | 5 +++--
> lib/Makefile.am | 14 +++-----------
> mkfs/Makefile.am | 2 +-
> mount/Makefile.am | 2 +-
> 7 files changed, 28 insertions(+), 18 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index f68bb74..17b4856 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -790,6 +790,23 @@ AM_CONDITIONAL([ENABLE_STATIC_FUSE], [test "x${enable_static_fuse}" = "xyes"])
> AM_CONDITIONAL([ENABLE_OCI], [test "x${have_oci}" = "xyes"])
> AM_CONDITIONAL([ENABLE_FANOTIFY], [test "x${have_fanotify}" = "xyes"])
>
> +LIBEROFS_LIBS="${libselinux_LIBS} ${libuuid_LIBS} ${liblz4_LIBS} \
> +${liblzma_LIBS} ${zlib_LIBS} ${libdeflate_LIBS} ${libzstd_LIBS} \
> +${libqpl_LIBS} ${libcurl_LIBS} ${openssl_LIBS} ${json_c_LIBS}"
> +AS_IF([test "x${have_xxhash}" = "xyes"], [
> + LIBEROFS_LIBS="${LIBEROFS_LIBS} ${libxxhash_LIBS}"
> +])
> +AS_IF([test "x${have_s3}" = "xyes"], [
> + LIBEROFS_LIBS="${LIBEROFS_LIBS} ${libxml2_LIBS}"
> +])
> +AS_IF([test "x${enable_multithreading}" != "xno"], [
> + LIBEROFS_LIBS="${LIBEROFS_LIBS} -lpthread"
> +])
> +AS_IF([test "x${build_linux}" = "xyes"], [
> + LIBEROFS_LIBS="${LIBEROFS_LIBS} ${libnl3_LIBS}"
> +])
Although I admit that I'm not super happy with this approach, but it
seems that we have to do like this.
My only question here is that why ${libxxhash_LIBS}, ${libxml2_LIBS}
and ${libnl3_LIBS} cannot be appended directly to LIBEROFS_LIBS as
others.
But I think it's fine to guard `-lpthread` with enable_multithreading
tho.
Thanks,
Gao Xiang
next prev parent reply other threads:[~2026-06-03 14:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-29 7:17 [PATCH] erofs-utils: build: link tools with liberofs dependencies Yifan Zhao
2026-06-01 12:52 ` Guo Xuenan
2026-06-03 14:36 ` Gao Xiang [this message]
2026-06-07 11:29 ` zhaoyifan (H)
2026-06-08 5:46 ` Gao Xiang
2026-06-09 9:04 ` [PATCH v2] " Yifan Zhao
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=aiA8AhQvFtK_QMwb@debian \
--to=xiang@kernel.org \
--cc=guoxuenan@huawei.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=zhaoyifan28@huawei.com \
--cc=zhukeqian1@huawei.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