-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
add support for FreeBSD cross-compilation #34000
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is a misunderstanding on the intended purpose of Host
and Target
.
We are using the gcc/gdb/llvm/lldb model for the definitions of Build
, Host
, Target
.
Build
the OS that the compiler is running on.
Host
the OS of the machine where the compiled code will run.
Target
the machine the which the running code will compile/debug.
In most cases TargetOS
== HostOS
. We have a few components which run on a different machine than their target. So far these are code generation and debug tools. For example we have a crossgen which can run on x64
, but generate code for Arm64
. I am also working on debugger tools which will run on Windows
but debug a Linux
runtime.
I think you are just trying to enable cross compilation of the runtime on Linux
targeting FreeBSD
. In this case the HostOS
and the TargetOS
should both be set to FreeBSD
.
Where is that definition? I only see use of Host and Target OS and ARCH through out the project files. And we already for example build Linux on Windows. |
I check and for the `linuxdac' target on Windows and I see CLR_CMAKE_HOST_OS=Windows_NT and CLR_CMAKE_TARGET_OS=Linux. (CLR_CMAKE_BUILD_OS is not set) |
Yes. That command line option builds a DAC on a There is very little mention of /cc @jkotas. |
see |
One source of confusion is that by default |
This should be hopefully ready for final pass. I made change @jkotas suggested to always pass
|
@@ -1,4 +1,5 @@ | |||
set(TARGET_ARCH_NAME $ENV{TARGET_BUILD_ARCH}) | |||
set(CROSS_ROOTFS $ENV{ROOTFS_DIR}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this already set by eng/common/cross/toolchain.cmake ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That does not seems to be set soon enough and build fails. src/coreclr/tryrun.cmake
has same line.
@wfurt, @janvorli, a related question: In order to support non-Linux/macOS Unix, the requirements are:
With this PR changes, would we be able to get ./build.sh -cross -os FreeBSD -configuration Release such that the produced |
perf leg failure seems unrelated. |
yes, I think so. for #3 all you needs to do is to avoid cross-genned or use environmental variables to suppress R2R. I was planning to feed cross-compiled runtime + SDK back to source-build. That may be good test. |
This change appears to be causing failures in all PRs due to passing |
Looks like runtime/src/coreclr/build-runtime.cmd Line 150 in 2ad6913
|
@wfurt The link to the issue tracking the unrelated failure should be added next time. https://github.com/dotnet/runtime/blob/master/docs/pr-guide.md#what-to-do-if-you-determine-the-failure-is-unrelated |
This leg was also failing and was not addressed in the justification for merging. |
This change allows to cross-compile FreeBSD on Linux using
./build.sh -cross -os FreeBSD
(depends on dotnet/arcade#5114 and dotnet/arcade#5100)
In general, this is using existing cross-compilation support. However, when we cross-compile for different CPU architecture, we can use host and target somewhat interchangeably. As we build arm Linux on x64 Linux) With this we need cleaner (and correct) separation. With the example above,
__HostOS
andCLR_CMAKE_HOST_OS
is set toLinux
while__TargetOS
andCLR_CMAKE_TARGET_OS
is set toFreeBSD
. With that in mind,CLR_CMAKE_HOST_LINUX
should not be used to determine target options as well as created binaries are not runnable on host even if CPU architecture is same.-fuse-ld=lld
is no longer needed with clang90 - both native and cross-compiled build.So far there is no CI. I did verify that generated pal/src/config.h is identical with one produced by running native build on FreeBSD.