xinntao / Real-ESRGAN-ncnn-vulkan

NCNN implementation of Real-ESRGAN. Real-ESRGAN aims at developing Practical Algorithms for General Image Restoration.
https://github.com/xinntao/Real-ESRGAN
Other
1.51k stars 186 forks source link

CMake errors with GLSLANG #22

Open magicse opened 2 years ago

magicse commented 2 years ago

I think GLSLANG made something changes in their cmake files. I get next errors from your Cmakelists.txt with CMAKE

Found glslangValidator: Z:/AI_SDK/CPP_GFPGAN/Real-ESRGAN-ncnn-vulkan/vulkan/Vulkan_SDK/Bin/glslangValidator.exe
Using glslang install located at Z:/AI_SDK/CPP_GFPGAN/Real-ESRGAN-ncnn-vulkan/vulkan/glslang-master-tot/Build/install/lib/cmake
CMake Warning at Z:/AI_SDK/CPP_GFPGAN/Real-ESRGAN-ncnn-vulkan/vulkan/glslang-master-tot/Build/install/lib/cmake/OSDependentTargets.cmake:2 (message):
  Using `OSDependentTargets.cmake` is deprecated: use `find_package(glslang)`
  to find glslang CMake targets.
Call Stack (most recent call first):
  CMakeLists.txt:110 (include)

CMake Warning at Z:/AI_SDK/CPP_GFPGAN/Real-ESRGAN-ncnn-vulkan/vulkan/glslang-master-tot/Build/install/lib/cmake/OGLCompilerTargets.cmake:2 (message):
  Using `OGLCompilerTargets.cmake` is deprecated: use `find_package(glslang)`
  to find glslang CMake targets.
Call Stack (most recent call first):
  CMakeLists.txt:111 (include)

CMake Warning at Z:/AI_SDK/CPP_GFPGAN/Real-ESRGAN-ncnn-vulkan/vulkan/glslang-master-tot/Build/install/lib/cmake/HLSLTargets.cmake:2 (message):
  Using `HLSLTargets.cmake` is deprecated: use `find_package(glslang)` to
  find glslang CMake targets.
Call Stack (most recent call first):
  CMakeLists.txt:114 (include)

CMake Warning at Z:/AI_SDK/CPP_GFPGAN/Real-ESRGAN-ncnn-vulkan/vulkan/glslang-master-tot/Build/install/lib/cmake/glslangTargets.cmake:2 (message):
  Using `glslangTargets.cmake` is deprecated: use `find_package(glslang)` to
  find glslang CMake targets.
Call Stack (most recent call first):
  CMakeLists.txt:116 (include)

CMake Warning at Z:/AI_SDK/CPP_GFPGAN/Real-ESRGAN-ncnn-vulkan/vulkan/glslang-master-tot/Build/install/lib/cmake/SPIRVTargets.cmake:2 (message):
  Using `SPIRVTargets.cmake` is deprecated: use `find_package(glslang)` to
  find glslang CMake targets.
Call Stack (most recent call first):
  CMakeLists.txt:117 (include)

CMake Error at CMakeLists.txt:245 (message):
  The submodules were not downloaded! Please update submodules with "git
  submodule update --init --recursive" and try again.

Configuring incomplete, errors occurred!
magicse commented 2 years ago

Structure of GLSLANG installation folder

