How Can I Build a Compiler on a Non-x86-64 System?

0
5
Asked By CuriousCoder42 On

I'm new to programming and currently diving into Python, C, and computer architecture. I'm trying to follow a project on GitHub about building a compiler, but I have a couple of questions:

1. If my processor isn't x86-64, can I still build the compiler? What are my options?
2. The project recommends using Lubuntu 18.04, which I read isn't supported. If I choose a different operating system, will I still be able to follow along and build the compiler?

I found some info about cross-compiling to macOS, and I'm curious if I should just run some sort of VM or container setup to go through the process instead of installing Linux directly on my machine. Any advice would be appreciated!

3 Answers

Answered By DevExplorer On

The tutorial will build x86-64 executables, and it's easier to follow if you stick with an x86-64 environment, whether emulated or not. About Lubuntu, you can choose any Linux distro that fits your needs. Just make sure it includes the essential tools (like make, cc, and nasm) to get started with compiling. Emulators can help you run the tutorial's programs, but be prepared for some compatibility hurdles depending on your setup.

IntelArchitect -

I want to get this right! So a VM would work, but what's the difference between that and a container for this project?

DevExplorer -

A VM simulates an entire machine while a container uses the host OS’s kernel. VMs can be more resource-heavy, but they fully mimic an environment.

Answered By CodeCrafter88 On

I'd recommend starting with an interpreter first if you're feeling overwhelmed by building a compiler; it’s a tough project that requires a solid understanding of algorithms and data structures. Once you're more comfortable, you could transition to a compiler later on. As for the environment, using a VM or a container can be a good choice to replicate the tutorial environment without altering your main OS.

NewbieNerd -

That makes sense! I might start with an interpreter. Any resources you'd recommend?

CodeCrafter88 -

Look for introductory tutorials on building simple interpreters or check online coding platforms for courses.

Answered By TechieTony99 On

If your processor isn't x86-64, you can still build the compiler, but the binaries it produces won't run natively on your machine. If you have an ARM processor, that could work since the project targets ARM as well. As for using Lubuntu 18.04, yes, it's outdated, and if you can't use it, any other mainstream Linux distribution should work as long as you have the necessary tools like a compiler and assembler.

DiscordDev -

What do you suggest for a good Linux distro? I heard Ubuntu is a solid choice.

TechieTony99 -

Ubuntu is great! It's user-friendly and has a lot of support, so I'd recommend starting there.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.