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

[luajit] Fix cross compile for macOS #29003

Merged
merged 2 commits into from
Jan 27, 2023
Merged

Conversation

xiaozhuai
Copy link
Contributor

Describe the pull request

  • What does your PR fix?

Fix #28848

github-actions[bot]
github-actions bot previously approved these changes Jan 17, 2023
github-actions[bot]
github-actions bot previously approved these changes Jan 17, 2023
github-actions[bot]
github-actions bot previously approved these changes Jan 17, 2023
@LilyWangLL LilyWangLL added category:port-bug The issue is with a library, which is something the port should already support category:community-triplet A PR or issue related to community triplets not officially validated by the vcpkg team. labels Jan 18, 2023
LilyWangLL
LilyWangLL previously approved these changes Jan 18, 2023
@LilyWangLL LilyWangLL added the info:reviewed Pull Request changes follow basic guidelines label Jan 18, 2023
if(TARGET_ARCHITECTURE STREQUAL x64)
set(TARGET_ARCHITECTURE x86_64)
endif()
execute_process(COMMAND uname -m OUTPUT_VARIABLE HOST_ARCHITECTURE)
Copy link
Member

Choose a reason for hiding this comment

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

Should this strip trailing whitespace? #28939

Copy link
Contributor

Choose a reason for hiding this comment

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

There is string(STRIP ) below this line.

But do we need the host architecture at all?

  • There is VCPKG_CROSSCOMPILING to detect cross-triplet builds.
  • The usage of HOST_...FLAGS indicates the build of host tools during the target build, which is not how vcpkg works.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should this strip trailing whitespace? #28939

There is string(Strip ...)

There is string(STRIP ) below this line.

But do we need the host architecture at all?

  • There is VCPKG_CROSSCOMPILING to detect cross-triplet builds.
  • The usage of HOST_...FLAGS indicates the build of host tools during the target build, which is not how vcpkg works.

We need the host architecture. Since there are minilua and buildvm executable (host tools) which participated in the build process but not installed. These tools need to be runable on host machine.

Copy link
Member

@BillyONeal BillyONeal Jan 19, 2023

Choose a reason for hiding this comment

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

We need the host architecture. Since there are minilua and buildvm executable (host tools) which participated in the build process but not installed. These tools need to be runable on host machine.

If this scenario is happening then when host compiling they should be included and when cross compiling they should not be. See Google Protocol Buffers for an example that does this: when the target triplet is the host triplet it builds protoc, otherwise it parachutes in the protoc when built for the host: https://github.com/microsoft/vcpkg/blob/master/ports/protobuf/portfile.cmake

This arrangement is fairly important because what the host triplet is is a user setting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not the same case. protoc need to be installed since it participated in the user project build process. But minilua and buildvm only participated in the luajit build process. They should not be installed. This port has another executable named luajit and it is TARGET_ARCHITECTURE. The HOST_ARCHITECTURE just make sure minilua and buildvm is runnable on host machine, otherwise the build will fails.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Em... wait, It seems HOST_ARCHITECTURE can be omited. I will update this pr.

Copy link
Contributor

@dg0yt dg0yt Jan 20, 2023

Choose a reason for hiding this comment

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

AFAICT the host dependency requirement in vcpkg is also for tools which are used only during the port build process. Unfortunately, this means patching in most cases, and actually installing the internal tools. Some ports use a manual-tools dir for this purpose.
(IMO this could be resolved in a better way, but there is no proof of concept.)

Copy link
Member

@BillyONeal BillyONeal left a comment

Choose a reason for hiding this comment

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

Can you answer the questions about the uname call?

@BillyONeal BillyONeal added requires:author-response and removed info:reviewed Pull Request changes follow basic guidelines labels Jan 18, 2023
@xiaozhuai xiaozhuai requested a review from BillyONeal January 20, 2023 02:37
Copy link
Member

@BillyONeal BillyONeal left a comment

Choose a reason for hiding this comment

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

I'm approving this despite the outstanding concerns about doing cross compilation correctly, because while this is not the correct behavior, it's an improvement on the status quo, and the path to doing it correctly won't be damaged by this being merged first.

@BillyONeal
Copy link
Member

@xiaozhuai We would really appreciate you plumbing in cross support correctly but I'm going to merge this as is for now. Thank you!

@BillyONeal BillyONeal added category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist and removed category:port-bug The issue is with a library, which is something the port should already support requires:author-response labels Jan 27, 2023
@BillyONeal BillyONeal merged commit 60eff91 into microsoft:master Jan 27, 2023
@xiaozhuai xiaozhuai deleted the dev-luajit branch January 28, 2023 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:community-triplet A PR or issue related to community triplets not officially validated by the vcpkg team. category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[luajit] Not respect VCPKG_TARGET_ARCHITECTURE
4 participants