Build fpm without Haskell stack

I want to install and play with fpm on my hobby machine, but the combination of hardware (Pentium 4) and software (Arch Linux 32-bit) has made it difficult to get Haskell stack working. It installs, but can’t build anything due to some incompatibility with the ncurses library. I’m looking for a workaround.

Even though fpm is meant to be built using Haskell stack, is it possible to bypass that and build manually? I assume I’d be responsible for installing the dependencies in https://github.com/fortran-lang/fpm/blob/master/bootstrap/package.yaml which I’m hoping are mostly provided by my distro’s package manager. Supposing I do that, what’s next? For context, I have no experience with Haskell development or its toolchain.

2 Likes

In theory, yes. I don’t know that it will be very easy. Many (most) of the Haskell libraries don’t have distro packages (i.e. pacman won’t be able to find them). Haskell has a similar problem to Fortran in that, libraries compiled with different versions of the compiler aren’t necessarily compatible, so unless all the libraries you install are compiled with the same version of the compiler you’re using, they won’t work. This is why Stack (or Cabal) became so popular, there are simply too many versions of too many libraries and too many versions of the compiler in use to do it all manually.

So, what Stack does is keep it’s own versions of the compilers separate from whatever might be installed on the system, and builds all of the dependencies with the same version of the compiler that you’re using for your project within the same build directory as your project. So you could do what Stack is doing manually, but it won’t be easy.

If you’re using Arch, I believe I used the stack-static AUR, which is statically linked and doesn’t rely on any of the system libraries. You might try that.

Once fpm is more developed and we fix this issue: https://github.com/fortran-lang/fpm/issues/123, it will be possible to generate a self-contained tarball for fpm that builds using standard tools such as gfortran and cmake, with no Haskell dependency. That will fix your problem @nshaffer. But we are not there yet.

Also we will be distributing fpm as a binary, so then you will be able to download fpm as a binary, and then build fpm from source using fpm.

Hm, that’s too bad. Being on an older CPU architecture really hamstrings me in terms of the AUR. My experience is that very few packages “just work” with pentium4 or i486, including the ones usually recommended to help make Stack play nicely with Arch.

@certik
Wow! I had not recently checked in on development of the Fortran version. Nice to see so much recent activity and interest!

2 Likes

@nshaffer indeed, it’s super exciting seeing so many people contribute to the Fortran based fpm.

1 Like

Yeah. I almost can’t even keep up with the pace of development at this point. It’s great.

1 Like

I think it’s worth following up on this. The relatively recently added install.sh script in the fpm repo does wonders for simplifying the process of getting Stack set up. For 32-bit Arch Linux, there was still the issue of getting the ncurses5-compat-libs package installed for Stack to work properly. It turns out that I was just missing one small step to get it right: adding “pentium4” to the list of supported architectures in the PKGBUILD file. I’m excited to start using fpm with my hobby projects (and stop wasting time on Makefiles & CMakeLists.txt)!

2 Likes

Wanting to update my old fpm 0.1.3 alpha on an Ubuntu machine, I was also delighted today by the install.sh script:

$ git clone https://github.com/fortran-lang/fpm.git
$ cd fpm
$ ./install.sh

and it was done!

2 Likes