Skip to content
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

Compiling with Bazel is broken on Windows #781

Closed
tomrenn opened this issue May 10, 2024 · 10 comments
Closed

Compiling with Bazel is broken on Windows #781

tomrenn opened this issue May 10, 2024 · 10 comments
Assignees

Comments

@tomrenn
Copy link

tomrenn commented May 10, 2024

Upgrading to the latest version I hit a few issues

  1. Bazel incorrectly treats a ui/build file as a Bazel BUILD file, leading to the directory being treated as a bazel package.
  2. Errors related with Python tables similar to Standalone Bazel build broken after switch to Python tables #772
  3. Sqlite compile failures

I have fixes for 1 and 2, and can send fixes for them. However 3 is leaving me a bit stumped.

ERROR: C:/users/tomrenn/github/perfetto/BUILD:5849:20: Compiling src/trace_processor/perfetto_sql/engine/table_pointer_module.cc failed: (Exit 2): cl.exe failed: error executing CppCompile command (from target //:trace_processor)
  cd /d C:/users/tomrenn/_bazel_tomrenn/qb4g6q55/execroot/_main
  SET INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\include;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared;C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\winrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\cppwinrt
    SET PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\bin\Roslyn;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\;C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\\MSBuild\Current\Bin;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\;;C:\Windows\system32
    SET PWD=/proc/self/cwd
    SET RUNFILES_MANIFEST_ONLY=1
    SET TEMP=C:\Users\tomrenn\AppData\Local\Temp
    SET TMP=C:\Users\tomrenn\AppData\Local\Temp
    SET VSLANG=1033
  C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\cl.exe @bazel-out/x64_windows-fastbuild/bin/_objs/trace_processor/table_pointer_module.obj.params
# Configuration: bb5b32ed7c91aae0c32909bdd12dc84476bc03a844b6fe3df14185e091739e86
# Execution platform: @@local_config_platform//:host
C:\users\tomrenn\_bazel_tomrenn\qb4g6q55\execroot\_main\src/trace_processor/sqlite/bindings/sqlite_module.h(58): error C2039: 'BestIndex': is not a member of 'perfetto::trace_processor::TablePointerModule'
C:\users\tomrenn\_bazel_tomrenn\qb4g6q55\execroot\_main\src/trace_processor/perfetto_sql/engine/table_pointer_module.h(58): note: see declaration of 'perfetto::trace_processor::TablePointerModule'
C:\users\tomrenn\_bazel_tomrenn\qb4g6q55\execroot\_main\src/trace_processor/perfetto_sql/engine/table_pointer_module.h(58): note: see reference to class template instantiation 'perfetto::trace_processor::sqlite::Module<perfetto::trace_processor::TablePointerModule>' being compiled
C:\users\tomrenn\_bazel_tomrenn\qb4g6q55\execroot\_main\src/trace_processor/sqlite/bindings/sqlite_module.h(58): error C2065: 'BestIndex': undeclared identifier
C:\users\tomrenn\_bazel_tomrenn\qb4g6q55\execroot\_main\src/trace_processor/sqlite/bindings/sqlite_module.h(59): error C2039: 'Open': is not a member of 'perfetto::trace_processor::TablePointerModule'
C:\users\tomrenn\_bazel_tomrenn\qb4g6q55\execroot\_main\src/trace_processor/perfetto_sql/engine/table_pointer_module.h(58): note: see declaration of 'perfetto::trace_processor::TablePointerModule'
C:\users\tomrenn\_bazel_tomrenn\qb4g6q55\execroot\_main\src/trace_processor/sqlite/bindings/sqlite_module.h(59): error C2065: 'Open': undeclared identifier
C:\users\tomrenn\_bazel_tomrenn\qb4g6q55\execroot\_main\src/trace_processor/sqlite/bindings/sqlite_module.h(60): error C2039: 'Close': is not a member of 'perfetto::trace_processor::TablePointerModule'
C:\users\tomrenn\_bazel_tomrenn\qb4g6q55\execroot\_main\src/trace_processor/perfetto_sql/engine/table_pointer_module.h(58): note: see declaration of 'perfetto::trace_processor::TablePointerModule'
C:\users\tomrenn\_bazel_tomrenn\qb4g6q55\execroot\_main\src/trace_processor/sqlite/bindings/sqlite_module.h(60): error C2065: 'Close': undeclared identifier
C:\users\tomrenn\_bazel_tomrenn\qb4g6q55\execroot\_main\src/trace_processor/sqlite/bindings/sqlite_module.h(61): error C2039: 'Filter': is not a member of 'perfetto::trace_processor::TablePointerModule'
@LalitMaganti
Copy link
Collaborator

Thanks for filing! https://r.android.com/3081311 should fix issue 3. If you could send fixes for 1 and 2, that would be very much appreciated!

@tomrenn
Copy link
Author

tomrenn commented May 10, 2024

Thank you for such a quick fix!

  1. https://android-review.git.corp.google.com/c/platform/external/perfetto/+/3079270
    • I need some guidance on how to modify/add BUILD files, since I'm unfamiliar with how they are supposed to be generated.
  2. https://android-review.git.corp.google.com/c/platform/external/perfetto/+/3083587

@LalitMaganti
Copy link
Collaborator

I need some guidance on how to modify/add BUILD files, since I'm unfamiliar with how they are supposed to be generated.

I've commented on the change.

primiano pushed a commit that referenced this issue May 10, 2024
Calling rfind() needed to use os.sep as the path separator. The input arguments use forward slashes, probably because this is executed as a genrule in bash even on Windows, so this uses '/' instead of os.sep.

Bug: #781
Change-Id: Id890b6aab6236b5d6addf317995c75394faab00e
primiano pushed a commit that referenced this issue May 10, 2024
Otherwise Bazel will recongize ui/build as a BUILD file on case-insensitive filesystems (e.g., Windows).

Bug: #781
Change-Id: I3fdd7953d789412848ac28dc44b95238ed7b5a43
primiano pushed a commit that referenced this issue May 13, 2024
This CL fixes the broken compile of trace processor on MSBC because it
more eagerly expands CRTP templates than Clang or GCC.

Bug: #781
Change-Id: I58bb4b4b6793e3b3914ad23245b6e9dcca69b22f
@tomrenn
Copy link
Author

tomrenn commented May 13, 2024

At change 8ff5262 everything is now building on Windows :)

