Skip to content

clr.alljits subset fails cross-compiling for linux-x86 on linux-x64 #68044

@ta264

Description

@ta264

Description

Cross-compiling the clr.alljits subset for linux-x86 on linux-x64 fails.

The issue seems to be related to building the win-x86 jit as commenting out this line lets the build succeed:

create_standalone_jit(TARGET clrjit_win_x86_${ARCH_HOST_NAME} OS win ARCH x86 DESTINATIONS .)

I think the solution might be to change TARGET_UNIX to HOST_UNIX here:

#ifndef TARGET_UNIX

Reproduction Steps

Checkout repo on ubuntu 20.04, build with

./eng/common/cross/build-rootfs.sh x86
./eng/build.sh -ci -c Release -cross -os Linux -arch x86 -subset clr.alljits

Expected behavior

Build succeeds

Actual behavior

Build fails with the error

Consolidate compiler generated dependencies of target gcinfo_win_x86
  [  4%] Built target jitinterface_x86
  [  4%] Built target gcinfo_universal_arm
  Consolidate compiler generated dependencies of target eventprovider
  [  4%] Building CXX object gcinfo/CMakeFiles/gcinfo_win_x86.dir/__/gcdump/gcdump.cpp.o
  [  4%] Building CXX object gcinfo/CMakeFiles/gcinfo_win_x86.dir/__/gcdump/i386/gcdumpx86.cpp.o
  Scanning dependencies of target libunwind
  Consolidate compiler generated dependencies of target libunwind
  [  4%] Built target eventprovider
  [  4%] Building C object /runtime/artifacts/obj/external/libunwind/CMakeFiles/libunwind.dir/runtime/src/native/external/libunwind/src/os-linux.c.o
  [  4%] Built target eventing_headers
  [  4%] Building C object /runtime/artifacts/obj/external/libunwind/CMakeFiles/libunwind.dir/runtime/src/native/external/libunwind/src/mi/init.c.o
  [  4%] Building C object /runtime/artifacts/obj/external/libunwind/CMakeFiles/libunwind.dir/runtime/src/native/external/libunwind/src/mi/flush_cache.c.o
  [  4%] Building C object /runtime/artifacts/obj/external/libunwind/CMakeFiles/libunwind.dir/runtime/src/native/external/libunwind/src/mi/mempool.c.o
  [  4%] Building C object /runtime/artifacts/obj/external/libunwind/CMakeFiles/libunwind.dir/runtime/src/native/external/libunwind/src/mi/strerror.c.o
  In file included from /runtime/src/coreclr/gcdump/i386/gcdumpx86.cpp:12:
  In file included from /runtime/src/coreclr/inc/utilcode.h:44:
  /runtime/src/coreclr/inc/clrnt.h:841:16: error: redefinition of '_RUNTIME_FUNCTION'
  typedef struct _RUNTIME_FUNCTION {
                 ^
  /runtime/src/coreclr/pal/inc/pal.h:3085:16: note: previous definition is here
  typedef struct _RUNTIME_FUNCTION {
                 ^
  In file included from /runtime/src/coreclr/gcdump/i386/gcdumpx86.cpp:12:
  In file included from /runtime/src/coreclr/inc/utilcode.h:44:
  /runtime/src/coreclr/inc/clrnt.h:846:16: error: redefinition of '_DISPATCHER_CONTEXT'
  typedef struct _DISPATCHER_CONTEXT {
                 ^
  /runtime/src/coreclr/pal/inc/rt/palrt.h:1205:16: note: previous definition is here
  typedef struct _DISPATCHER_CONTEXT {
                 ^
  In file included from /runtime/src/coreclr/gcdump/gcdump.cpp:14:
  In file included from /runtime/src/coreclr/inc/utilcode.h:44:
  /runtime/src/coreclr/inc/clrnt.h:841:16: error: redefinition of '_RUNTIME_FUNCTION'
  typedef struct _RUNTIME_FUNCTION {
                 ^
  /runtime/src/coreclr/pal/inc/pal.h:3085:16: note: previous definition is here
  typedef struct _RUNTIME_FUNCTION {
                 ^
  In file included from /runtime/src/coreclr/gcdump/gcdump.cpp:14:
  In file included from /runtime/src/coreclr/inc/utilcode.h:44:
  /runtime/src/coreclr/inc/clrnt.h:846:16: error: redefinition of '_DISPATCHER_CONTEXT'
  typedef struct _DISPATCHER_CONTEXT {
                 ^
  /runtime/src/coreclr/pal/inc/rt/palrt.h:1205:16: note: previous definition is here
  typedef struct _DISPATCHER_CONTEXT {
                 ^

Regression?

This built for .NET 5.0.3 (though the resulting product didn't function).

I think the regression may have been in #41126 but I'm not sure about this.

The build fails in .NET 6.0.3 also.

Known Workarounds

I think the solution might be to change TARGET_UNIX to HOST_UNIX here:

#ifndef TARGET_UNIX

Configuration

Attempting to cross-compile main commit 89b034d8e3.

Using Ubuntu 20.04 x64 VM under Windows 10 x64 hyper-v.

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions