Skip to content

base:synchronization and base:threading don't link on windows bazel #3615

Closed as not planned

Description

@GMNGeoffrey

Linking these rules fails with unresolved symbols

ERROR: C:/windows/system32/iree/iree/base/BUILD:493:8: Linking of rule '//iree/base:threading_benchmark' failed (Exit 1120)
synchronization.lib(synchronization.obj) : error LNK2019: unresolved external symbol WaitOnAddress referenced in function iree_futex_wait
synchronization.lib(synchronization.obj) : error LNK2019: unresolved external symbol WakeByAddressSingle referenced in function iree_futex_wake
synchronization.lib(synchronization.obj) : error LNK2019: unresolved external symbol WakeByAddressAll referenced in function iree_futex_wake
bazel-out\x64_windows-opt\bin\iree\base\threading_benchmark.exe : fatal error LNK1120: 3 unresolved externals

Activity

  1. added
    platform/windows 🚪
    on Oct 27, 2020
  2. changed the title [-]base:synchronization and bas:threading don't link on windows bazel[/-] [+]base:synchronization and base:threading don't link on windows bazel[/+] on Oct 27, 2020
  3. ScottTodd commented on Oct 27, 2020

    @ScottTodd
    Member

    Renaming our synchronization cc_library isn't sufficient to fix this.

    Following this suggestion from a failing bazel build:

    Use --verbose_failures to see the command lines of failed build steps.

    The logs include

    C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.25.28610/bin/HostX64/x64/link.exe @bazel-out/x64_windows-opt/bin/iree/base/threading_benchmark.exe-2.params
    
    Click to expand `.params` file

    /nologo
    /OUT:bazel-out/x64_windows-opt/bin/iree/base/threading_benchmark.exe
    bazel-out/x64_windows-opt/bin/iree/base/_objs/threading_benchmark/threading_benchmark.obj
    bazel-out/x64_windows-opt/bin/iree/base/threading.lib
    bazel-out/x64_windows-opt/bin/iree/base/synchronization1.lib
    bazel-out/x64_windows-opt/bin/iree/base/api.lib
    bazel-out/x64_windows-opt/bin/iree/testing/benchmark_main.lib
    bazel-out/x64_windows-opt/bin/iree/base/init.lib
    bazel-out/x64_windows-opt/bin/iree/base/initializer.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/flags/parse.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/flags/usage.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/flags/usage_internal.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/flags/flag.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/flags/flag_internal.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/flags/registry.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/flags/config.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/flags/program_name.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/flags/marshalling.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/strings/str_format_internal.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/types/bad_optional_access.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/synchronization/synchronization.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/synchronization/graphcycles_internal.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/debugging/stacktrace.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/debugging/symbolize.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/debugging/debugging_internal.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/debugging/demangle_internal.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/base/malloc_internal.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/time/time.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/strings/strings.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/strings/internal.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/base/base.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/base/dynamic_annotations.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/base/spinlock_wait.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/base/throw_delegate.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/base/raw_logging_internal.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/base/log_severity.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/numeric/int128.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/time/internal/cctz/time_zone.lib
    bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/time/internal/cctz/civil_time.lib
    bazel-out/x64_windows-opt/bin/external/com_google_benchmark/benchmark.lib
    /SUBSYSTEM:CONSOLE
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -DEFAULTLIB:dbghelp.lib
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -DEFAULTLIB:advapi32.lib
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -ignore:4221
    -DEFAULTLIB:shlwapi.lib
    /IGNORE:4217
    /IGNORE:4001
    /MACHINE:X64
    /DEFAULTLIB:msvcrt.lib
    /OPT:ICF
    /OPT:REF
    

    So we're even including absl/synchronization/synchronization.lib, defined here: https://github.com/abseil/abseil-cpp/blob/5bf048b8425cc0a342e4647932de19e25ffd6ad7/absl/synchronization/BUILD.bazel#L68-L110

    The binaries in absl which include that library do work even from IREE (with our WORKSPACE included, .bazelrc settings, etc.):

    λ bazel test @com_google_absl//absl/synchronization:lifetime_test
    ...
    INFO: Build completed successfully, 7 total actions
    @com_google_absl//absl/synchronization:lifetime_test                     PASSED in 0.1s
    
  4. benvanik commented on Oct 27, 2020

    @benvanik
    Collaborator

    ah that's different - unless bazel-out/x64_windows-opt/bin/external/com_google_absl/absl/synchronization/ is on the LIBPATH (which it shouldn't be) it won't conflict. That file gets pulled in from flags stuff and is unrelated.

  5. benvanik commented on Nov 18, 2020

    @benvanik
    Collaborator

    I'll try changing the #pragma comment(lib) to be more specific so we can ensure it's getting added. Threading needs this library so there's no way we can keep nowindows'ing it. Worst case we can /defaultlib it (no harm).

  6. ScottTodd commented on Nov 18, 2020

    @ScottTodd
    Member

    I'll try changing the #pragma comment(lib) to be more specific so we can ensure it's getting added. Threading needs this library so there's no way we can keep nowindows'ing it. Worst case we can /defaultlib it (no harm).

    It was just the tests that failed to link, the libraries and other binaries using them were fine.

  7. 14 remaining items

  8. added a commit that references this issue on Dec 2, 2020
  9. added a commit that references this issue on Dec 2, 2020
  10. added a commit that references this issue on Dec 2, 2020
  11. ScottTodd commented on Mar 25, 2021

    @ScottTodd
    Member

    x_X still seeing this (just tried to build //bindings/tflite:smoke_teston Windows using Bazel)

  12. added
    bug 🐞
    on Mar 25, 2021
  13. ScottTodd commented on Apr 1, 2021

    @ScottTodd
    Member

    I found the linkopts = ["-DEFAULTLIB:advapi32.lib"] style syntax for Bazel, but that didn't work with Synchronization.lib/synchronization.lib (and I don't see any other projects doing that).

  14. added
    infrastructure
    on May 11, 2021
  15. benvanik commented on Jul 1, 2022

    @benvanik
    Collaborator

    Closing as bazel 🤷.

  16. moved this to Done in IREEon Jul 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug 🐞infrastructureplatform/windows 🚪

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions