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.

Remove maximum path length limitation on Windows

See original GitHub issue

Description of the problem / feature request:

It will be nice to have a command line option to remove the maximum path length limitation on Windows. Windows has allowed to remove the path length limitation on Windows 10 Anniversary update. However, bazel still works with path length restriction. I am thinking of having a command line option --remove-path-length-limit which makes bazel to work without the limitation

Feature requests: what underlying problem are you trying to solve with this feature?

I am trying to build Tensorflow with --dynamic_mode=fully and get this error.

ERROR: file 'tensorflow/utils.dll' is generated by these conflicting actions:
Label: //tensorflow:libtensorflow_framework.so.2.2.0
RuleClass: cc_binary rule
Configuration: a2bfe99001a9a169e32dedfd9726eb6b74459ec5cb6bf69de2a3f0c887ba9f19
Mnemonic: Symlink
Action key: 61e799b1ac91eabec3c28dfd56b3272b5cb7609a10ef471329252741a303302f
Progress message: Copying Execution Dynamic Library
PrimaryInput: File:[[<execution_root>]bazel-out/x64_windows-opt/bin]tensorflow/core/grappler/clusters/utils.dll, File:[[<execution_root>]bazel-out/x64_windows-opt/bin]tensorflow/core/grappler/costs/utils.dll
PrimaryOutput: File:[[<execution_root>]bazel-out/x64_windows-opt/bin]tensorflow/utils.dll
ERROR: Analysis of target '//tensorflow/tools/pip_package:build_pip_package' failed; build aborted: for tensorflow/utils.dll, previous action: action
'Copying Execution Dynamic Library', attempted action: action 'Copying Execution Dynamic Library'

I think it is not an error with Tensorflow because --dynamic_mode=fully is running fine on Linux. I think this line causes the problem https://github.com/bazelbuild/bazel/blob/5f083b8f5a073a3427d575aa54eac5b779226708/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java#L1055 Since SymlinkAction can not create a symlink whose name is too long, it has to copy the file and causes the problem.

What operating system are you running Bazel on?

Windows 10

Have you found anything relevant by searching the web?

I found an issue which this feature could solve the problems.

https://github.com/bazelbuild/bazel/issues/8400 In fact, I think this is the main reason why building dll with bazel is not so easy

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

I think adding this feature could allow bazel to build dll on Windows easier.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
meteorcloudycommented, May 28, 2020

That sounds good!

1reaction
meteorcloudycommented, May 28, 2020

I would like to know how the hash will be calculated.

I think the hash should be at calculated based on RepositoryName + the package path the DLL belongs to. That should make the name unique and deterministic across the build.

Your solution is using a .lib file as an interface library and a .DEF file to actually point to the .dll. If I understand correctly, my work now is to rename the dll and add the name to a generated .DEF file. Please correct me if I am wrong

That’s exactly what I mean! So glad you figured that out yourself!

BTW, you can file another issue to track the progress if you want. 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to change the default 256 character path limitation ...
By default, Windows uses a path length limitation (MAX_PATH) of 256 characters: Naming Files, Paths, and Namespaces.
Read more >
Maximum Path Length Limitation - Win32 apps | Microsoft Learn
In the Windows API (with some exceptions discussed in the following paragraphs), the maximum length for a path is MAX_PATH, which is defined ......
Read more >
Microsoft removes 260 character limit for NTFS Path in new ...
The maximum length for a path (file name and its directory route) — also known as MAX_PATH — has been defined by 260...
Read more >
Windows Path Length Limit Reached - CS IT Support Wiki
To get around this limit, Windows allows you to make a change in the registry that will allow you to have a much...
Read more >
How to remove 260 characters limit of the Windows 10 NTFS ...
How to remove 260 characters limit of the Windows 10 NTFS paths? · 1. Hit the Windows key, type gpedit.msc and press Enter....
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