-
Notifications
You must be signed in to change notification settings - Fork 17.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
gollvm: cross compiling #42388
Comments
CC @thanm I believe that GoLLVM does not not current support aarch64-linux anyhow. |
Thank you for your reply, but the documents of gollvm writes that gollvm is supported for aarch64 linux. Which architectures and operating systems are supported for gollvm? |
OK, thanks. What is the exact output that you get from your |
It outputs as follows: /usr/local/bin/llvm-goc: unable to determine target CPU features for target aarch64-unknown-linux |
This is caused by the inconsistency between the triple_ lists in ArchCpusAttrs.h and the normalized triple_ that we get through the --target option, and the root cause is clang. In fact, if you set --target=x86_64-linux, the same error will be reported. I can fix this problem. |
Thank you very much! |
Thanks @erifan. I took a look and I can reproduce as well. I assume this will involve changing and/or rerunning tools/capture-fcn-attributes.go -- are you planning of sending a patch? |
@thanm Yes, I plan to send a patch, but it will be next week, is that ok? |
Yup, that's fine. Thanks. |
@wyw900807 , there are some common files for both Clang and llvm-goc. As for now - you can do the following (this duplicates what Clang itself would do):
You shall see some CPU features, show during (4), with a "-" prefix. Those are non-supported features, for a specific CPU model (5). You can't expected that to be used during -mtune Since you are cross-compiling - it would be required to get corresponding CPU features (4) and the CPU model(5) definitions, on Aarch64 (probably you would either run under qemu or would use a system-on-chip/micro-controller, for that purpose). |
Github Actions give access to a relic Clang 9 - so I used it for an example. Here is the workflow configuration file: |
@advancedwebdeveloper Thank you for your help, I will try it |
Hi, @thanm I thought gollvm already supports cross compiling, but it doesn't seem to be. Because we did not generate standard libraries for multiple architectures, the corresponding libraries can't be found during cross compiling. Updating ArchCpusAttrs.h is easy, but adding support for cross compiling requires much more effort. It seems that gccgo does not currently support cross compiling ? |
OK, Thank you! |
@erifan yes, there is almost certainly a lot of work to do to set up Gollvm as a cross compiler with respect to the libraries. The first step is getting the compiler to work properly however. Gccgo does support cross compilation, but not using the same model as vlang-- with gccgo you need a separate installation and compiler binary per target (as opposed to the clang model in which a single compiler binary supports multiple targets). |
Change https://golang.org/cl/269857 mentions this issue: |
Change https://golang.org/cl/270677 mentions this issue: |
Dear Sir,
I want to compile a program in the x86_64 environment, this program can run in the aarch64 environment, and I try " go build -o output -gccgoflags="--target=aarch64-linux"", but it cannot work.
The text was updated successfully, but these errors were encountered: