Bug #20500
closedNon-system directories are not searched when checking for jemalloc headers and libs, and building `enc`
Description
I found a problem similar to #20494 on jemalloc
It's similar to #20494, but it has a few more issues
Problems:
- Non-system directories (specified by
--with-opt-dir
) are not searched when checking jemalloc headers (almost the same as #20494) - Non-system directories are not searched when checking jemalloc libs
- Non-system directories are not searched when building the
enc
directory sources
I have confirmed that this problem can be fixed by applying the following patch:
diff --git a/configure.ac b/configure.ac
index 169662c..b2dce70 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1392,6 +1392,8 @@ AC_ARG_WITH([jemalloc],
[with_jemalloc=$withval], [with_jemalloc=no])
AS_IF([test "x$with_jemalloc" != xno],[
# find jemalloc header first
+ save_CPPFLAGS="${CPPFLAGS}"
+ CPPFLAGS="${INCFLAGS} ${CPPFLAGS}"
malloc_header=
AC_CHECK_HEADER(jemalloc/jemalloc.h, [malloc_header=jemalloc/jemalloc.h], [
AC_CHECK_HEADER(jemalloc.h, [malloc_header=jemalloc.h])
@@ -1423,6 +1425,8 @@ AS_IF([test "x$with_jemalloc" != xno],[
done
done
])
+ CPPFLAGS="${save_CPPFLAGS}"
+ unset save_CPPFLAGS
with_jemalloc=${rb_cv_jemalloc_library}
AS_CASE(["$with_jemalloc"],
[no],
diff --git a/enc/Makefile.in b/enc/Makefile.in
index 6920bc9..ce93fdd 100644
--- a/enc/Makefile.in
+++ b/enc/Makefile.in
@@ -52,7 +52,7 @@ optflags = @optflags@
debugflags = @debugflags@
warnflags = @warnflags@
CCDLFLAGS = @CCDLFLAGS@
-INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir) -I$(top_srcdir)
+INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir) -I$(top_srcdir) @incflags@
DEFS = @DEFS@
CPPFLAGS = @CPPFLAGS@ -DONIG_ENC_REGISTER=rb_enc_register
LDFLAGS = @LDFLAGS@
On a side note, I think there might be other parts affected by the changes bellow:
https://github.com/ruby/ruby/pull/8449
I thought it might be a good idea to review everything thoroughly
Updated by mame (Yusuke Endoh) 6 months ago
- Assignee set to nobu (Nobuyoshi Nakada)
Updated by nobu (Nobuyoshi Nakada) 6 months ago
Or use RUBY_CHECK_HEADER
instead of AC_CHECK_HEADER
?
A question, does enc use jemalloc?
Updated by lish82 (Hiroki Katagiri) 6 months ago
I don't know if enc
uses jemalloc actually
But the build of enc
fails because -ljemalloc
is specified when building enc
Updated by lish82 (Hiroki Katagiri) 6 months ago
It might be correct to fix it so that -ljemalloc
is not specified when building enc
Updated by lish82 (Hiroki Katagiri) 6 months ago · Edited
Or use
RUBY_CHECK_HEADER
instead ofAC_CHECK_HEADER?
I think it's enough to solve the first problem (Non-system directories are not searched when checking jemalloc headers)
But the process that checks jemalloc
has a process that checks about library (I'm sorry but I don't know its details),
which expects jemalloc headers to be included in the search path.
So I think that just RUBY_CHECK_HEADER
might not solve the second problem (Non-system directories are not searched when checking jemalloc libs)
Updated by nobu (Nobuyoshi Nakada) 6 months ago
Thank you, makes sense.
https://github.com/ruby/ruby/pull/10830
Updated by nobu (Nobuyoshi Nakada) 6 months ago
- Status changed from Open to Closed
Applied in changeset git|5fa6ba9568e87e43e08a4daeba1572254c589fb1.
[Bug #20500] Search non-default directories for jemalloc
Co-Authored-by: lish82 (Hiroki Katagiri)
Updated by lish82 (Hiroki Katagiri) 6 months ago
Thank you for your fix!
Also, I think this change needs to be backported to 3.2.x as well:
https://bugs.ruby-lang.org/issues/20494#note-7
I hope you can change the Backport field If the above is correct
Updated by nobu (Nobuyoshi Nakada) 6 months ago
- Backport changed from 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN to 3.1: UNKNOWN, 3.2: REQUIRED, 3.3: REQUIRED
Updated by k0kubun (Takashi Kokubun) 5 months ago
- Backport changed from 3.1: UNKNOWN, 3.2: REQUIRED, 3.3: REQUIRED to 3.1: UNKNOWN, 3.2: REQUIRED, 3.3: DONE
ruby_3_3 a96233161a0e917b57c3c2cd9598d75d8b7721f5 merged revision(s) 5fa6ba9568e87e43e08a4daeba1572254c589fb1.
Updated by nagachika (Tomoyuki Chikanaga) 4 months ago
- Backport changed from 3.1: UNKNOWN, 3.2: REQUIRED, 3.3: DONE to 3.1: UNKNOWN, 3.2: DONE, 3.3: DONE
ruby_3_2 fc5b9ffad1b0710bd999521d0bf9631af6b762c2 merged revision(s) 5fa6ba9568e87e43e08a4daeba1572254c589fb1.
Updated by nagachika (Tomoyuki Chikanaga) 4 months ago · Edited
- Backport changed from 3.1: UNKNOWN, 3.2: DONE, 3.3: DONE to 3.1: UNKNOWN, 3.2: REQUIRED, 3.3: DONE
fc5b9ffad1b0710bd999521d0bf9631af6b762c2 cause compilation failures like gcc: error: incflags@: No such file or directory
.
cf. https://github.com/ruby/ruby/actions/runs/9939895651/job/27455409440
Reverted it for a while.
Updated by nagachika (Tomoyuki Chikanaga) 16 days ago
- Backport changed from 3.1: UNKNOWN, 3.2: REQUIRED, 3.3: DONE to 3.1: UNKNOWN, 3.2: DONE, 3.3: DONE