dub
dub copied to clipboard
`arm64` is not recognized as a supported architecture
System information
$ dub --version
DUB version 1.31.1, built on Mar 12 2023
$ ldc2 --version
LDC - the LLVM D compiler (1.32.0):
based on DMD v2.102.2 and LLVM 15.0.7
built with LDC - the LLVM D compiler (1.32.0)
Default target: arm64-apple-darwin22.5.0
Host CPU: apple-m1
$ uname -a
Darwin 22.5.0 Darwin Kernel Version 22.5.0: Mon Apr 24 20:53:44 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T8103 arm64
Bug Description
arm64 is not recognized as a supported architecture. This is another name for aarch64. It's used by at least macOS and OpenBSD (output of uname). Clang recognizes this architecture regardless of platform.
How to reproduce?
$ dub --arch arm64
Error Unsupported architecture: arm64
Expected Behavior
Same as when the architecture is specified as aarch64:
$ dub --arch aarch64 09:59:52
No package manifest (dub.json or dub.sdl) was found in
/Users/jacobcarlborg/tmp
Please run DUB from the root directory of an existing package, or run
"dub init --help" to get information on creating a new package.
Error No valid root package found - aborting.
LDC generic target support requires a triple (IIRC, checks that at least one - is in the string), these one-word --arch values are restricted to what DMD supports.
It works fine passing just -mtriple arm64 to LDC:
$ ldc2 --version
LDC - the LLVM D compiler (1.32.0):
based on DMD v2.102.2 and LLVM 15.0.7
built with LDC - the LLVM D compiler (1.32.0)
Default target: arm64-apple-darwin23.0.0
Host CPU: apple-m1
$ cat main.d
extern (C) void main()
{
}
$ ldc2 -mtriple arm64 main.d -c
$ file main.o
main.o: ELF 64-bit LSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
Honestly I don't remember why I reported this. Perhaps I tried to cross-compile and was lazy and only typed arm64 (since that works with both LDC and Clang) instead of the whole triple. Using dub --arch with the full triple works.
This could be resolved with a better error message, something that explains triple and how to find it.
On Fri, Jul 21, 2023, 18:24 Jacob Carlborg @.***> wrote:
Honestly I don't remember why I reported this. Perhaps I tried to cross-compile and was lazy and only typed arm64 (since that works with both LDC and Clang) instead of the whole triple. Using dub --arch with the full triple works.
— Reply to this email directly, view it on GitHub https://github.com/dlang/dub/issues/2665#issuecomment-1645045740, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHSL44AEWSVHQLHBMA2IOTXRIODDANCNFSM6AAAAAAZM4KJXY . You are receiving this because you are subscribed to this thread.Message ID: @.***>
It works fine passing just -mtriple arm64 to LDC:
I meant dub's LDC support: https://github.com/dlang/dub/blob/3cc17fc618db6a69f02de26981218a30e00a5083/source/dub/compilers/ldc.d#L82-L95
Seems like Dub should just pass the value of the --arch flag as is to LDC using the -mtriple flag. Basically the above code can be replaced just with:
https://github.com/dlang/dub/blob/3cc17fc618db6a69f02de26981218a30e00a5083/source/dub/compilers/ldc.d#L91