Buildsystem bug that's trivial to fix

30 views
Skip to first unread message

Naville Zhang

unread,
Jul 9, 2024, 2:28:09 AMJul 9
to android-llvm

```
'--target={self.llvm_triple}',
```

this misses the string format prefix f, which in-turn make the string got intepreted literally and thus self.llvm_triple is not expanded.

Also MSVCConfig misses instance attribute is_cross_compiling

Pirama Arumuga Nainar

unread,
Jul 17, 2024, 8:05:05 PMJul 17
to Naville Zhang, android-llvm
Thanks for reporting this.  We didn't notice it because this configuration is not built in CI or in development.  r.android.com/3181480 has a fix.

--
You received this message because you are subscribed to the Google Groups "android-llvm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-llvm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-llvm/c0a2483c-ab4c-4c7a-ae64-279c0771f3d6n%40googlegroups.com.

Naville Zhang

unread,
Jul 24, 2024, 6:36:36 AMJul 24
to android-llvm
Some extra bugs we had:

# MSVCConfig related
Other than the ones you've already fixed:
- depot_tools produces invalid path when packing WinSDK on a Windows Host, providing invalid SetEnv.json and requires manual intervention
- win_sdk expects WinSDK_DIR/Windows Kit/10 passed-in as winsdk dir, but SetEnv.json expects WinSDK_DIR
- -fms-compatibility-version is wayyyy below what modern LLVM requires
- CMAKE_AR CMAKE_RC_COMPILER CMAKE_ASM_MASM_COMPILER should be set
- CMAKE_ASM_MASM_FLAGS_INIT should be set to -m64 to enable llvm-ml in 64bit mode, otherwise building asm fails


# do_build related
- remove_static_libraries only handles .a, while static libraries on Windows are .lib
- verify_file_exists fails when building with MSVCConfig, due to gnu-variant of clang runtimes are not built

# Darwin extra
CMAKE_IGNORE_PREFIX_PATH and family should be set to avoid accidentally pick up host libraries


Please let me know if these are helpful and NDK team has plan of fixing. We had to internally maintain a 800LoC of python hooks for things to work.

Zhang





Naville Zhang

unread,
Jul 24, 2024, 6:38:42 AMJul 24
to android-llvm
The reason we had to use MSVCConfig is due to https://github.com/msys2/MINGW-packages/issues/9289 , I assume other downstream developers might encounter the same issue

在2024年7月18日星期四 UTC+8 08:05:05<Pirama Arumuga Nainar> 写道:

Pirama Arumuga Nainar

unread,
Jul 25, 2024, 1:33:44 AMJul 25
to Naville Zhang, android-llvm
On Wed, Jul 24, 2024 at 3:38 AM Naville Zhang <navillez...@gmail.com> wrote:
The reason we had to use MSVCConfig is due to https://github.com/msys2/MINGW-packages/issues/9289 , I assume other downstream developers might encounter the same issue

Can you expand on this?  The above issue is related to exceptions, while LLVM doesn't use exceptions.  Are you building tools for Windows that run during the NDK build process?

It is good to know that you are using the MSVC build configs - so we don't accidentally delete it as unused.  But, unfortunately, we are unable to investigate issues related to MSVCConfig.  If you upload patches to AOSP, we'll review and accept reasonable patches.

# Darwin extra
CMAKE_IGNORE_PREFIX_PATH and family should be set to avoid accidentally pick up host libraries
 
Can you describe a situation where this happens?  IIUC, llvm-project should have CMake options to disable detection of libraries that we don't want to depend on (example: LLVM_ENABLE_ZLIB)

在2024年7月18日星期四 UTC+8 08:05:05<Pirama Arumuga Nainar> 写道:
Thanks for reporting this.  We didn't notice it because this configuration is not built in CI or in development.  r.android.com/3181480 has a fix.

On Mon, Jul 8, 2024 at 11:28 PM Naville Zhang <navillez...@gmail.com> wrote:

```
'--target={self.llvm_triple}',
```

this misses the string format prefix f, which in-turn make the string got intepreted literally and thus self.llvm_triple is not expanded.

Also MSVCConfig misses instance attribute is_cross_compiling

--
You received this message because you are subscribed to the Google Groups "android-llvm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-llvm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-llvm/c0a2483c-ab4c-4c7a-ae64-279c0771f3d6n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "android-llvm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-llvm...@googlegroups.com.

Naville Zhang

unread,
Jul 25, 2024, 2:37:26 AMJul 25
to android-llvm
Hi:

Our use-case is basically building ndk-llvm for our downstream usage, with backported patches from llvm-upstream applied and custom LLVM passes, custom LLVM tools, etc etc.

- MSVCConfig is mostly because we build a Z3 enabled (LLVM_ENABLE_Z3), which requires EH to work, and MinGW's EH is broken, as linked previously.
- CMAKE_IGNORE_PREFIX_PATH could prevent cases like for example, host system has another libxml2.dylib installed through means like homebrew / macports. These are usually not universal2(fat macho) and breaks linking

w.r.t. the upload patches part. I'm super unsure with how the AOSP contribution system works. Would it be possible if I email you our wrapper script as a whole and let you decide which fixes could be upstreamed and continue with the process? I think Google rejects external emails otherwise

Naville Zhang

unread,
Jul 25, 2024, 2:40:38 AMJul 25
to android-llvm
meanwhile, I also sent another thread of Darwin-specific bugs, titled "Darwin Buildsystem Bug" on 2024.04.18.
Here is the link in case you missed it: https://groups.google.com/g/android-llvm/c/pViMANcu-xQ

Zhang

在2024年7月25日星期四 UTC+8 13:33:44<Pirama Arumuga Nainar> 写道:
Reply all
Reply to author
Forward
0 new messages