conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.09k stars 959 forks source link

[bug] exceeds the OS max path limit on windows #13842

Open kismetro opened 1 year ago

kismetro commented 1 year ago

Environment details

Steps to reproduce

  1. grpc 1.50.1 build on windows using vs2019
  2. conanfile.py
    def requirements(self):   
        self.requires("grpc/1.50.1")
  3. profile
    [settings]
    arch=x86_64
    build_type=Release
    compiler=msvc 
    compiler.version=192
    compiler.runtime=dynamic
    os=Windows
    [options]
    [conf]
    *:tools.build:cxxflags=["/MP"]
  4. conan install
    conan install . -r conancenter -pr ./vpsdev_x86_64_windows -pr:b ./vpsdev_x86_64_windows -s build_type=Release -b missing -of ./Release -vvv

my root path name length seems not to be long. however, it seems that conan cache folder causes long file name and path.

Logs

Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(382,5): error MSB3491: Could not write
 lines to file “cloud_kubernetes_security_containersecurity_logging_containersecurity_logging.dir\Release\cloud_ku.F6248728.tlog\cloud_kubernetes_security_c
ontainersecurity_logging_containersecurity_logging.lastbuildstate”. Path: cloud_kubernetes_security_containersecurity_logging_containersecurity_logging.dir\
Release\cloud_ku.F6248728.tlog\cloud_kubernetes_security_containersecurity_logging_containersecurity_logging.lastbuildstate exceeds the OS max path limit. T
he fully qualified file name must be less than 260 characters. [C:\Users\kismetro\.conan2\p\t\googlbaf5bd4a0314f\b\build\cloud_kubernetes_security_container
security_logging_containersecurity_logging.vcxproj]
memsharded commented 1 year ago

Hi @kismetro

the problem seems to be the filenames:

len("cloud_kubernetes_security_containersecurity_logging_containersecurity_logging.dir\Release\cloud_ku.F6248728.tlog\cloud_kubernetes_security_c ontainersecurity_logging_containersecurity_logging.lastbuildstate")
206

The Conan part in the cache is only taking 50 chars, if we include the user home folder, or 32 without it:

len("C:/Users/kismetro/.conan2/p/t/googlbaf5bd4a0314f/b")
50
len(".conan2/p/t/googlbaf5bd4a0314f/b")
32

It seems unfeasible to reduce that length, it is the minimum necessary to avoid path collisions. You could shorten a couple of characters by defining a shorter CONAN_HOME, but I don't think it is the best approach. Instead trying to shorten cloud_kubernetes_security_containersecurity_logging_containersecurity_logging with the repeated identifiers seems the way to go.

memsharded commented 1 year ago

Oh, I have just realized, this happens inside the grpc recipe :(

Need to check with the team, about what could be done with this recipe.

kismetro commented 1 year ago

yes, it caused by grpc recipe, 1.50.1. I don`t know that previous version also has same issues. But, this max can not be handled by user. So, It must be checked and fixed by grpc recipe side. Changing conan home is not a perfect solution in general.