Closed shakfu closed 2 years ago
Pure requires LLVM 3.5 or older. Does Homebrew have this?
I think so:
$ brew info llvm
llvm: stable 13.0.0 (bottled), HEAD [keg-only]
Next-gen compiler infrastructure
https://llvm.org/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/llvm.rb
License: Apache-2.0 with LLVM-exception
==> Dependencies
Build: cmake ✔, swig ✔
Required: python@3.10 ✔
==> Options
--HEAD
Install HEAD version
==> Caveats
To use the bundled libc++ please add the following LDFLAGS:
LDFLAGS="-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib"
llvm is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
llvm: stable 13.0.0 (bottled), HEAD [keg-only]
llvm 13 is way too new. Only version 3.5 and earlier will work.
Fair enough. I guess that's the end of it then.
Unfortunately the developers of LLVM decided in version 3.6 to remove the fundamental feature that Pure was built upon. See #6 for more on that.
From a technical standpoint it should be possible to add a formula for LLVM 3.5 and then Pure to Homebrew but I don't know what their policies are, whether they would allow that. I think Homebrew also has a concept of separate collections of formulas that anyone can maintain in their own repository, so LLVM 3.5 and Pure formulas need not necessarily come from the central Homebrew repository, need not necessarily be subject to their requirements. And they need not come from Albert or anyone associated with the Pure project, so you could for example create them yourself if you want. I may be slightly off on my understanding of things. I haven't investigated Homebrew very much, since I am heavily involved with its competitor, MacPorts, and maintain the Pure ports there.
Thanks Ryan, that's very helpful.
I may just build llvm3.5 independently and then try build pure myself. My interest as mentioned earlier is really to use the faust2pd
tool which is written in pure.
If you've resigned yourself to building from source, you can make it easier by letting MacPorts do it for you, since we've already worked out the details and written the instructions into our Portfiles.
Yes, it's recommend not to install MacPorts and Homebrew on the same machine because they can conflict, but that applies primarily to when they are installed in their default locations. If you primarily use Homebrew, then you might want to keep it in its default location (/usr/local for Intel systems, /opt/homebrew on Apple Silicon) and install MacPorts in a different location (such as /opt/pure or even within your home directory), that way what you install with MacPorts shouldn't conflict with what you do in Homebrew.
What you have installed with Homebrew in its default location could conflict with what you want to install with MacPorts, but you could temporarily move the Homebrew stuff aside (sudo mv /usr/local /usr/local.off
) before installing or upgrading things with MacPorts, then move it back later (sudo mv /usr/local.off /usr/local
). These extra steps shouldn't be too inconvenient if you don't update your MacPorts ports often, which is probably fine given how infrequently releases of Pure software are happening these days.
So for example, after installing the Xcode command line tools (you probably don't need a full install of Xcode), you might use:
curl -OL https://distfiles.macports.org/MacPorts/MacPorts-2.7.1.tar.bz2
tar xjf MacPorts-2.7.1.tar.bz2
cd MacPorts-2.7.1
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
./configure --prefix=/opt/pure --with-applications-dir=/opt/pure/Applications --enable-readline
make -j$(sysctl -n hw.activecpu)
sudo make install
sudo /opt/pure/bin/port sync
sudo /opt/pure/bin/port install faust2pd
After that you can find out what was installed and where by running:
/opt/pure/bin/port contents faust2pd
If you like, you can add /opt/pure/bin to your shell's PATH environment variable. For example, if you're using zsh, you might use:
echo 'export PATH="$PATH:/opt/pure/bin:/opt/pure/sbin"' >> ~/.zprofile
You didn't mention your Mac model so I should also mention that in MacPorts we haven't been able to build LLVM versions as old as 3.5 for Apple Silicon systems. It just predates them by too long. So if you have an Apple Silicon Mac and your purpose for installing MacPorts is to use LLVM 3.5 (through Pure), you should tell MacPorts to behave like it would on an Intel system by editing macports.conf and setting build_arch x86_64
before installing any ports. This is not done often so if you encounter build failures please report them to MacPorts, but I suspect that the x86_64 versions of Pure and LLVM should work fine on Apple Silicon through the Rosetta 2 dynamic recompiler built into macOS.
(I keep saying LLVM 3.5 because that's the last version Pure works with. In MacPorts, LLVM 3.5 was deleted some time ago, I think before we realized that it was the last version Pure would work with, so in MacPorts Pure uses LLVM 3.4.)
Thanks Ryan. You've been very helpful indeed. I will probably go via your recommended macports route then.
Ryan, thanks a lot for the detailed explanation. And yes, I'm only using MacPorts myself, so Homebrew won't happen unless someone else does it. ;-) IIRC there actually was a formula for pure in Homebrew a long while ago, but it never had all the addon modules, and eventually got dropped.
I am interested in using
purelang
and alsofaust2pd
but I'm not interested in also installing Macports since I already use Homebrew and they don't work nicely together.Incidentally, I've already tried this (installed LLVM via Homebrew and got past
./configure
), but could not build. Havingpure
available on both popular packaging platforms would be great.Thanks.