ndmitchell / rattle

Forward build system with speculation and caching
Other
102 stars 5 forks source link

How do I build and run Rattle? #27

Closed dbarowy closed 2 years ago

dbarowy commented 3 years ago

I am not a Haskeller. I see a rattle.cabal file so presumably cabal <something> <something>... any hints? Thanks.

ndmitchell commented 3 years ago

Sorry for the delay in replying. Unfortunately, it isn't that polished an experience, especially for non-Haskellers.

To use Rattle you need to write a Haskell script that serves as your build script. A very simple example might look like:

import Development.Rattle

main = rattleRun rattleOptions $ do
   cmd "gcc -c foo.c"
   cmd "gcc -o foo.exe foo.o"

You can run that using a Haskell distribution - e.g. Cabal or Stack, creating a .cabal file for your project, and specifying rattle as a dependency. Something like cabal init will create the skeleton project and then you add rattle in the dependencies section. You shouldn't need to install Rattle directly. There isn't yet any way to write a script in anything but Haskell, but it should be quite easy to add one (there are a few that were used for benchmarking, but they have weird quirks that make them not particularly suitable).

dbarowy commented 2 years ago

Thanks for the instructions. FWIW, it appears that you also need to explicitly install fsatrace somewhere in your $PATH, since it is a standalone executable. If you don't do that, you get an error like

rattle-hello: fsatrace: createProcess: exec: invalid argument (Bad file descriptor)

After installation, the issue goes away and one can see the output (foo.exe) once Rattle is done running.