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

WIP replace cli flag --prebuilt-platform with --build-host #6859

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

lukewilliamboswell
Copy link
Collaborator

@lukewilliamboswell lukewilliamboswell commented Jul 2, 2024

This PR is built on top of #6808, which should be merge first.

This PR makes progress towards decoupling roc from the host toolchains, by moving host rebuilding behind a compiler flag so it is no longer the default behaviour. It is still available where required using --build-host however will give a warning;

WARNING: platforms are responsible for building hosts, this flag will be removed when internal test platforms have a build script

I was originally working towards removing rebuilding in one go in #6696, however I realised this was a very large and difficult change due to the need to change all of the cli tests.

This PR achieves the same effect, effectively removing platform rebuilding from the cli for end users -- while keeping the cli tests as they are. This enables the cli tests to be adapted one by one instead of all at once. Once all of the tests have a build script, host rebuilding functionality can be entirely removed along with the associated dependencies.

Application authors who use a platform release from a URL package are not affected by this change. These users will continue to use a prebuilt platform.

Platform authors need to include a build script in their platform to build host binaries. This change will make running platform example less convenient if they are not using a URL release, as the platform binaries will need to be built first in a separate step. For example this workflow;

  1. Build the platform binary roc build.roc using host toolchain e.g. cargo or zig
  2. Run the example application roc examples/hello-world.roc

Architecture::Aarch32 => "aarch32",
Architecture::Aarch64 => "aarch64",
Architecture::Aarch32 => "arm",
Architecture::Aarch64 => "arm64",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Looking at rust and zig targets, I think this should be changed to aarch64 to be consistent with those toolchains.

This will be a breaking change for platforms that have prebuilt binaries.

WIP

WIP

WIP

ignore some cli tests that are going to move

try fix for linux valgrind tests

try a legacy host for valgrind

fix roc_glue tests
let platform_main_roc = match &loaded.entry_point {
EntryPoint::Executable { platform_path, .. } => platform_path.to_path_buf(),
_ => unreachable!(),
};

// For example, if we're loading the platform from a URL, it's automatically prebuilt
// even if the --prebuilt-platform CLI flag wasn't set.
let is_platform_prebuilt = prebuilt_requested || loaded.uses_prebuilt_platform;
Copy link
Collaborator Author

@lukewilliamboswell lukewilliamboswell Jul 9, 2024

Choose a reason for hiding this comment

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

I should add a check here; if loaded.uses_prebuilt_platform is true and also build_host_requested then the platform is a URL release and we have also been instructed to rebuild the host with the flag --build-host. These two are incompatible because roc cannot build the host.


// file name for a stubbed app dynamic library file
pub fn stub_app_lib_file_name(&self) -> String {
format!("libapp.{}", self.dynamic_library_file_ext())
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

On Windows I think it may just be app.dll, on unix* systems we need the lib prepended

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.

None yet

2 participants