question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Features to solve the problems with dll linking on Windows

See original GitHub issue

Description of the problem / feature request:

Solving the problems with dll on Windows. If a package is dependent on 2 different dlls with the same name but different path, Bazel throw an error because it has to copy 2 dlls into the binary folder which causes name clash. The solution is renaming the dll to name-hash.dll and use a .lib file as an interface library and a .DEF file to actually point to the name-hash.dll

What operating system are you running Bazel on?

Windows 10

Have you found anything relevant by searching the web?

https://github.com/bazelbuild/bazel/issues/11482

Any other information, logs, or outputs that you want to share?

With the guidance of @meteorcloudy , I will implement this feature This is the progress tracker of this issue

  • Add a build option to enable this features. --rename_dll
  • Change the dll name on Windows to name-hash.dll, where hash will be calculated based on RepositoryName + the package path the DLL belongs to.
  • Add the name to .DEF file by using LIBRARY name-hash
  • Testing and document

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
meteorcloudycommented, May 29, 2020

You think it is better to make a PR for each progress or only one PR at the end.

Yes, I think you can implement it in one PR. But I’m not sure we should change CcBinary, because the target is defined explicitly by users, so they probably expect the DLL name to just be <name>.dll on Windows. However, the DLL built by cc_library is implicit when other cc_binary depends on it and specifies linkstatic = 0.

Does bazel use some kinds of linting ( clang-format, … ) ? I have not seen anything in the contributing guide

The code will be formatted when we import it into Google, but I don’t think the tools are available outside.

1reaction
vnghiacommented, May 28, 2020

And which version of Bazel were you using? It’s better to use newer version of Bazel. Old version may not be able to build the latest master branch.

Sorry, I use the bazel 2.0 to build. I use bazelisk and it fix the problem. Thank you

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dynamic link library (DLL) - Windows Client | Microsoft Learn
This article describes what a dynamic link library (DLL) is and the various issues that may occur when you use DLLs.
Read more >
How to Fix DLL Not Found or Missing Errors - Lifewire
The only way to permanently fix DLL errors is by fixing the underlying cause of the issue, not by downloading DLL files. Here's...
Read more >
2022 Guide on How to fix all DLL Errors in Windows 10/11
In this video, we're going to show you how to fix dll issues with a few easy solutions that you can try in...
Read more >
How to fix Missing DLL files errors on Windows 11/10 PC
Fix Missing DLL files error · Run the built-in System File Checker tool to replace missing or corrupted operating system files · Run...
Read more >
What is dynamic link library (DLL)? - TechTarget
How do you fix DLL errors? ... DLL errors are common because of the volume of DLL files found on Microsoft Windows systems...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found