Installing from source on Mac warnings: "dylib was built for newer macOS version"

This is something I haven’t seen before. I am a complete novice at using a Mac (and I am not using it by personal choice…)

When I build from source, I get warnings like this:

[1709/1801] Linking C shared module packages/readline/readline4pl.so
ld: warning: dylib (/usr/local/opt/readline/lib/libreadline.dylib) was built for newer macOS version (11.0) than being linked (10.15.6)
[1720/1801] Linking C shared module packages/archive/archive4pl.so
ld: warning: dylib (/usr/local/opt/libarchive/lib/libarchive.dylib) was built for newer macOS version (11.0) than being linked (10.15.6)
[1724/1801] Linking C shared module packages/ssl/crypto4pl.so
ld: warning: dylib (/usr/local/opt/openssl/lib/libcrypto.dylib) was built for newer macOS version (11.0) than being linked (10.15.6)
[1728/1801] Linking C shared module packages/ssl/ssl4pl.so
ld: warning: dylib (/usr/local/opt/openssl/lib/libssl.dylib) was built for newer macOS version (11.0) than being linked (10.15.6)
ld: warning: dylib (/usr/local/opt/openssl/lib/libcrypto.dylib) was built for newer macOS version (11.0) than being linked (10.15.6)

I use the following script to build:

#!/bin/zsh

git pull \
    && git submodule update --init \
    && mkdir -p build \
    && cd build \
    && cmake -DCMAKE_INSTALL_PREFIX=$HOME/bin/swipl \
             -DSWIPL_PACKAGES_ODBC=OFF \
             -DSWIPL_PACKAGES_JAVA=OFF \
             -DCMAKE_PREFIX_PATH=/usr/local/Cellar/qt/5.15.1/ \
       -G Ninja .. \
    && ninja \
    && ctest -j 8 \
    && ninja install

Should I pay attention to those warnings?

As long as everything works, probably not. Not really sure how to read this warning. To figure it out you’ll have to check the MacOS version running, the Xcode version and the library details in /usr/local/opt/. Seems there is some inconsistency there. Note that after a MacOS upgrade you typically have to update Macports and/or Homebrew.

All tests pass. I think I also updated/upgraded Homebrew but I don’t understand much what is going on. I will just ignore the warnings for now :slight_smile:

Just to be sure: after an upgrade of the OS or the dependencies your script is going to go wrong as it uses the old build artifacts targeted at the older OS and the cached configuration generated by cmake can be out-of-date on details. Might be wise to remove build and contents and rebuild.

Unfortunately it is (to me at least) a bit unclear when a MacOS update is merely a security update (and just update the SWI-Prolog build is fine) and when it is an upgrade that provides new APIs (in which case a fresh rebuild is a good idea, for example because it may cause cmake to select a more modern/standard/better/… API alternative).

OK, full details:

  1. Had to upgrade to MacOS Big Sur.
  2. Did brew update && brew upgrade
  3. Did rm -rf build
  4. Did actually install XCode, it turns out I did not have it installed previously
  5. Used the script as posted above to pull the latest master and build from source.

There might be something else strange about my machine/installation, it is not my privately owned computer. I also might be forgetting something relevant.

I will wait until another Mac user with more experience runs into the same issue. If no one does, than I did something weird.

I was fighting with other issues on the same machine, and eventually I had to follow, without understanding, the instructions in this stackoverflow answer.

sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install

After this, the warnings above (ld: warning: dylib....) no longer show up when compiling SWI-Prolog from source.

1 Like