Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve README.md for installation and issue #100

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,18 @@ Raspberry Pi 2/3/4 with GNU/Linux.
## Prerequisites
* Code generator in AMaCC relies on several GNU/Linux behaviors, and it
is necessary to have Arm/Linux installed in your build environment.
* Throughout this document, Ubuntu - Debian based Linux - on x86 PC is used as an
jserv marked this conversation as resolved.
Show resolved Hide resolved
example. If other Linux distro is used, Linux shell command needs to be
modified accordingly. For example, changing `apt-get` to `yum` for CentOS.
* Install [GNU Toolchain for the A-profile Architecture](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads)
- Select `arm-linux-none-gnueabihf` (AArch32 target with hard float)
```shell
$ sudo apt-get install gcc-arm-linux-gnueabihf
```

* Install QEMU for Arm user emulation
```shell
sudo apt-get install qemu-user
$ sudo apt-get install qemu-user
```

## Running AMaCC
Expand All @@ -80,6 +86,33 @@ OK

Check the messages generated by `make help` to learn more.

## Potential Issues Running AMaCC
There might be issue related to link path setting, error message `/lib/ld-linux-armhf.so.3: No such file or directory` like below.
```
$ make clean
rm -f amacc amacc-native elf/* elf/* out-gcc/*
$ make
CC+LD amacc
CC+LD amacc-native
$ qemu-arm ./amacc tests/hello.c
/lib/ld-linux-armhf.so.3: No such file or directory
```

It can be solved by either of the following options.
jserv marked this conversation as resolved.
Show resolved Hide resolved
```
# option 1 - using '-L' option
$ qemu-arm -L /usr/arm-linux-gnueabihf/ ./amacc tests/hello.c
hello, world

# option 2 - set QEMU_LD_PREFIX path
$ export QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf
$ echo $QEMU_LD_PREFIX
/usr/arm-linux-gnueabihf
$ qemu-arm ./amacc tests/hello.c
hello, world
```


Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't change this line. Minimize the necessary changes.

## Benchmark
AMaCC is able to generate machine code really fast and provides 70% of the performance of `gcc -O0`.

Expand All @@ -106,3 +139,4 @@ AMaCC is based on the infrastructure of [c4](https://github.com/rswier/c4).
* [Curated list of awesome resources on Compilers, Interpreters and Runtimes](http://aalhour.com/awesome-compilers/)
* [Hacker News discussions](https://news.ycombinator.com/item?id=11411124)
* [A Compiler Writing Journey](https://github.com/DoctorWkt/acwj) by Warren Toomey.
* [How to solve "error while loading shared libraries" when trying to run an arm binary with qemu-arm?](https://stackoverflow.com/questions/16158994/how-to-solve-error-while-loading-shared-libraries-when-trying-to-run-an-arm-bi)
jserv marked this conversation as resolved.
Show resolved Hide resolved