@tomrenn tomrenn closed this as completed May 13, 2024
@tomrenn
Copy link
Author

tomrenn commented May 17, 2024

Reopening, since there was a revert (0a0f29f). Is it possible to rename ui/build to something else, to avoid Bazel on Windows from thinking it is a Bazel package (BUILD)?

@tomrenn tomrenn reopened this May 17, 2024
@LalitMaganti
Copy link
Collaborator

Can you reach out to @stevegolton internally to discuss?

@primiano
Copy link
Collaborator

primiano commented May 20, 2024

Can we just add /ui in $root/.bazelignore (feel free to send a CL for it) ?

Can I ask what are you trying to do? Specifically why do you need bazel on windows and can't use GN instead?

My only fear is that we keep piling up combinations of build system and platforms. We can't commit to maintain anything else other than GN, which is our primary build sytem (and Android.bp for android). The rest is all best effort, which means somtimes it will break without us realizing and you'll have to figure out.

@tomrenn
Copy link
Author

tomrenn commented May 20, 2024

Adding a .bazelignore would be a great solution, I forget that exists.

Our project (Android Studio) builds with Bazel and its build graph depends on perfetto dependencies, so we cannot use GN without significant changes on our end.

@primiano
Copy link
Collaborator

Ah gotcha. Yeah send a patch with .bazelignore, feels like it should make the problem go away easily

@LalitMaganti
Copy link
Collaborator

This was done in aosp/3092494

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants