microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
22.18k stars 6.16k forks source link

[qt5-webengine] Build error on x86-windows #39351

Closed 3UR closed 2 weeks ago

3UR commented 2 weeks ago

Package: qt5-webengine:x86-windows@5.15.13#3

Host Environment

To Reproduce

vcpkg install

Failure logs

CMake Warning at scripts/cmake/vcpkg_buildpath_length_warning.cmake:4 (message):
  qt5-webengine's buildsystem uses very long paths and may fail on your
  system.

  We recommend moving vcpkg to a short path such as 'C:\src\vcpkg' or using
  the subst command.
Call Stack (most recent call first):
  C:/Users/User/AppData/Local/vcpkg/registries/git-trees/58ef6b79a9cfe23e3a196d3a38970c5c48b1a15b/portfile.cmake:4 (vcpkg_buildpath_length_warning)
  scripts/ports.cmake:175 (include)

CMake Warning at C:/Users/User/AppData/Local/vcpkg/registries/git-trees/58ef6b79a9cfe23e3a196d3a38970c5c48b1a15b/portfile.cmake:5 (message):
  The qt5-webengine source was will be extracted to
  X:/REDACTED/REDACTED/vcpkg_installed/x86-windows/vcpkg/blds/qt5-webengine
  , which has more then 35 characters in length.
Call Stack (most recent call first):
  scripts/ports.cmake:175 (include)

CMake Error at C:/Users/User/AppData/Local/vcpkg/registries/git-trees/58ef6b79a9cfe23e3a196d3a38970c5c48b1a15b/portfile.cmake:6 (message):
  terminating due to
  X:/REDACTED/REDACTED/vcpkg_installed/x86-windows/vcpkg/blds/qt5-webengine
  being too long.
Call Stack (most recent call first):
  scripts/ports.cmake:175 (include)

Additional context

vcpkg.json ``` { "dependencies": [ "qt5", "qt5-webengine" ] } ```
3UR commented 2 weeks ago

Is there any way to resolve this? I would rather not change my directories I assume there is some way to disable the length limit

3UR commented 2 weeks ago

image I have tried registry (Yes I did restart, and I sadly still am getting this issue)

dg0yt commented 2 weeks ago

@3UR The check exists because there is no other simple way.

3UR commented 2 weeks ago

@3UR The check exists because there is no other simple way.

Would there be any way around it if I have LongPathsEnabled enabled in registry?

WangWeiLin-MV commented 2 weeks ago

The installation path of vcpkg is too long. You can create a new vcpkg directory in the drive root directory, and then clone the code for compilation.

Or build with specify the option, for example, vcpkg install qt-webengine --x-buildtrees-root C:\v\bld

If attempting long path support, see https://github.com/microsoft/vcpkg/issues/32684#issuecomment-1653641584

dg0yt commented 2 weeks ago

Would there be any way around it if I have LongPathsEnabled enabled in registry?

Well, you "only" have to make all tools capable of using long paths.

Or build with specify the option, for example, vcpkg install qt-webengine --x-buildtrees-root C:\v\bld

This issue is about qt5-webengine (Qt 5). qt-webengine (Qt 6) might or might not benefit from the update of ninja, #39260. But all webengine ports are non-trivial and troublesome.

3UR commented 2 weeks ago

I manually went and edited the portfile.cmake and everything seems fine now

Would any issues really happen now though as LongPathsEnabled is True? I assume everything should be able to handle long paths fine now


if(buildtrees_path_length GREATER 35 AND CMAKE_HOST_WIN32)
    execute_process(
        COMMAND powershell -Command "Get-ItemPropertyValue -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\FileSystem' -Name 'LongPathsEnabled'"
        OUTPUT_VARIABLE LONG_PATHS_ENABLED
        OUTPUT_STRIP_TRAILING_WHITESPACE
    )

    if (LONG_PATHS_ENABLED STREQUAL "0")
        vcpkg_buildpath_length_warning(35)
        message(WARNING "The ${PORT} source was will be extracted to ${CURRENT_BUILDTREES_DIR} , which has more then 35 characters in length.")
        message(FATAL_ERROR "terminating due to ${CURRENT_BUILDTREES_DIR} being too long.")
    endif()
endif()
dg0yt commented 2 weeks ago

If the build succeeds, then it should be good. (When the build fails, it isn't obvious from the "file not found" errors that path length is the trigger.)

3UR commented 2 weeks ago

Ok I see now there is more to then just having LongPathsEnabled I guess I will have to change the directory for vcpkg

How would I do so? @WangWeiLin-MV @dg0yt I installed vcpkg through Visual Studio 2022 using vcpkg integrate install in the developer powershell

3UR commented 2 weeks ago

I have been considering maybe I will just use CEF or something instead of WebEngine because I currently am upgrading to QT 5 and I don't want to use QT Webkit anymore and it seems WebEngine is a pain

WangWeiLin-MV commented 2 weeks ago

@3UR In manifest mode, just try vcpkg install --x-buildtrees-root C:\v\bld with the C:\v\bld is any short path.

3UR commented 2 weeks ago

Thanks!

3UR commented 2 weeks ago

@WangWeiLin-MV Another question, do you know if I can also change the directory where Vcpkg downloads stuff (C:/Users/User/AppData/Local/vcpkg/downloads) or can I clear the files in this directory safely?

3UR commented 2 weeks ago

Sorry for lots of questions still new to using Vcpkg 😅

WangWeiLin-MV commented 2 weeks ago

change the directory where Vcpkg downloads

Yes. By command line option --downloads-root=\<path> or environment variable VCPKG_DOWNLOADS

or can I clear the files in this directory safely?

Yes. The vcpkg/download directory is just a local cache of downloaded files. And the vcpkg/download/tools directory may have some decompression tools. After deleting these, vcpkg will re-extract these when any port needed.

I'm thrilled I could assist you.

3UR commented 2 weeks ago

change the directory where Vcpkg downloads

Yes. By command line option --downloads-root= or environment variable VCPKG_DOWNLOADS

or can I clear the files in this directory safely?

Yes. The vcpkg/download directory is just a local cache of downloaded files. And the vcpkg/download/tools directory may have some decompression tools. After deleting these, vcpkg will re-extract these when any port needed.

I'm thrilled I could assist you.

Okay thanks I will close this now as it solved my issue :)

dg0yt commented 2 weeks ago

@3UR In manifest mode, just try vcpkg install --x-buildtrees-root C:\v\bld with the C:\v\bld is any short path.

With build system integration, don't call vcpkg install at the command line. It won't know the build system's binary dir and target. Use VCPKG_INSTALL_OPTIONS with CMake integration: https://learn.microsoft.com/en-us/vcpkg/users/buildsystems/cmake-integration#vcpkg_install_options
Use VcpkgAdditionalInstallOptions with msbuild integration: https://learn.microsoft.com/en-us/vcpkg/users/buildsystems/msbuild-integration#vcpkg-additional-install-options