lancethepants added a comment.

In D93164#3048130 <https://reviews.llvm.org/D93164#3048130>, @lancethepants 
wrote:
> In D93164#2653067 <https://reviews.llvm.org/D93164#2653067>, @mgorny wrote:
>
>> This change breaks cross-compilation now, as it tries running an executable 
>> built for the target system:
>>
>>   FAILED: tools/clang/lib/Tooling/ASTNodeAPI.json 
>>   cd /home/mgorny/llvm-project/build.arm64/tools/clang/lib/Tooling && 
>> /home/mgorny/llvm-project/build.arm64/bin/clang-ast-dump --skip-processing=0 
>> --astheader=/home/mgorny/llvm-project/build.arm64/tools/clang/lib/Tooling/ASTTU.cpp
>>  -I /home/mgorny/llvm-project/build.arm64/lib/clang/13.0.0/include -I 
>> /home/mgorny/llvm-project/llvm/../clang/include -I 
>> /home/mgorny/llvm-project/build.arm64/tools/clang/include -I 
>> /home/mgorny/llvm-project/build.arm64/include -I 
>> /home/mgorny/llvm-project/llvm/include -I /sysroot/arm64/usr/include/c++/v1 
>> -I /usr/lib/clang/11.0.1/include -I /sysroot/arm64/usr/include 
>> --json-output-path 
>> /home/mgorny/llvm-project/build.arm64/tools/clang/lib/Tooling/ASTNodeAPI.json
>>   /bin/sh: /home/mgorny/llvm-project/build.arm64/bin/clang-ast-dump: Exec 
>> format error
>>
>> I guess you can look at TableGens how to correctly generate and use host 
>> executables.
>
> I am now running into this error now that clang13 has released.  I cannot 
> figure a way around this. I do not see any cmake options similar to the 
> tablegens that allow you to specify the binary for the build system.  Am I 
> missing something or is clang13 just broken for cross compilation?



In D93164#3250945 <https://reviews.llvm.org/D93164#3250945>, @andrew-wja wrote:

> In D93164#3048130 <https://reviews.llvm.org/D93164#3048130>, @lancethepants 
> wrote:
>
>> In D93164#2653067 <https://reviews.llvm.org/D93164#2653067>, @mgorny wrote:
>>
>>> This change breaks cross-compilation now, as it tries running an executable 
>>> built for the target system:
>>>
>>>   FAILED: tools/clang/lib/Tooling/ASTNodeAPI.json 
>>>   cd /home/mgorny/llvm-project/build.arm64/tools/clang/lib/Tooling && 
>>> /home/mgorny/llvm-project/build.arm64/bin/clang-ast-dump 
>>> --skip-processing=0 
>>> --astheader=/home/mgorny/llvm-project/build.arm64/tools/clang/lib/Tooling/ASTTU.cpp
>>>  -I /home/mgorny/llvm-project/build.arm64/lib/clang/13.0.0/include -I 
>>> /home/mgorny/llvm-project/llvm/../clang/include -I 
>>> /home/mgorny/llvm-project/build.arm64/tools/clang/include -I 
>>> /home/mgorny/llvm-project/build.arm64/include -I 
>>> /home/mgorny/llvm-project/llvm/include -I /sysroot/arm64/usr/include/c++/v1 
>>> -I /usr/lib/clang/11.0.1/include -I /sysroot/arm64/usr/include 
>>> --json-output-path 
>>> /home/mgorny/llvm-project/build.arm64/tools/clang/lib/Tooling/ASTNodeAPI.json
>>>   /bin/sh: /home/mgorny/llvm-project/build.arm64/bin/clang-ast-dump: Exec 
>>> format error
>>>
>>> I guess you can look at TableGens how to correctly generate and use host 
>>> executables.
>>
>> I am now running into this error now that clang13 has released.  I cannot 
>> figure a way around this. I do not see any cmake options similar to the 
>> tablegens that allow you to specify the binary for the build system.  Am I 
>> missing something or is clang13 just broken for cross compilation?
>
> Another confirmation that this change has broken cross compilation. I have 
> tried setting both `-DCLANG_TOOLING_BUILD_AST_INTROSPECTION=OFF` and 
> `-DCMAKE_CROSSCOMPILING=ON` separately and in combination. This means that 
> LLVM cannot be cross compiled for AArch64, which is a pretty serious problem!



In D93164#3250945 <https://reviews.llvm.org/D93164#3250945>, @andrew-wja wrote:

> In D93164#3048130 <https://reviews.llvm.org/D93164#3048130>, @lancethepants 
> wrote:
>
>> In D93164#2653067 <https://reviews.llvm.org/D93164#2653067>, @mgorny wrote:
>>
>>> This change breaks cross-compilation now, as it tries running an executable 
>>> built for the target system:
>>>
>>>   FAILED: tools/clang/lib/Tooling/ASTNodeAPI.json 
>>>   cd /home/mgorny/llvm-project/build.arm64/tools/clang/lib/Tooling && 
>>> /home/mgorny/llvm-project/build.arm64/bin/clang-ast-dump 
>>> --skip-processing=0 
>>> --astheader=/home/mgorny/llvm-project/build.arm64/tools/clang/lib/Tooling/ASTTU.cpp
>>>  -I /home/mgorny/llvm-project/build.arm64/lib/clang/13.0.0/include -I 
>>> /home/mgorny/llvm-project/llvm/../clang/include -I 
>>> /home/mgorny/llvm-project/build.arm64/tools/clang/include -I 
>>> /home/mgorny/llvm-project/build.arm64/include -I 
>>> /home/mgorny/llvm-project/llvm/include -I /sysroot/arm64/usr/include/c++/v1 
>>> -I /usr/lib/clang/11.0.1/include -I /sysroot/arm64/usr/include 
>>> --json-output-path 
>>> /home/mgorny/llvm-project/build.arm64/tools/clang/lib/Tooling/ASTNodeAPI.json
>>>   /bin/sh: /home/mgorny/llvm-project/build.arm64/bin/clang-ast-dump: Exec 
>>> format error
>>>
>>> I guess you can look at TableGens how to correctly generate and use host 
>>> executables.
>>
>> I am now running into this error now that clang13 has released.  I cannot 
>> figure a way around this. I do not see any cmake options similar to the 
>> tablegens that allow you to specify the binary for the build system.  Am I 
>> missing something or is clang13 just broken for cross compilation?
>
> Another confirmation that this change has broken cross compilation. I have 
> tried setting both `-DCLANG_TOOLING_BUILD_AST_INTROSPECTION=OFF` and 
> `-DCMAKE_CROSSCOMPILING=ON` separately and in combination. This means that 
> LLVM cannot be cross compiled for AArch64, which is a pretty serious problem!

So I did find a solution. Maybe somewhere else in the forums or on irc.

-DCMAKE_SYSTEM_NAME="Linux"
Add this is well to your cmake invocation. For some reason this triggers in 
cmake that we are cross-compiling. Why -DCMAKE_CROSSCOMPILING=ON is 
insufficient I have no idea why. I'm compiling on linux for linux, didn't think 
I'd needed it.  Kind of unintuitive, but that should hopefully get you going.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93164/new/

https://reviews.llvm.org/D93164

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to