Project

General

Profile

Actions

Bug #20928

closed

Current 3.4-dev cannot be built with jemalloc activated in macOS

Added by hachi8833 (Shozo Hatta) 1 day ago. Updated about 10 hours ago.

Status:
Closed
Target version:
-
[ruby-core:120087]

Description

Today I found that the current 3.4-dev is unable to build with jemalloc activated, while 3.3.4 or any lower versions can be build as usual with or w/o jemalloc activated.

  • macOS Sequoia: 15.1.1 (M3 Chip)

  • env (FYI: --with-opt-dir=$(brew --prefix jemalloc)" does not affect the result):

export RUBY_CONFIGURE_OPTS="--disable-install-doc --disable-shared --with-jemalloc --with-opt-dir=$(brew --prefix jemalloc)"
export LD_PRELOAD=`jemalloc-config --libdir`/libjemalloc.dylib
  • setup:
$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 16.1.0.0.1.1729049160
volume: /
location: /

$ brew --config
HOMEBREW_VERSION: 4.4.9
ORIGIN: https://github.com/Homebrew/brew
HEAD: 2e780004c92f16a96036d3d43569c2924c4e54f5
Last commit: 12 hours ago
Branch: stable
Core tap HEAD: 77f65298ec57b87241038503aabc6dfd1ead0497
Core tap last commit: 9 weeks ago
Core tap JSON: 03 Dec 08:13 UTC
Core cask tap JSON: 03 Dec 08:05 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 8
HOMEBREW_NO_ENV_HINTS: set
HOMEBREW_SORBET_RUNTIME: set
Homebrew Ruby: 3.3.6 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.6/bin/ruby
CPU: octa-core 64-bit arm_ibiza
Clang: 16.0.0 build 1600
Git: 2.47.1 => /opt/homebrew/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 15.1.1-arm64
CLT: 16.1.0.0.1.1729049160
Xcode: N/A
Rosetta 2: false
  • build with 3.4-dev:
$ rbenv install 3.4-dev
rbenv: /Users/hachi8833/.anyenv/envs/rbenv/versions/3.4-dev already exists
continue with installation? (y/N) y
ruby-build: using openssl@3 from homebrew
==> Cloning https://github.com/ruby/ruby.git...
-> git clone --depth 1 --branch master https://github.com/ruby/ruby.git ruby-master
Cloning into 'ruby-master'...
remote: Enumerating objects: 12679, done.
remote: Counting objects: 100% (12679/12679), done.
remote: Compressing objects: 100% (10177/10177), done.
remote: Total 12679 (delta 1499), reused 6014 (delta 1223), pack-reused 0 (from 0)
Receiving objects: 100% (12679/12679), 16.82 MiB | 7.65 MiB/s, done.
Resolving deltas: 100% (1499/1499), done.
Updating files: 100% (11561/11561), done.
==> Installing ruby-master...
-> autoreconf -i
ruby-build: using readline from homebrew
ruby-build: using libyaml from homebrew
ruby-build: using gmp from homebrew
-> ./configure "--prefix=$HOME/.anyenv/envs/rbenv/versions/3.4-dev" --with-openssl-dir=/opt/homebrew/opt/openssl@3 --with-readline-dir=/opt/homebrew/opt/readline --with-libyaml-dir=/opt/homebrew/opt/libyaml --with-gmp-dir=/opt/homebrew/opt/gmp --disable-install-doc --disable-shared --with-jemalloc --with-opt-dir=/opt/homebrew/opt/jemalloc
-> make -j 8

BUILD FAILED (macOS 15.1.1 on arm64 using ruby-build 20241105-4-g87c272cd)
  • detailed-log:
...
compiling gc.c
gc.c:51:11: fatal error: 'malloc.h' file not found
   51 | # include <malloc.h>
      |           ^~~~~~~~~~
compiling hash.c
compiling inits.c
compiling io.c
compiling marshal.c
1 error generated.
make: *** [gc.o] Error 1
make: *** Waiting for unfinished jobs....
touch yjit/target/release/libyjit.a
external command failed with status 2
...

As far as I checked gc.c, at least HAVE_MALLOC_USABLE_SIZE and HAVE_MALLOC_TRIM directives are missing in 3.4-dev (see the attached).
I hope these information would help resolve the issue 🙏

Thank you in advance,


Files

20241203_180021_r2uuD9.png (1.87 MB) 20241203_180021_r2uuD9.png diff gc.c between 3.3.6 and 3.4-dev hachi8833 (Shozo Hatta), 12/03/2024 09:14 AM

Updated by mame (Yusuke Endoh) 1 day ago

  • Assignee set to peterzhu2118 (Peter Zhu)
Actions #2

Updated by nobu (Nobuyoshi Nakada) about 10 hours ago

  • Status changed from Open to Closed

Applied in changeset git|86c01b6aa0833e1bddda6ba8315c9d414aef0f76.


[Bug #20928] Fix build when malloc_usable_size is available

Copy from gc/default/default.c and revert the part of 51bd81651794.

Actions

Also available in: Atom PDF

Like0
Like1Like1