Trying to build SWI-PROLOG using cmake as described here
on my Mac Mini (arm64), but running the ‘ninja‘ command, it seems to get stuck on the use of the ‘undeclared identifier H_SAVE_FP‘ relative to the file
../swipl-devel/packages/libedit/libedit4pl.c:2111:24
I’m sorry if this issue has already been treated before, I wasn’t able to find anything regarding it. I just need the graphical tracer and xpce library that do not come with the stable home-brew installation.
I was about to comment on the same issue. On MacOS, using Homebrew for installing packages, there is a message on some packages, including libedit:
==> Caveats
libedit is keg-only, which means it was not symlinked into /opt/homebrew,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
For compilers to find libedit you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/libedit/lib"
export CPPFLAGS="-I/opt/homebrew/opt/libedit/include"
For pkgconf to find libedit you may need to set:
export PKG_CONFIG_PATH="/opt/homebrew/opt/libedit/lib/pkgconfig"
Until now, I have been apparently building against the MacOS provided libedit. It does not even have H_SAVE_FP.
This is in fact not true I think? On my system, when nothing is specified, I get the MacOS libedit, despite having also a homebrew libedit. When I do for example man 3 editline, I don’t even see H_SAVE_HP in the list of operations (but it no longer breaks since your last commit to packages/libedit)
If this would work it would be of course better. But if I run:
cmake -Wno-dev \
-DMACOSX_DEPENDENCIES_FROM=Homebrew
# and so on
then I see in build/CMakeCache.txt:
//Path to a file.
LIBEDIT_INCLUDE_DIR:PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
//Path to a library.
LIBEDIT_LIBRARIES:FILEPATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libedit.tbd
When I run it with my homebrew.cmake file, I get:
//Path to a file.
LIBEDIT_INCLUDE_DIR:PATH=/opt/homebrew/opt/libedit/include
//Path to a library.
LIBEDIT_LIBRARIES:FILEPATH=/opt/homebrew/opt/libedit/lib/libedit.dylib
But, obviously, in my homebrew.cmake, I have hardcoded references to the “keg-only” libraries I have happened to install with homebrew. I don’t know how to turn this into a generic solution :-/
Good question. If I look at my default build (getting the deps from Macports), it gets all dependencies from Macports. If I use -DMACOSX_DEPENDENCIES_FROM=Homebrew though, it seems to get the few things I have installed from Homebrew indeed from Homebrew, but the rest comes from Macports. That seems a bad idea.
I can see what it tries to do and I can confirm that for some reason, on my computer, it doesn’t do it correctly. H_SAVE_FP helped me notice the problem.
The homebrew.cmake I posted above solves a problem that only I seem to have. Please ignore it.
That seems to hold here as well. If I select Homebrew, I think it should not get its dependencies from Macports as a fallback. It is a bit more debatable whether or not it should use system libraries as fallback?
True. I think the only problematic one is libreadline though. This is the editline readline replacement on MacOS, which was useless for us. As we dropped the readline package, this no longer matters. The others are libedit and zlib, for which both the OS and Macports/Homebrew version are fine.