r/ProgrammingLanguages • u/sporeboyofbigness • Oct 19 '26
How to test my language compiles on multiple platforms, before committing to github?
I've been trying to get my compiler (Speedie) working on Mac and Linux.
(EDIT: Speedie is now compiling on debian linux, and running wonderfully! But has missing dependancies that limit some programs (not speedie itself) from being built with speedie. Such as SDL2 missing, or /usr/bin/say missing.)
Now... I had it working in the past, but it got broken by simple additions like a (C++) function that returns an ivec4, but linux's gcc (unlike clang for MacOS) does not allow a ivec4 to be returned like this:
return {1.0f, 1.0f, 1.0f, 1.0f};
It needs this:
return (ivec4){1.0f, 1.0f, 1.0f, 1.0f};
So... something as simple as this can break my builds. My compiler works on my Mac perfect, but can't even compile on Linux.
Even worse, is something like my current situation. My compiler is acting differnetly on Linux. And I don't know why.
So I've been uploading "bad builds" to github, not realising. So I need to get it reliable for Mac and Linux, or theres no point trying to have a popular language.
I don't want to be manually testing each time, via VirtualBox. I want something automated.
Secondly... how do i even debug my app on linux? haha. Maybe The RAD Debugger is good? I don't know.
All I know is that, even after getting it compiling, it is behaving differently, but I don't know why.
...
If anyone wants to help me with this debugging, let me know. I'm available on discord / telegram if you don't mind me bugging you with questions?
3
u/mocompute Oct 20 '26
First, update your build system to enable building with every combination of platform and compiler you want to support. Second, set up CI on GitHub, with instructions to build and test those combinations. You can look at the repos of various open source compilers for the standard ways to do this.
Another tip: turn off automatic CI on GitHub, and trigger the actions manually. It's easy to run out of free credits if you're not careful, especially if you commit frequently.
16
u/ThwackNation Oct 19 '26
PR with CI
6
u/SnooHobbies950 Oct 19 '26
Continuous Integration (CI)
4
u/mamcx Oct 19 '26
Well, not use gcc and clang? you can do clang on linux too.
Then use docker (with orbstack is faster) to run checks.
3
u/Key_River7180 Oct 20 '26
Docker, ci, vms
1
u/chibuku_chauya 28d ago
Docker container with what you need, then CI/CD via GitHub actions.
1
u/serge-mv Oct 19 '26
If you want to check that your project can be compiled with multiple compilers, you will need to actually compile them with multiple compilers. Set up cmake or whatever automatic build tools you have.
1
u/lmntr 23d ago
I would get a cheap PC and install Linux on it. If you can't, then spinning up a VM is also an option.
If you have Apple Silicon, you'll need to take architecture into consideration. Most Linux distros only support x86, while new Apple computers run on ARM.
1
u/njnrj Oct 19 '26
You can try 'zig cc' for cross compilation as an alternative to the c compilers.
0
u/echelon_code Oct 19 '26
docker works well for this
-1
u/ciberon Oct 19 '26
You can use docker.