I am on Arm macos and when I compile anything it produces x86_64 binaries, (which Macos will interpret). This does not work for compiling dynamic libraries which are included in pure Arm projects. Adding --cpu:arm64 does not seem to make a difference.
If you try this out, check the actual architecture of the file using lipo -archs filename as macos will run x86_64 binaries interpreted.
Also is there a place I can find older stable prebuilt nim versions somewhere?
Are you on apple silicon? I found a bug report describing the issue here so I think its been around for a bit: https://github.com/dom96/choosenim/issues/318
Is there any way to get old nim versions precompiled for mac (specifically 1.6.14)? Unfortunately brew doesn't let you download old versions and I am kind of stuck with a broken project
I am but I don't use choosenim. You can always build from source, easily. Follow these steps:
git clone https://github.com/nim-lang/csources_v2
cd csources_v2
make -j 8
cd ..
git clone https://github.com/nim-lang/nim
mv csources_v2/bin/nim nim/bin
cd nim
bin/nim c koch.nim
./koch boot -d:release --cpu:arm64
I've just installed compiler v2.0.0 on Fedora with choosenim. It doesn't seem to have a problem.
As many major Linux distributions (Ubuntu and Fedora, I think.) have already dropped the Nim compiler from their packages, choosenim is the only stable way I know to install the compiler (despite that it only supports x86-64 and always has problems on other architectures), so I hope it's not removed.
Maybe just add a warning to prevent Mac users from trying to use it?
Choosenim is the best way to have the latest Nim version around while still being able to jump to devel versions or a local copy.
Is it though? Atlas can do the same already.
Also choosemim on ARM Macs installs an x86-64 build of the compiler. Rosetta is fast but it still slows down the compilation.
I use ASDF as it also handles nodejs, elixir, etc. However it doesn’t work on windows AFAICT.
We really also should have pre-compiled ARM versions for both Linux and Mac. I believe Nim-nightlies provides some, but not for releases.
We really also should have pre-compiled ARM versions for both Linux and Mac.
Agree. Or just provide the C sources pre-cross-compiled for these targets.
Atlas can do the same already.
ditto nimble - in fact, life would be so much easier if we treated nim just like any other dependency and had the package manager download and use a version compatible with the project (as discovered via requires nim >=... < ...) - there's no difference between nim and any other dependency really.
Both Nimble and Atlas currently have a "bootstrap problem" for ARM on Macs or Linux. Using them to build and install a Nim compiler requires downloading a pre-compiled binary or installing Nim anyways. Currently ARM architecture binaries aren't provided by either.
Well last time I checked Nimble doesn't: https://github.com/nim-lang/nimble/issues/1123
there's no difference between nim and any other dependency really.
There really is a big difference both in theory and in practice. Let's see how others do it: