linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Xie XiuQi <xiexiuqi@huaweicloud.com>
To: akpm@linux-foundation.org
Cc: irogers@google.com, acme@redhat.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH RESEND] tools/mm: fix undefined reference to pthread_once
Date: Mon, 28 Aug 2023 20:21:57 +0800	[thread overview]
Message-ID: <20230828122157.1541087-1-xiexiuqi@huaweicloud.com> (raw)

From: Xie XiuQi <xiexiuqi@huawei.com>

Commit 97d5f2e9ee12 ("tools api fs: More thread safety for global
filesystem variables") introduces pthread_once, so the libpthread
should be added at link time, or we'll meet the following compile
error when 'make -C tools/mm':

  gcc -Wall -Wextra -I../lib/ -o page-types page-types.c ../lib/api/libapi.a
  ~/linux/tools/lib/api/fs/fs.c:146: undefined reference to `pthread_once'
  ~/linux/tools/lib/api/fs/fs.c:147: undefined reference to `pthread_once'
  ~/linux/tools/lib/api/fs/fs.c:148: undefined reference to `pthread_once'
  ~/linux/tools/lib/api/fs/fs.c:149: undefined reference to `pthread_once'
  ~/linux/tools/lib/api/fs/fs.c:150: undefined reference to `pthread_once'
  /usr/bin/ld: ../lib/api/libapi.a(libapi-in.o):~/linux/tools/lib/api/fs/fs.c:151:
  more undefined references to `pthread_once' follow
  collect2: error: ld returned 1 exit status
  make: *** [Makefile:22: page-types] Error 1

Fixes: 97d5f2e9ee12 ("tools api fs: More thread safety for global filesystem variables")
Signed-off-by: Xie XiuQi <xiexiuqi@huawei.com>
Acked-by: Ian Rogers <irogers@google.com>
---
 tools/mm/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/mm/Makefile b/tools/mm/Makefile
index 6c1da51f4177..9997b2e401ae 100644
--- a/tools/mm/Makefile
+++ b/tools/mm/Makefile
@@ -9,7 +9,7 @@ LIB_DIR = ../lib/api
 LIBS = $(LIB_DIR)/libapi.a
 
 CFLAGS += -Wall -Wextra -I../lib/
-LDFLAGS += $(LIBS)
+LDFLAGS += $(LIBS) -lpthread
 
 all: $(TARGETS)
 
-- 
2.25.1



             reply	other threads:[~2023-08-28 12:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-28 12:21 Xie XiuQi [this message]
2023-08-28 12:58 ` Matthew Wilcox
2023-08-31  1:13   ` Xie XiuQi
2023-08-31  2:25     ` Matthew Wilcox
2023-08-31  2:57       ` Xie XiuQi

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=20230828122157.1541087-1-xiexiuqi@huaweicloud.com \
    --to=xiexiuqi@huaweicloud.com \
    --cc=acme@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=irogers@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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