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

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.

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

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.

Related

Need to install Watchman version 4.9.0 on a mac

These instructions at https://facebook.github.io/watchman/docs/install.html do not work for mac osx:
$ git clone https://github.com/facebook/watchman.git
$ cd watchman
$ git checkout v4.9.0
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
./autogen.sh...
The error:
pkg-config appears to be missing (not available to autoconf tools)
please install the pkg-config package for your system.
The reason I suspect is that not all the same linux packages are available on a mac. How can I get this working on a mac?
// autoconf#2.7
brew uninstall autoconf
brew install autoconf#2.6.9
//pass
./autogen.sh
Just run ./autogen.sh

How to set path pygobject Macos catalina installing PyGTK

I have installed through brew pygobject3 and it is
/usr/local/Cellar/pygobject3/3.36.1
I have tried to export to the right path but while trying to install PyGTK I am still getting:
configure: error: Package requirements (pygobject-2.0 >= 2.21.3) were not met:
No package 'pygobject-2.0' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables PYGOBJECT_CFLAGS
and PYGOBJECT_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
First make sure you have PyGObject fully installed:
$ brew install python3 gobject-introspection gtk+3 adwaita-icon-theme
If you are still getting errors, I have seen issues with the homebrew version of libffi available, which isn't linked automatically:
$ libffi_path="$(brew ls libffi | grep pkgconfig | xargs dirname)"
$ export PKG_CONFIG_PATH="${libffi_path}:${PKG_CONFIG_PATH:-}"

msgmerge on macos Catalina

I am trying to run a unix command line for some i18n work on a project. Using gettext library my issue is about running msgmerge
$ msgmerge
zsh: command not found: msgmerge
I tried brew instal gettext and brew link gettext but with no success. This was working well on my previous machine, but can't make it work on a fresh install.
I can confirm binary is available in /usr/local/opt/gettext/bin/msgmerge.
Fixed. When running brew reinstall gettext, command actually give the answer:
If you need to have gettext first in your PATH run:
echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.zshrc
Export is only triggered when opening a new zsh prompt, PATH was not updated yet and worked when I re-openned a new window.
I tried running this brew link gettext --force, but I was getting:
$ brew install gettext
Warning: gettext 0.20.2 is already installed and up-to-date
To reinstall 0.20.2, run `brew reinstall gettext`
$ brew link gettext --force
Warning: Refusing to link macOS provided/shadowed software: gettext
If you need to have gettext first in your PATH run:
echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.bash_profile
For compilers to find gettext you may need to set:
export LDFLAGS="-L/usr/local/opt/gettext/lib"
export CPPFLAGS="-I/usr/local/opt/gettext/include"
Then, I just added it to the system path with:
echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.bash_profile
Related:
https://apple.stackexchange.com/questions/299048/can-not-use-the-gettext-which-is-installed-by-brew
Homebrew refusing to link OpenSSL
How to install gettext on MacOS X
Installed, just not linked

How to compile ruby from source with debugging symbols on osx?

I'm trying to compile Ruby from source with debugging symbols. I am not using rbenv or rvm, etc.
I have already tried
./configure optflags="-O0" debugflags="-g3 -ggdb"
To no avail :( (the debugger claims it has no symbols)
Thanks!
I figured it out in the end, you do this:
CFLAGS="-O0 -ggdb" ./configure
I recently needed to build ruby inside a docker container. Here's what I did:
1.sh:
#!/bin/sh
set -eux
apk add build-base autoconf bison linux-headers git ruby zlib-dev openssl-dev readline-dev libffi-dev gdbm-dev
git clone https://github.com/ruby/ruby
cd ruby
git checkout v2_6_6
autoconf
./configure optflags=-Og
make install
$ docker run --rm -itv $PWD:/app alpine:3.11 sh
/ # /app/1.sh

MagickWand ./configure can't find MagickWand-config

I've been trying unsuccessfully to install ImageMagick and am stuck at this point. I've dled and phpized MagickWand and am trying to run ./configure and get the error:
checking MagickWand-config in default path... configure: error: Cannot locate configuration program MagickWand-config
I've tried both export PATH=$PATH:/opt/local/bin
and export PATH=$PATH:/opt/local/bin/
and have also tried adding the paths to my .bash_profile file. I've also confirmed that there is a MagickWand-config executable in my /opt/local/bin directory.
Suggestions?
Try sudo apt-get install libmagickwand-dev and then run ./configure. Worked for me on Ubuntu 10.04 after grabbing MagickWand 1.0.8 source from http://www.magickwand.org/download/php/.
Check MagickWand-config - if it doesn't install,
Run sudo apt-get install libmagickwand-dev in your server
Reference the MagicWand-config man pages for further options

Resources