| install folder
|
+---lib
|   |   libOSDependentd.a
|   |   libglslangd.a
|   |   libMachineIndependentd.a
|   |   libGenericCodeGend.a
|   |   libOGLCompilerd.a
|   |   libglslang-default-resource-limitsd.a
|   |   libSPVRemapperd.a
|   |   libSPIRVd.a
|   |   libHLSLd.a
|   |
|   +---cmake
|   |   OSDependentTargets.cmake
|   |   glslangTargets.cmake
|   |   OGLCompilerTargets.cmake
|   |   glslangValidatorTargets.cmake
|   |   spirv-remapTargets.cmake
|   |   glslang-default-resource-limitsTargets.cmake
|   |   SPVRemapperTargets.cmake
|   |   SPIRVTargets.cmake
|   |   HLSLTargets.cmake
|   |
|   \---glslang
|   glslang-targets.cmake
|   glslang-targets-debug.cmake
|   glslang-config.cmake
|   glslang-config-version.cmake
|
+---include
|   \---glslang
|   |   build_info.h
|   |
|   +---Public
|   |   ShaderLang.h
|   |
|   +---Include
|   |   arrays.h
|   |   BaseTypes.h
|   |   Common.h
|   |   ConstantUnion.h
|   |   glslang_c_interface.h
|   |   glslang_c_shader_types.h
|   |   InfoSink.h
|   |   InitializeGlobals.h
|   |   intermediate.h
|   |   PoolAlloc.h
|   |   ResourceLimits.h
|   |   ShHandle.h
|   |   SpirvIntrinsics.h
|   |   Types.h
|   |
|   +---MachineIndependent
|   |   |   attribute.h
|   |   |   glslang_tab.cpp.h
|   |   |   gl_types.h
|   |   |   Initialize.h
|   |   |   iomapper.h
|   |   |   LiveTraverser.h
|   |   |   localintermediate.h
|   |   |   ParseHelper.h
|   |   |   reflection.h
|   |   |   RemoveTree.h
|   |   |   Scan.h
|   |   |   ScanContext.h
|   |   |   SymbolTable.h
|   |   |   Versions.h
|   |   |   parseVersions.h
|   |   |   propagateNoContraction.h
|   |   |
|   |   \---preprocessor
|   |   PpContext.h
|   |   PpTokens.h
|   |
|   +---HLSL
|   |   hlslAttributes.h
|   |   hlslParseHelper.h
|   |   hlslTokens.h
|   |   hlslScanContext.h
|   |   hlslOpMap.h
|   |   hlslTokenStream.h
|   |   hlslGrammar.h
|   |   hlslParseables.h
|   |
|   \---SPIRV
|   bitutils.h
|   spirv.hpp
|   GLSL.std.450.h
|   GLSL.ext.EXT.h
|   GLSL.ext.KHR.h
|   GlslangToSpv.h
|   hex_float.h
|   Logger.h
|   SpvBuilder.h
|   spvIR.h
|   doc.h
|   SpvTools.h
|   disassemble.h
|   GLSL.ext.AMD.h
|   GLSL.ext.NV.h
|   NonSemanticDebugPrintf.h
|   SPVRemapper.h
|
\---bin
        glslangValidator.exe
        spirv-remap.exe 
rien333 commented 8 months ago

@xinntao This is no longer "just a bunch of cmake deprecation warnings", but I'm getting actual errors now. In other words: this project fails to build nowadays. Worse yet, it is actually being actively used by various upstream projects, such as https://gitlab.gnome.org/World/Upscaler.

The complete cmake log:

-- Found OpenMP_C: -fopenmp (found version "4.5")
-- Found OpenMP_CXX: -fopenmp (found version "4.5")
-- Found glslangValidator: /usr/bin/glslangValidator
-- Using glslang install located at /usr/lib/cmake
CMake Warning at /usr/lib/cmake/OSDependentTargets.cmake:2 (message):
  Using `OSDependentTargets.cmake` is deprecated: use `find_package(glslang)`
  to find glslang CMake targets.
Call Stack (most recent call first):
  CMakeLists.txt:110 (include)

CMake Error at /usr/lib/cmake/OSDependentTargets.cmake:8 (add_library):
  add_library cannot create ALIAS target "OSDependent" because target
  "glslang::OSDependent" does not already exist.
Call Stack (most recent call first):
  CMakeLists.txt:110 (include)

CMake Error at CMakeLists.txt:111 (include):
  include could not find requested file:

    /usr/lib/cmake/OGLCompilerTargets.cmake

CMake Warning at /usr/lib/cmake/glslangTargets.cmake:2 (message):
  Using `glslangTargets.cmake` is deprecated: use `find_package(glslang)` to
  find glslang CMake targets.
Call Stack (most recent call first):
  CMakeLists.txt:116 (include)

CMake Error at /usr/lib/cmake/glslangTargets.cmake:12 (add_library):
  add_library cannot create ALIAS target "MachineIndependent" because target
  "glslang::MachineIndependent" does not already exist.
Call Stack (most recent call first):
  CMakeLists.txt:116 (include)

CMake Error at /usr/lib/cmake/glslangTargets.cmake:13 (add_library):
  add_library cannot create ALIAS target "GenericCodeGen" because target
  "glslang::GenericCodeGen" does not already exist.
Call Stack (most recent call first):
  CMakeLists.txt:116 (include)

CMake Warning at /usr/lib/cmake/SPIRVTargets.cmake:2 (message):
  Using `SPIRVTargets.cmake` is deprecated: use `find_package(glslang)` to
  find glslang CMake targets.
Call Stack (most recent call first):
  CMakeLists.txt:117 (include)

-- Found OpenMP_C: -fopenmp (found version "4.5")
-- Found OpenMP_CXX: -fopenmp (found version "4.5")
-- Configuring incomplete, errors occurred!

The cmake invocation (ran from a fully up-to-date arch linux):

    cmake -B build -S "$_pkgname/src" \
    -DBUILD_SHARED_LIBS=0 \
    -DUSE_SYSTEM_NCNN=1 \
    -DUSE_SYSTEM_WEBP=1 \
    -DGLSLANG_TARGET_DIR=/usr/lib/cmake \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -Wno-dev