Skip to content

Fix executable compilation on macOS #237

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ gcc -static -m32 -o hello_cheerpx hello_cheerpx.c
If you cannot compile directly on your system, use Docker to create a 32-bit statically linked executable. Open your terminal, navigate to your project directory, and run the following command:

```sh
docker run --rm -v "$(pwd)":/src -w /src i386/debian bash -c "apt-get update && apt-get install -y gcc && gcc -static -m32 -o hello_cheerpx hello_cheerpx.c"
docker run --rm --platform=linux/amd64 -v "$(pwd)":/src -w /src i386/debian bash -c "apt-get update && apt-get install -y gcc && gcc -static -m32 -o hello_cheerpx hello_cheerpx.c"
```

Explanation:

- `docker run --rm`: Runs a Docker container and removes it after execution.
- `--platform=linux/amd64`: Defines the platform to use inside the container.
Copy link
Member

Choose a reason for hiding this comment

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

This does not seem to be accurate. Inside the container the platform must be 32-bit x86, not 64-bit x86. The purpose of the option is to enable execution of x86 containers on ARM M-class processors.

@AtibQur Please restructure this suggestion to clarify that only MacOS users should add this option. It does not seem advisable to enable this across the board.

- `-v "$(pwd)":/src`: Mounts your current directory into /src inside the container.
- `-w /src`: Sets the working directory inside the container to /src.
- `i386/debian`: Uses a 32-bit Debian image as the base.
Expand Down