The Goal: package an executable "Hello, world" program in Idris2
I'm working from the docs, which gives descriptions of the package fields but sadly doesn't provide any examples.
The issue: "File Not Found" compilation errors on the builddir and outputdir
Below is a walkthrough of my directory structure and contents.
$ ls
kata.ipkg README.md src
$ ls src/
Index.idr
$ cat src/Index.idr
module Index
main : IO ()
main = putStrLn "Hello, world"
$ cat kata.ipkg
package kata
authors = "eleanorofs"
builddir = "build"
bugtracker = "https://gitlab.com/eleanorofs/idris-kata/-/issues"
executable = "src/Index.idr"
outputdir = "dist"
homepage = "https://gitlab.com/eleanorofs/idris-kata"
main = Index
maintainers = "eleanorofs"
opts = "--cg node --directive pretty"
readme = "./README.md"
sourcedir = "./src"
sourceloc = "https://gitlab.com/eleanorofs/idris-kata"
version = 0.0.1
$ idris2 --build kata.ipkg
1/1: Building Index (./src/Index.idr)
Uncaught error: File error (dist/src/Index.idr): File Not Found
When I delete the outputdir
line, it gives me the same error, but on the builddir
(build/exec/src/Index.idr instead.
Questions
This makes me think I've misunderstood something pretty fundamental about how this compiler is supposed to work.
Idris itself maintains the contents of build/ and dist/, right? So there's nothing I need to do to those directories, right?
If so, why does it succeed in building Index.idr but then thow an error trying to find the files that I would have expected it to generate itself?
I sort of fixed it, but I can't fully explain it.
My first error was misunderstanding the
executable
field. Above, I haveBut what was needed was to describe the executable output file. In my case, for node compilation, that's
But that didn't fully solve the issue. The other necessary step was to delete the
builddir
andoutputdir
lines.I don't know exactly why that is. Are those properties incompatible with
executable
or was I supplying wrong values?I am leaving this question open to a better answer than mine because I'm still mildly curious and because anyone searching for answers about
builddir
andoutputdir
generally would be disappointed by this answer.