ruby with jemalloc won't configure - homebrew/OSX/montery/m1/arm(?)
Asked Answered
M

2

11

OSX/Monterey/M1/Arm/Homebrew: can't for the life of me get this to work:

./configure --with-jemalloc

It dies with

checking jemalloc/jemalloc.h presence... no
configure: error: jemalloc requested but not found

even though it's right there in: /opt/homebrew/Cellar/jemalloc/5.2.1_1/include/jemalloc/jemalloc.js.

brew --prefix jemalloc and jemalloc-config --includedir all looks correct.

I've tried various versions of:

export RUBY_CONFIGURE_OPTS="--with-jemalloc-include=$(brew --prefix jemalloc)/include

and/or

./configure --with-jemalloc-include=$(brew --prefix jemalloc)/include

but no dice. Not even sure those env vars/flags are respected by ruby or if they're some rvm/rbenv/ruby-build thing.

I'm down to doing all my testing directly with ruby's configure and not a rvm/build tool.

Mullet answered 14/4, 2022 at 15:55 Comment(0)
Y
3

This worked using RVM:

# Install jemalloc first
brew install jemalloc

# Install using RVM:
rvm install 3.2.1 --with-jemalloc --with-cppflags="-I$(brew --prefix)/include" -E "LDFLAGS=-L$(brew --prefix)/lib"

It seems that --with-cppflags works as expected, but it's being overwritten by the internal RVM flags passed in, so --with-ldflags does nothing. That's why we pass in the -E flag (as an enviroment variable) instead.

Yonina answered 11/2, 2023 at 19:54 Comment(0)
T
1

Try the following:

❯ export HOMEBREW_PREFIX=$(brew --prefix)
❯ export CPPFLAGS="$CPPFLAGS -I $HOMEBREW_PREFIX/include"
❯ export LDFLAGS="$LDFLAGS -L $HOMEBREW_PREFIX/lib"
❯ cd ruby-2.7.6 && ./configure --with-jemalloc
❯ make && make install
Towill answered 12/8, 2022 at 18:37 Comment(2)
I tried this and it got much further, but I ran into: In file included from ../../.././include/ruby/defines.h:79: ../../.././include/ruby/missing.h:33:11: fatal error: 'sys/time.h' file not found # include <sys/time.h> ^~~~~~~~~~~~ Thoughts?Surroundings
Also, can you point to how you came up with this answer?Surroundings

© 2022 - 2024 — McMap. All rights reserved.