how to fix “something wrong with LDFLAGS” when install Ruby on macOS

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

Inspecting configure.log I found this message

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

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 conftests

I solved this by doing

After which my build proceeded just fine. I hope this helps someone in the future.

Leave a Reply

Your email address will not be published. Required fields are marked *