Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenGL portfile assumes Windows SDK is installed in Program Files (x86) directory #5495

Closed
RobinKa opened this issue Mar 1, 2019 · 7 comments
Labels
category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`)

Comments

@RobinKa
Copy link

RobinKa commented Mar 1, 2019

https://github.com/Microsoft/vcpkg/blob/8641dfd9dd6d3bf190515822060872a56ee37906/ports/opengl/portfile.cmake#L8-L14

This does not always seem to be the case. For me the Windows SDK was installed in the root directory of a partition.

@LilyWangL LilyWangL added the requires:more-information This Issue requires more information to solve label Mar 4, 2019
@LilyWangL
Copy link
Contributor

Hi @RobinKa ,

Plz following these steps:

  1. Add these following code to the portfile.cmake file in vcpkg\ports\opengl directory:
    vcpkg_get_program_files_32_bit(PROGRAM_FILES_32_BIT)
    message("prog path: ${PROGRAM_FILES_32_BIT}")
  2. Using command ".\vcpkg.exe remove opengl" to remove opengl.
  3. Rebuild opengl.
  4. Provide output log.

Thanks,
Lily

@RobinKa
Copy link
Author

RobinKa commented Mar 4, 2019

Hello @wangli28 ,

Thanks for the response. Sorry if I was not clear enough. My program files path is found just fine. The issue is that the OpenGL portfile is looking within the program files folder for the Windows SDK, although Windows SDK does not have to be installed there (eg. for me it is F:\Windows Kits\). Instead of hardcoding the path to be in program files, the path should be determined by reading a value in the registry (see https://stackoverflow.com/a/35121768).

@PhoebeHui PhoebeHui added category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`) and removed requires:more-information This Issue requires more information to solve labels Jun 19, 2019
@am2222
Copy link
Contributor

am2222 commented Jul 28, 2019

Hi,
I have the same issue,

The following packages will be built and installed:
    libwebp[core]:x64-windows
  * opengl[core]:x64-windows
Additional packages (*) will be modified to complete this operation.
Starting package 1/2: opengl:x64-windows
Building package opengl[core]:x64-windows...
CMake Error at ports/opengl/portfile.cmake:20 (message):
  Cannot find Windows 10.0.18362.0 SDK.  File does not exist: C:\Program
  Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x64\OpenGL32.Lib
Call Stack (most recent call first):
  scripts/ports.cmake:74 (include)

my windows kit is installed in the following folder

D:\Windows Kits\10\Lib\10.0.18362.0\um\x64

Does anybody have any solutions?

@cwbhhjl
Copy link

cwbhhjl commented Aug 28, 2019

Hi,
I have the same issue,

The following packages will be built and installed:
    libwebp[core]:x64-windows
  * opengl[core]:x64-windows
Additional packages (*) will be modified to complete this operation.
Starting package 1/2: opengl:x64-windows
Building package opengl[core]:x64-windows...
CMake Error at ports/opengl/portfile.cmake:20 (message):
  Cannot find Windows 10.0.18362.0 SDK.  File does not exist: C:\Program
  Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x64\OpenGL32.Lib
Call Stack (most recent call first):
  scripts/ports.cmake:74 (include)

my windows kit is installed in the following folder

D:\Windows Kits\10\Lib\10.0.18362.0\um\x64

Does anybody have any solutions?

this bug still exists and my workaroud is to make a dir junction

@alefESE
Copy link

alefESE commented Sep 22, 2019

Change the file "vcpkg\ports\opengl\portfile.cmake":

    vcpkg_get_program_files_32_bit(PROGRAM_FILES_32_BIT)
    vcpkg_get_windows_sdk(WINDOWS_SDK)

    if (WINDOWS_SDK MATCHES "10.")
        set(LIBGLFILEPATH  "${PROGRAM_FILES_32_BIT}\\Windows Kits\\10\\Lib\\${WINDOWS_SDK}\\um\\${TRIPLET_SYSTEM_ARCH}\\OpenGL32.Lib")
        set(LIBGLUFILEPATH "${PROGRAM_FILES_32_BIT}\\Windows Kits\\10\\Lib\\${WINDOWS_SDK}\\um\\${TRIPLET_SYSTEM_ARCH}\\GlU32.Lib")
        set(HEADERSPATH    "${PROGRAM_FILES_32_BIT}\\Windows Kits\\10\\Include\\${WINDOWS_SDK}\\um")
    elseif(WINDOWS_SDK MATCHES "8.")
        set(LIBGLFILEPATH  "${PROGRAM_FILES_32_BIT}\\Windows Kits\\8.1\\Lib\\winv6.3\\um\\${TRIPLET_SYSTEM_ARCH}\\OpenGL32.Lib")
        set(LIBGLUFILEPATH "${PROGRAM_FILES_32_BIT}\\Windows Kits\\8.1\\Lib\\winv6.3\\um\\${TRIPLET_SYSTEM_ARCH}\\GlU32.Lib")
        set(HEADERSPATH    "${PROGRAM_FILES_32_BIT}\\Windows Kits\\8.1\\Include\\um")
    else()
        message(FATAL_ERROR "Portfile not yet configured for Windows SDK with version: ${WINDOWS_SDK}")
    endif()

like this:

    GET_FILENAME_COMPONENT(SDK_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]" ABSOLUTE CACHE)
    vcpkg_get_windows_sdk(WINDOWS_SDK)

    if (WINDOWS_SDK MATCHES "10.")
        set(LIBGLFILEPATH  "${SDK_PATH}\\Lib\\${WINDOWS_SDK}\\um\\${TRIPLET_SYSTEM_ARCH}\\OpenGL32.Lib")
        set(LIBGLUFILEPATH "${SDK_PATH}\\Lib\\${WINDOWS_SDK}\\um\\${TRIPLET_SYSTEM_ARCH}\\GlU32.Lib")
        set(HEADERSPATH    "${SDK_PATH}\\Include\\${WINDOWS_SDK}\\um")
    elseif(WINDOWS_SDK MATCHES "8.")
        set(LIBGLFILEPATH  "${SDK_PATH}\\Lib\\winv6.3\\um\\${TRIPLET_SYSTEM_ARCH}\\OpenGL32.Lib")
        set(LIBGLUFILEPATH "${SDK_PATH}\\Lib\\winv6.3\\um\\${TRIPLET_SYSTEM_ARCH}\\GlU32.Lib")
        set(HEADERSPATH    "${SDK_PATH}\\Include\\um")
    else()
        message(FATAL_ERROR "Portfile not yet configured for Windows SDK with version: ${WINDOWS_SDK}")
    endif()

Solve the problem for me.
So, seens the problem is the hardcoded sdk path in cmake file.
I found @AlessandroMenti's suggestion here: #8288

@Kirollos-Hanna
Copy link

Change the file "vcpkg\ports\opengl\portfile.cmake":

    vcpkg_get_program_files_32_bit(PROGRAM_FILES_32_BIT)
    vcpkg_get_windows_sdk(WINDOWS_SDK)

    if (WINDOWS_SDK MATCHES "10.")
        set(LIBGLFILEPATH  "${PROGRAM_FILES_32_BIT}\\Windows Kits\\10\\Lib\\${WINDOWS_SDK}\\um\\${TRIPLET_SYSTEM_ARCH}\\OpenGL32.Lib")
        set(LIBGLUFILEPATH "${PROGRAM_FILES_32_BIT}\\Windows Kits\\10\\Lib\\${WINDOWS_SDK}\\um\\${TRIPLET_SYSTEM_ARCH}\\GlU32.Lib")
        set(HEADERSPATH    "${PROGRAM_FILES_32_BIT}\\Windows Kits\\10\\Include\\${WINDOWS_SDK}\\um")
    elseif(WINDOWS_SDK MATCHES "8.")
        set(LIBGLFILEPATH  "${PROGRAM_FILES_32_BIT}\\Windows Kits\\8.1\\Lib\\winv6.3\\um\\${TRIPLET_SYSTEM_ARCH}\\OpenGL32.Lib")
        set(LIBGLUFILEPATH "${PROGRAM_FILES_32_BIT}\\Windows Kits\\8.1\\Lib\\winv6.3\\um\\${TRIPLET_SYSTEM_ARCH}\\GlU32.Lib")
        set(HEADERSPATH    "${PROGRAM_FILES_32_BIT}\\Windows Kits\\8.1\\Include\\um")
    else()
        message(FATAL_ERROR "Portfile not yet configured for Windows SDK with version: ${WINDOWS_SDK}")
    endif()

like this:

    GET_FILENAME_COMPONENT(SDK_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]" ABSOLUTE CACHE)
    vcpkg_get_windows_sdk(WINDOWS_SDK)

    if (WINDOWS_SDK MATCHES "10.")
        set(LIBGLFILEPATH  "${SDK_PATH}\\Lib\\${WINDOWS_SDK}\\um\\${TRIPLET_SYSTEM_ARCH}\\OpenGL32.Lib")
        set(LIBGLUFILEPATH "${SDK_PATH}\\Lib\\${WINDOWS_SDK}\\um\\${TRIPLET_SYSTEM_ARCH}\\GlU32.Lib")
        set(HEADERSPATH    "${SDK_PATH}\\Include\\${WINDOWS_SDK}\\um")
    elseif(WINDOWS_SDK MATCHES "8.")
        set(LIBGLFILEPATH  "${SDK_PATH}\\Lib\\winv6.3\\um\\${TRIPLET_SYSTEM_ARCH}\\OpenGL32.Lib")
        set(LIBGLUFILEPATH "${SDK_PATH}\\Lib\\winv6.3\\um\\${TRIPLET_SYSTEM_ARCH}\\GlU32.Lib")
        set(HEADERSPATH    "${SDK_PATH}\\Include\\um")
    else()
        message(FATAL_ERROR "Portfile not yet configured for Windows SDK with version: ${WINDOWS_SDK}")
    endif()

Solve the problem for me.
So, seens the problem is the hardcoded sdk path in cmake file.
I found @AlessandroMenti's suggestion here: #8288

This solved it for me, too.

@PhoebeHui
Copy link
Contributor

Duplicated to #8288

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`)
Projects
None yet
Development

No branches or pull requests

7 participants