Skip to content

Refine the build system #200

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Refine the build system #200

wants to merge 1 commit into from

Conversation

jserv
Copy link
Collaborator

@jserv jserv commented May 10, 2025

The top-level 'Makefile' unconditionally includes mk/{arm,riscv}.mk, and the shell substitutions inside those two files run immediately even when the active architecture is Arm.

That is why the "no qemu-riscv32 found" message appears during an Arm build.

Summary by Bito

This pull request refines the build system by modifying the top-level Makefile to conditionally include architecture-specific files for ARM and RISC-V. This enhancement prevents unnecessary shell substitutions during builds for inactive architectures, improving the overall build process and error message clarity.

Unit tests added: False

Estimated effort to review (1-5, lower is better): 2 - The changes are straightforward and primarily involve modifications to the Makefile, making the review process relatively simple.

The top-level 'Makefile' unconditionally includes mk/{arm,riscv}.mk, and
the shell substitutions inside those two files run immediately even when
the active architecture is Arm.

That is why the "no qemu-riscv32 found" message appears during an Arm
build.
@jserv jserv marked this pull request as draft May 12, 2025 01:31
@DrXiao
Copy link
Collaborator

DrXiao commented May 14, 2025

I also found another issue about the build system. If running make Q= to view all build steps, we can observe that the build system directly invokes the stage1 compiler to build the stage2 compiler, instead of using qemu-user as expected.

$ make Q=
...
...
+out/shecc-stage1.elf -o out/shecc-stage2.elf src/main.c
...

I think the above behavior is incorrect.

Therefore, I referred to the changes in this pull request and create a patch to resolve the above issue. However, since my changes are very similar to this pull request, and I'm unsure whether the build system has other underlying issues, I provide my patch here for discussion first.

Since my current work is related to the build system, I hope the above issue can at least be resolved soon.

@jserv
Copy link
Collaborator Author

jserv commented May 15, 2025

I also found another issue about the build system. If running make Q= to view all build steps, we can observe that the build system directly invokes the stage1 compiler to build the stage2 compiler, instead of using qemu-user as expected.

Alternatively, use make VERBOSE=1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants