Recently, I wanted to build the C toolchain as a Nix flake for my NixOS install. Today, I got it to build and compile a C program.
When I went to package the toolchain, I encountered these problems:
1. When trying to download the toolchain with every git submodule, there was a reference to the GraphX template in .gitmodules, but there wasn't a reference to it in the directory tree itself. This caused issues when Nix tried to download the repo, only for it to give an error. I sent a PR to fix this.
2. In the convimg repo, there was also an unused reference in .gitmodules, but for fasmg-ez80. I also sent a PR to fix it, but I had to send another PR to the toolchain to update the referenced convimg repo.
3. In the Makefile of the toolchain, I had to stop it from building convimg, convfont, and convbin as they are already in the Nixpkgs software repo.
4. cedev-config tried to build a statically linked executable. In Nixpkgs, the standard glibc installation only contains static libraries. I had to patch it to build a dynamically linked executable.
5. The version of fasmg in the Nixpkgs repository is out-of-date. At build-time, fasmg complained about an invalid instruction inside a calminstruction. At runtime, fasmg wouldn't stop running in the link phase. I sent a PR to Nixpkgs to update it, but I had to give an updated version of fasmg in the meantime.
6. The references to convimg, ez80-link, fasmg, and everything else had been hard-coded to be relative to the location of the package. In Nix, every single package has a unique location within the Nix store. I didn't think about symlinking to said programs, so I had to patch that out to use the commands to use the packages relative to the PATH environment variable.As of writing, I realized it would be better to patch it to give the absolute paths of the programs instead of using PATH. It now uses absolute paths.
7. There appears to be a bug in the toolchain where omitting a description gives the flag '-b' containing the current timestamp to convbin, which isn't a valid option. I had to patch that out not only to remove the invalid option, but to remove the timestamp as that wouldn't result in a reproducible program. EDIT: This was due to the version of convbin, so I had to switch to the master branch of convbin instead.
If you have Nix installed, you can get a template by running:
Code:
To build the CE libraries, run
Code:
The '-o clibs.8xg' is required because TILP refused to send them without the `8xg` extension.
Link: https://github.com/myclevorname/flake
When I went to package the toolchain, I encountered these problems:
1. When trying to download the toolchain with every git submodule, there was a reference to the GraphX template in .gitmodules, but there wasn't a reference to it in the directory tree itself. This caused issues when Nix tried to download the repo, only for it to give an error. I sent a PR to fix this.
2. In the convimg repo, there was also an unused reference in .gitmodules, but for fasmg-ez80. I also sent a PR to fix it, but I had to send another PR to the toolchain to update the referenced convimg repo.
3. In the Makefile of the toolchain, I had to stop it from building convimg, convfont, and convbin as they are already in the Nixpkgs software repo.
4. cedev-config tried to build a statically linked executable. In Nixpkgs, the standard glibc installation only contains static libraries. I had to patch it to build a dynamically linked executable.
5. The version of fasmg in the Nixpkgs repository is out-of-date. At build-time, fasmg complained about an invalid instruction inside a calminstruction. At runtime, fasmg wouldn't stop running in the link phase. I sent a PR to Nixpkgs to update it, but I had to give an updated version of fasmg in the meantime.
6. The references to convimg, ez80-link, fasmg, and everything else had been hard-coded to be relative to the location of the package. In Nix, every single package has a unique location within the Nix store. I didn't think about symlinking to said programs, so I had to patch that out to use the commands to use the packages relative to the PATH environment variable.
7. There appears to be a bug in the toolchain where omitting a description gives the flag '-b' containing the current timestamp to convbin, which isn't a valid option. I had to patch that out not only to remove the invalid option, but to remove the timestamp as that wouldn't result in a reproducible program. EDIT: This was due to the version of convbin, so I had to switch to the master branch of convbin instead.
If you have Nix installed, you can get a template by running:
Code:
nix flake init -t github:myclevorname/flake#ce-toolchain
nix flake lock
nix build
To build the CE libraries, run
Code:
nix build github:myclevorname/flake#ce-libs -o clibs.8xg
The '-o clibs.8xg' is required because TILP refused to send them without the `8xg` extension.
Link: https://github.com/myclevorname/flake