From time to time I have to reinstall something (often Ruby) and in the meantime my system has somewhat deviated from the last time and things don’t work just as well.
FWIW, I’m on an M1 MacBook Pro, and I use macports.
This time the issue showed up when doing rvm install 3.2.4
Installing Ruby from source to: /Users/riffraff/.rvm/rubies/ruby-3.2.4, this may take a while depending on your cpu(s)...
ruby-3.2.4 - #downloading ruby-3.2.4, this may take a while depending on your connection...
ruby-3.2.4 - #extracting ruby-3.2.4 to /Users/riffraff/.rvm/src/ruby-3.2.4.....
ruby-3.2.4 - #configuring........
Error running 'env CFLAGS=-O3 -I/opt/local/include LDFLAGS=-L/opt/local/lib ./configure --prefix=/Users/riffraff/.rvm/rubies/ruby-3.2.4 --disable-install-doc --enable-shared',
please read /Users/riffraff/.rvm/log/1716888782_ruby-3.2.4/configure.log
There has been an error while running configure. Halting the installation.
Inspecting configure.log
I found this message
checking whether LDFLAGS is valid... no
configure: error: something wrong with LDFLAGS="-L/opt/local/lib"
If this happens to you you can track it down by going to the directory containing this file and looking at a different one, config.log
, which contains both the command line and the test C program.
Common issues here are having something messed up in LDFLAGS
or LIBRARY_PATH
or the directory may not exist, but in my case the problem was
configure:9731: gcc -o conftest -O3 -I/opt/local/include -L/opt/local/lib conftest.c >&5
ld: warning: reexported library with install name '/opt/local/lib/libunwind.1.dylib' found at '/opt/local/lib/libunwind.1.dylib' couldn't be matched with any parent library and will be linked directly
configure:9731: $? = 0
for some reason I had a broken libunwind
, probably leftover from some experiment or migration. The test binary actually builds and runs fine, but for some reason the configure
script is not happy with the ld
warning, although it seemed fine for other conftest
s
I solved this by doing
port uninstall libunwind # or do a reinstall if you need it
After which my build proceeded just fine. I hope this helps someone in the future.