Skip to content
Snippets Groups Projects
Commit 24381d0e authored by Jeremy Soller's avatar Jeremy Soller Committed by GitHub
Browse files

Merge pull request #87 from jsalzbergedu/master

Added more concrete documentation for compiling test binaries for redox
parents 5174ed2f 3dee29f3
No related branches found
No related tags found
No related merge requests found
......@@ -94,7 +94,7 @@
- [What is available and what is not]()
- [Using schemes]()
- [Using Orbital]()
- [Compiling your program]()
- [Compiling your program](./userspace/writing_application/compiling_program.md)
- [A full example]()
- [Porting a program]()
- [Remove dependencies]()
......
# Compiling your program
Consider this "hello world" program:
```rust
fn main() {
println!("Hello World!");
}
```
To compile this program, you are going to need to edit some of your redox source files in such a way that your local redox repository will not be fit for updates via git or pull requests. It is reccomended that you do __not__ add the changes to the git history.
Step one: Go to redox/programs, and run `cargo new helloworld --bin`. It should create a directory redox/programs/helloworld with a redox/programs/helloworld/Cargo.toml like this:
```toml
[package]
name = "helloworld"
version = "0.1.0"
authors = ["Your Name <youremail@example.com>"]
[dependencies]
```
You want to compile a binary, so edit it so that it looks like this:
```toml
[package]
name = "helloworld"
version = "0.1.0"
authors = ["Your Name <youremail@example.com>"]
[[bin]]
name = "helloworld"
path = "src/main.rs"
[dependencies]
```
Step two: Note that binaries compiled from redox/programs have entries in the redox/Cargo.toml like this:
```toml
"programs/userutils",
```
Add a line below it that points to the helloworld program:
```toml
"programs/helloworld",
```
Step three: Open redox/mk/userspace/mod.mk. Notice how the target directories for the binaries are listed after `userspace: \`, and that every line in that block has a `\` after it exept for the last one. Add a `\` to the last line of the block, and add
```toml
filesystem/bin/helloworld
```
in a line inserted below.
Step four: Run `make` then `make qemu.` Do not run `make all`: it seems that the binary is not compiled to the correct location if `make all` is run.
Step five: Log in to redox, open the terminal, and run `helloworld`. It should print: "Hello World!"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment