Skip to content
This repository has been archived by the owner on Aug 29, 2021. It is now read-only.

Arm targets #2

Merged
merged 3 commits into from
Apr 21, 2021
Merged

Arm targets #2

merged 3 commits into from
Apr 21, 2021

Conversation

jeremyd2019
Copy link
Member

Added ability to build armv7 and aarch64-w64-mingw32 builds of these packages, including the ability to cross-compile mingw-w64-clang from x86_64 (because I don't have a very fast arm host to build on).

I've uploaded binaries to https://github.com/jeremyd2019/CLANG-packages/releases/tag/20210103_armbuilds

@mati865
Copy link

mati865 commented Jan 5, 2021

Mingw-w64 for ARM/AArch64 targets should default to Windows 10, unfortunately we cannot do it for x86_64 yet.

@jeremyd2019
Copy link
Member Author

@dennisameling
Copy link

@jeremyd2019 I have a Surface Pro X, just ping me if you'd like me to test something 👍🏼

Was able to install using pacman -U from your GH release:

image

Basic test is looking good:

image

@jeremyd2019
Copy link
Member Author

Updated binaries: https://github.com/jeremyd2019/CLANG-packages/releases/tag/20210206_armbuilds
Now with i686 included

@jeremyd2019
Copy link
Member Author

jeremyd2019 commented Feb 8, 2021

I actually tried to use the armv7 packages, and got a crash in ld.lld trying to link even a trivial program. Perhaps the most relevant message: An attempt was made to execute an instruction at an unaligned address and the host system does not support unaligned instruction references.

0:015> .effmach arm
Effective machine: ARM (NT) Thumb-2 (arm)
0:015:arm> !analyze -v
*******************************************************************************
*                                                                             *
*                        Exception Analysis                                   *
*                                                                             *
*******************************************************************************

*** WARNING: Unable to verify checksum for c:\msys32\clangarm32\bin\libLLVM.dll

KEY_VALUES_STRING: 1

    Key  : Timeline.OS.Boot.DeltaSec
    Value: 855346

    Key  : Timeline.Process.Start.DeltaSec
    Value: 1170


PROCESSES_ANALYSIS: 1

SERVICE_ANALYSIS: 1

STACKHASH_ANALYSIS: 1

TIMELINE_ANALYSIS: 1

Timeline: !analyze.Start
    Name: <blank>
    Time: 2021-02-08T19:00:52.468Z
    Diff: 4531 mSec

Timeline: Dump.Current
    Name: <blank>
    Time: 2021-02-08T19:00:57.0Z
    Diff: 0 mSec

Timeline: Process.Start
    Name: <blank>
    Time: 2021-02-08T18:41:27.0Z
    Diff: 1170000 mSec

Timeline: OS.Boot
    Name: <blank>
    Time: 2021-01-29T21:25:11.0Z
    Diff: 855346000 mSec


DUMP_CLASS: 2

DUMP_QUALIFIER: 0

FAULTING_IP: 
libc__!_cxa_decrement_exception_refcount+0
7218e752 e92d4830 push        {r4,r5,r11,lr}

EXCEPTION_RECORD:  (.exr -1)
ExceptionAddress: 7218e752 (libc__!_cxa_decrement_exception_refcount)
   ExceptionCode: c00000aa
  ExceptionFlags: 00000000
NumberParameters: 0

FAULTING_THREAD:  00000bd0

DEFAULT_BUCKET_ID:  APPLICATION_FAULT

PROCESS_NAME:  .exe

ERROR_CODE: (NTSTATUS) 0xc00000aa - An attempt was made to execute an instruction at an unaligned address and the host system does not support unaligned instruction references.

EXCEPTION_CODE: (NTSTATUS) 0xc00000aa - An attempt was made to execute an instruction at an unaligned address and the host system does not support unaligned instruction references.

EXCEPTION_CODE_STR:  c00000aa

WATSON_BKT_PROCSTAMP:  601e8e52

WATSON_BKT_MODULE:  libc++.dll

WATSON_BKT_MODSTAMP:  601e9340

WATSON_BKT_MODOFFSET:  5e752

BUILD_VERSION_STRING:  19041.1.arm64fre.vb_release.191206-1406

MODLIST_WITH_TSCHKSUM_HASH:  b6188ef390d11d0cea73ab7db6e0387e95ed0564

MODLIST_SHA1_HASH:  3380d2a621b3e11f2b965457c8f890d239ad2fc9

NTGLOBALFLAG:  70

APPLICATION_VERIFIER_FLAGS:  0

PRODUCT_TYPE:  1

SUITE_MASK:  272

DUMP_TYPE:  fe

ANALYSIS_SESSION_HOST:  DESKTOP-LRIMVUF

ANALYSIS_SESSION_TIME:  02-08-2021 11:00:52.0468

ANALYSIS_VERSION: 10.0.18362.1 arm64fre

THREAD_ATTRIBUTES: 
OS_LOCALE:  ENU

BUGCHECK_STR:  APPLICATION_FAULT

PRIMARY_PROBLEM_CLASS:  APPLICATION_FAULT

PROBLEM_CLASSES: 

    ID:     [0n320]
    Type:   [APPLICATION_FAULT]
    Class:  Primary
    Scope:  DEFAULT_BUCKET_ID (Failure Bucket ID prefix)
            BUCKET_ID
    Name:   Add
    Data:   Omit
    PID:    [Unspecified]
    TID:    [Unspecified]
    Frame:  [0]

LAST_CONTROL_TRANSFER:  from 7213abc0 to 7218e752

STACK_TEXT:  
12fef7f0 7213abc0 : 022e1d18 00000000 12fef838 00c1c04f : libc__!_cxa_decrement_exception_refcount
12fef7f0 00000000 : 022e1d18 00000000 12fef838 00c1c04f : libc__!ZNSt13exception_ptrD2Ev+0x18


THREAD_SHA1_HASH_MOD_FUNC:  50f4f729511ef4c672def88587953bceeff83084

THREAD_SHA1_HASH_MOD_FUNC_OFFSET:  5404a8121a2bd3b0bf70c86ebab35dbffe384443

THREAD_SHA1_HASH_MOD:  b341794ddc75590c0354db3577b325e556ea60f7

FOLLOWUP_IP: 
libc__!_cxa_decrement_exception_refcount+0
7218e752 e92d4830 push        {r4,r5,r11,lr}

FAULT_INSTR_CODE:  4830e92d

SYMBOL_STACK_INDEX:  0

SYMBOL_NAME:  libc__!_cxa_decrement_exception_refcount+0

FOLLOWUP_NAME:  MachineOwner

MODULE_NAME: libc__

IMAGE_NAME:  libc++.dll

DEBUG_FLR_IMAGE_TIMESTAMP:  601e9340

STACK_COMMAND:  ~15s ; .cxr ; kb

BUCKET_ID:  APPLICATION_FAULT_libc__!_cxa_decrement_exception_refcount+0

FAILURE_EXCEPTION_CODE:  c00000aa

FAILURE_IMAGE_NAME:  libc++.dll

BUCKET_ID_IMAGE_STR:  libc++.dll

FAILURE_MODULE_NAME:  libc__

BUCKET_ID_MODULE_STR:  libc__

FAILURE_FUNCTION_NAME:  _cxa_decrement_exception_refcount

BUCKET_ID_FUNCTION_STR:  _cxa_decrement_exception_refcount

BUCKET_ID_OFFSET:  0

BUCKET_ID_MODTIMEDATESTAMP:  601e9340

BUCKET_ID_MODCHECKSUM:  0

BUCKET_ID_MODVER_STR:  0.0.0.0

BUCKET_ID_PREFIX_STR:  APPLICATION_FAULT_

FAILURE_PROBLEM_CLASS:  APPLICATION_FAULT

FAILURE_SYMBOL_NAME:  libc++.dll!_cxa_decrement_exception_refcount

FAILURE_BUCKET_ID:  APPLICATION_FAULT_c00000aa_libc++.dll!_cxa_decrement_exception_refcount

TARGET_TIME:  2021-02-08T19:01:06.000Z

OSBUILD:  19042

OSSERVICEPACK:  662

SERVICEPACK_NUMBER: 0

OS_REVISION: 0

OSPLATFORM_TYPE:  arm64

OSNAME:  Windows 10

OSEDITION:  Windows 10 WinNt SingleUserTS

USER_LCID:  0

OSBUILD_TIMESTAMP:  unknown_date

BUILDDATESTAMP_STR:  191206-1406

BUILDLAB_STR:  vb_release

BUILDOSVER_STR:  10.0.19041.1.arm64fre.vb_release.191206-1406

ANALYSIS_SESSION_ELAPSED_TIME:  3826

ANALYSIS_SOURCE:  UM

FAILURE_ID_HASH_STRING:  um:application_fault_c00000aa_libc++.dll!_cxa_decrement_exception_refcount

FAILURE_ID_HASH:  {c15c13c3-2aa5-9e5e-eb09-1ac6bc9cc0be}

Followup:     MachineOwner
---------

Given that I haven't heard any great demand for arm32, I'm not going to spend too much time worrying about it, but thought it was a good idea to document this

@dennisameling
Copy link

@jeremyd2019 is armv7 (ARM32) still relevant though? Even Microsoft itself seems to be deprecating it. AFAIK all Windows on ARM devices from 2018 and later are ARM64.

Happy to test things on ARM64 (Surface Pro X) if needed 👍🏼

@jeremyd2019
Copy link
Member Author

jeremyd2019 commented Feb 22, 2021

I've finished another run through bootstrapping enough packages to build clang from MINGW-packages, and created a repo for them this time:
https://github.com/jeremyd2019/mingw-w64-clang-repo/releases/tag/aarch64
https://github.com/jeremyd2019/mingw-w64-clang-repo/releases/tag/i686
(and https://github.com/jeremyd2019/mingw-w64-clang-repo/releases/tag/sources)

Usage: add to /etc/pacman.conf

[clangarm64]
Server = https://github.com/jeremyd2019/mingw-w64-clang-repo/releases/download/aarch64
SigLevel = Optional

(or [clang32] and .../i686). I have not spend any time/cycles on x86_64, as my understanding is that is the version that @mati865 is focused on.

These were built from https://github.com/msys2/MINGW-packages/compare/master...jeremyd2019:d043d0c?expand=1, and it's probably about time to rebase and build updated packages.

@mati865
Copy link

mati865 commented Apr 7, 2021

Do I understand correctly this creates compiler binaries for ARM/AArch64 (aka host==arm)?

@jeremyd2019
Copy link
Member Author

yes.

I've found the armv7 variant doesn't actually work properly, so since nobody asked for it I abandoned it. But I've been running the aarch64 variant for months on my raspberry pi without issue.

@mati865
Copy link

mati865 commented Apr 7, 2021

Does MSYS2 work reliably on AArch64 Windows? If so I guess we could merge this (after resolving conflicts) but CI won't be able to help here.

@jeremyd2019
Copy link
Member Author

More or less. The current 'stable' version of Windows 10 only supports running 32-bit (i686) binaries under emulation. There were release preview builds available that can run x86_64 binaries, so I assume that will be included in the next stable release. When running the release preview though, I ran into issues with the FAST_CWD warning from cygwin confusing CMake, so I went back to the stable release and am running i686 msys2 (for which I build updated packages myself).

As far as reliability, the only real issue I run into is that periodically pacman seems to hang/deadlock, and I have to kill it via taskmgr. Sucks when it happens in the middle of building packages. I saw this on both x86_64 and i686 msys, on both release preview and stable windows.

@mati865
Copy link

mati865 commented Apr 7, 2021

I ran into issues with the FAST_CWD warning from cygwin confusing CMake

Cygwin often doesn't work in preview releases.

So it basically limits to using only unsupported (i686) version of MSYS2.
Sounds like AArch64 target for x86_64 host would be more useful right now but it'd be hard to make our PKGBUILDs cross-compilable.
In any case I think we could add testing/staging repo.

@jeremyd2019
Copy link
Member Author

I will rebase this in a while. This also depends on msys2/MSYS2-packages#2294 to be able to build.

@Biswa96
Copy link
Member

Biswa96 commented Apr 8, 2021

but CI won't be able to help here.

Wouldn't it possible to use llvm-mingw toolchain in CI? I've built/used some packages with it in Win10 ARM64 in Rpi4B.

@jeremyd2019
Copy link
Member Author

Wouldn't it possible to use llvm-mingw toolchain in CI? I've built/used some packages with it in Win10 ARM64 in Rpi4B.

Sounds like AArch64 target for x86_64 host would be more useful right now but it'd be hard to make our PKGBUILDs cross-compilable.

llvm-mingw is essentially such a cross-compiler. But I have no idea what would be involved in "mak[ing] our PKGBUILDs cross-compilable".

@mati865
Copy link

mati865 commented Apr 8, 2021

but CI won't be able to help here.

Wouldn't it possible to use llvm-mingw toolchain in CI? I've built/used some packages with it in Win10 ARM64 in Rpi4B.

I don't see how it could help. Making Clang package that can cross compile is the easy part. The hard part is getting all other packages.

mingw-w64-clang/PKGBUILD Outdated Show resolved Hide resolved
If the compiler's output cannot be run, assume we must use host
{clang,llvm}-tblgen.
Needs MSYS2-packages support, and IIRC only clang would succeed on x86.
The other packages are not set up for cross-compilation.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants