Indeed it does. I’m not sure how it is getting set. As best I can tell, I have all prerequisites installed. I was assuming a configure step wasn’t happy and set -DSWIPL_PACKAGES_X=OFF because it didn’t see something it wanted to see.
Thanks for your reply — and for creating such an important system.
Someone should probably try to get the Homebrew formulas updated. I once tried, but getting X11 dependency into a formula accepted seems hard. Building a good working SWI-Prolog is a bit hard on the Mac these days. The Xcode clang compiler creates a working, but rather slow system after serious performance regression with Xcode 11. Compiled using a modern GCC version and PGO guided optimization results in a system that is over twice as fast.
If anyone wants to give it a try to create good formulas and get them accepted with the Homebrew project, please do. I’m happy to help.
Thanks for taking the time to explain. It helps knowing why things are goofy.
I’ve never built a Homebrew formula, never mind navigated the Xcode jungle. If you consider it hard, it’s probably a moon shot for me. That said, I’ll try.
It was mostly (too) hard to get the formula accepted with the Homebrew team. They have zillions of guidelines and policies that must be respected. That is fair enough and necessary to avoid a project getting a big mess. Typically if a patch is “close enough” I fix the details and indicate what I changed why. That is IMO a lot more productive than pointing at yet another policy, in particular for one-time contributors.
I had a similar encounter with Macports, but one of the maintainers there kindly made it completely in accordance with their guidelines and I wrote a script to update the Portfile automatically. The Macport releases are smooth now. It should only be possible to select gcc and PGO driven opmization
If you want to give it a try, tell me and I’ll see whether I can still find the work I did.
Thanks again. Navigating Homebrew’s guidelines under current circumstances is out of my wheelhouse. Thanks for your Macports work. I’ll head over there.
I tried to see how the whole thing works on my Mac, and it turns out it doesn’t work too well.
First, what works:
I am able to compile from source after installing all dependencies, including gcc, using homebrew. I am able to tell cmake to do what I mean, like this, from inside the build directory (see SWI-Prolog -- Installation on Linux, *BSD (Unix)):
However, now, when I start the graphical editor or debugger, I am getting never seen before warnings and the text is somehow very wide (every character is followed by about two white spaces?).
?- edit(aggregate_all/3).
true.
?- XPCE Xt warning: locale not supported by Xlib, locale set to C
Fontconfig warning: ignoring UTF-8: not a valid region tag
Some googling tells me that many projects suffer from similar issues. I can’t be now bothered to figure out how to fix it
This is annoying because I had managed to get it to work after some effort, but now it is broken. I suspect the MacOS upgrades.
Altogether the development experience on a (pretty modern) Mac has been crap. Every time the OS forcefully upgrades itself (every other week), a lot of stuff is broken (like, git doesn’t work) and I need to do this one trick:
xcode-select --install
I won’t complain more, but depending on what you are doing, it might indeed be easier to just do your development on a developer-friendly OS
Using /usr/bin/gcc doesn’t work. These are links to the Xcode clang compiler. If you install gcc using Macports, gcc is named gcc-mp-10 (depending on the version). You find the way the various binary releases are build in scripts/make-distribution.
Typically it should be enough to install using the binary bundle from the download page. That version is fully optimized and provides X11 if you install XQuartz. Unfortunately the thing is really brittle recently. Indeed, most MacOS and XQuartz upgrades break the thing over and over again. Sometimes it works to deinstall and reinstall XQuartz. Sometimes it doesn’t. That is, for the App. The commandline version is included in the app and can (normal installation) be found at the location below. That version runs fine
/Applications/SWI-Prolog.app/Contents/MacOS/swipl
MacOS locale handling and POSIX applications do not play well. I think most is fixed if you set the LANG environment in your shell’s profile file. I use export LANG=en_GB.UTF-8.
All in all you can develop on a Mac but it is all way more brittle than on a Linux machine.
I run everyday the following shell script to update SWIPL git, without enough knowledge to explain meaning of the script. So far, fortunately, it works for me on macOS Big Sur, emacs, ediprolog mode.
#! /bin/sh
echo " updating swipl ..."
pushd ~/src/swipl-devel/build
git pull
# only for prepare.
# git submodule update --init
echo "Continue ? (Y/n/r(emove cache, then ninja ...))"
stty raw -echo
char=`dd bs=1 count=1 2>/dev/null`
stty -raw echo
if [ $char == y ]
then
echo "Compiling SWI-Prolog."
continue
elif [ $char == r ]
then
echo " Removing cmake cache, and Compiling. "
rm -f "${HOME}/${USER}/src/swipl-devel/build/CMakeCache.txt"
cmake -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -DCMAKE_INSTALL_PREFIX=$HOME -G Ninja ..
continue
else
echo "No updates."
exit 0
fi
# only on first time
# cmake -DCMAKE_INSTALL_PREFIX=$HOME -G Ninja ..
ninja
# BUILDSWIPL=${HOME}/src/swipl-devel/build/src/swipl
# codesign -s "My Signing Identity" -f ${BUILDSWIPL}
# echo "\nninja codesign done\n"
# ctest -j 8
ninja install
echo "\nDone: swipl built.\n"
# codesign -s "My Signing Identity" -f ${SWIPL}
# echo "\ncodesign done\n"
# dump-pacs
popd;
exit 0
% gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
I guess it is gcc-10 when installed with homebrew:
% gcc-10 --version
gcc-10 (Homebrew GCC 10.2.0_4) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.