jakt
jakt copied to clipboard
selfhost/main: Create build dir before writing into it
If you do not have a build directory, the selfhost compiler gets an error if it tries to write into that directory.
➜ jakt_selfhost -b -R ~/projects/jakt/runtime hello_world.jakt
Runtime error: Error(code=2)
the signature of mkdir on Windows is different :sweat:
@miller-time - still seems it's not quite finding the right mkdir
Hello!
One or more of the commit messages in this PR do not match the Jakt code submission policy, please check the lint_commits
CI job for more details on which commits were flagged and why.
Please do not close this PR and open another, instead modify your commit message(s) with git commit --amend and force push those changes to update this PR.
@ADKaster thanks so much for all the corrections!
rebased the branch, squashed all the messy commits...
It still says Call to unknown function: ‘mkdir’
but that's happening during this step:
[3/5] Building jakt file selfhost/main.jakt with jakt_stage0
Does that mean jakt_stage0 compiled with my changes, but for some reason jakt_stage1 doesn't work?
Actually it means that you need to copy your runtime changes over onto bootstrap/stage0/runtime, including the prelude changes.
The stage0 compiler uses its own copy of the prelude to compile things when using the CMake build, which is distinct from the top level runtime directory used by the stage 1/2 compiler. Since we are using stage0 to compile stage1, the updated prelude functionality needs duplicated.
@ADKaster yeah I just noticed that there's another runtime there (right after posting that message).
I tried copying in my runtime changes, but the error persists. Did I miss something?
You need to do this in stages, apparently.
- Add new methods to prelude
- build compiler
- copy generated stage1.cpp over stage0/jakt.cpp
- now you can use the new methods in the compiler itself.
I don't think this is how this was intended to work, but that's the only way I could add a method to the prelude locally.
@alimpfard Why do we need to regenerate the boostrap compiler when adding methods to prelude for use in the compiler? Could we make it automatically interpret the prelude instead of comptime slapping it into the .cpp of the compiler? 🤔
We could read it at runtime I guess, if we assume its location relative to the runtime dir.
@ADKaster thanks, I think that got me a little closer...
jakt/build/jakt_stage1_main.cpp:55053:6: error: no matching function for call to 'mkdir'
/usr/include/x86_64-linux-gnu/sys/stat.h:389:12: note: candidate function not viable: requires 2 arguments, but 1 was provided
extern int mkdir (const char *__path, __mode_t __mode)
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!
This pull request has been closed because it has not had recent activity. Feel free to re-open if you wish to still contribute these changes. Thank you for your contributions!