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 cross-compile instructions and makefile support #849

Merged
merged 1 commit into from
Jul 17, 2024

Conversation

mflatt
Copy link
Contributor

@mflatt mflatt commented Jun 27, 2024

Add a --cross argument to configure to indicate that the generated makefile's make should be like make kernel, and a pb-based bootstrap should rerun configure to build for the host machine instead of the specified target machine.

Also, add support for DESTDIR as a more conventional alternative to the --temproot configure flag. While we're at it, recognize CFLAGS_FOR_BUILD for building bin/zuo.

As part of the change to configure, having CC_FOR_BUILD set does not by itself disable the use of pb for creating or updating boot files. Depending on how boot files are obtained, --force now may be needed when using CC_FOR_BUILD as part of a cross compile that doesn't use --cross.

Relevant to #847 and #848

BUILDING Outdated
Comment on lines 556 to 562
The configure arguments that are needed to cross compile will vary
with the host and target machines. On a machine where ta6osx is the
native machine type, for example, cross compiling for tarm64osx may be
as simple as specifying an `-arch` flag for the C compiler:

./configure --cross -m=tarm64osx CFLAGS="-arch arm64" CC_FOR_BUILD=cc

Choose a reason for hiding this comment

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

How in this invocation can I specify that ta6osx is the native machine type? Your autodetection is wrong in some cases so I need to specify it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That would fall into the "If more configuration is needed" case described in the next paragraph. In retrospect, though, that approach is somewhat buried in the explanation, so I'll try revising.

I experimented with ways of passing flags through for the host build, so that you'd be able to specify the host machine type or other configuration options. But they didn't turn out any better than directly using configure to build for the host platform (before configure for the target platform).

Can you say more about when autodetection goes wrong?

Add a `--cross` argument to `configure` to indicate that the generated
makefile's `make` should be like `make kernel`, and a pb-based
bootstrap should rerun `configure` to build for the host machine
instead of the specified target machine.

Also, add support for `DESTDIR` as a more conventional alternative to
the `--temproot` configure flag. While we're at it, recognize
`CFLAGS_FOR_BUILD` for building `bin/zuo`.

As part of the change to `configure`, having `CC_FOR_BUILD` set does
not by itself disable the use of pb for creating or updating boot
files. Depending on how boot files are obtained, `--force` now may be
needed when using `CC_FOR_BUILD` as part of a cross compile that
doesn't use `--cross`.
@mflatt
Copy link
Contributor Author

mflatt commented Jul 15, 2024

I think this change is uncontroversial, especially since it only adjusts prose and build scripts. So, unless there are objections, I'm planning to merge.

@mflatt mflatt merged commit 1524f80 into cisco:main Jul 17, 2024
15 checks passed
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