m-ab-s / media-autobuild_suite

This Windows Batchscript helps setup a Mingw-w64 compiler environment for building ffmpeg and other media tools under Windows.
GNU General Public License v3.0
1.52k stars 263 forks source link

glslang: symbols not declared in this scope #2433

Closed LigH-de closed 1 year ago

LigH-de commented 1 year ago

Probably forgot to include cstdint.

logs.zip

tail from ab-suite.build.log

[287/350] Building CXX object glslang/CMakeFiles/MachineIndependent.dir/MachineIndependent/glslang_tab.cpp.obj
FAILED: glslang/CMakeFiles/MachineIndependent.dir/MachineIndependent/glslang_tab.cpp.obj 
G:\MABS\msys64\mingw32\bin\ccache.exe  g++ -DENABLE_HLSL -DENABLE_OPT=1 -DGLSLANG_OSINCLUDE_WIN32 -IG:/MABS/build/glslang-git/build-32bit/include -mthreads -mtune=generic -O2 -pipe -O3 -DNDEBUG -std=c++17 -Wall -Wmaybe-uninitialized -Wuninitialized -Wunused -Wunused-local-typedefs -Wunused-parameter -Wunused-value -Wunused-variable -Wunused-but-set-parameter -Wunused-but-set-variable -fno-exceptions -Wno-reorder -fno-rtti -Werror=deprecated-copy -MD -MT glslang/CMakeFiles/MachineIndependent.dir/MachineIndependent/glslang_tab.cpp.obj -MF glslang\CMakeFiles\MachineIndependent.dir\MachineIndependent\glslang_tab.cpp.obj.d -o glslang/CMakeFiles/MachineIndependent.dir/MachineIndependent/glslang_tab.cpp.obj -c G:/MABS/build/glslang-git/glslang/MachineIndependent/glslang_tab.cpp
In file included from MachineIndependent/glslang.y:86:
G:/MABS/build/glslang-git/glslang/MachineIndependent/SymbolTable.h:649:18: error: 'uint32_t' does not name a type
  649 |     static const uint32_t LevelFlagBitOffset = 56;
      |                  ^~~~~~~~
G:/MABS/build/glslang-git/glslang/MachineIndependent/SymbolTable.h:71:1: note: 'uint32_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
   70 | #include "../Include/InfoSink.h"
  +++ |+#include <cstdint>
   71 | 
G:/MABS/build/glslang-git/glslang/MachineIndependent/SymbolTable.h:662:22: error: 'uint64_t' does not name a type
  662 |     static constexpr uint64_t uniqueIdMask = (1LL << LevelFlagBitOffset) - 1;
      |                      ^~~~~~~~
G:/MABS/build/glslang-git/glslang/MachineIndependent/SymbolTable.h:662:22: note: 'uint64_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
G:/MABS/build/glslang-git/glslang/MachineIndependent/SymbolTable.h:663:18: error: 'uint32_t' does not name a type
  663 |     static const uint32_t MaxLevelInUniqueID = 127;
      |                  ^~~~~~~~
G:/MABS/build/glslang-git/glslang/MachineIndependent/SymbolTable.h:663:18: note: 'uint32_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
G:/MABS/build/glslang-git/glslang/MachineIndependent/SymbolTable.h: In static member function 'static bool glslang::TSymbolTable::isBuiltInSymbol(long long int)':
G:/MABS/build/glslang-git/glslang/MachineIndependent/SymbolTable.h:659:50: error: 'LevelFlagBitOffset' was not declared in this scope
  659 |         int level = static_cast<int>(uniqueId >> LevelFlagBitOffset);
      |                                                  ^~~~~~~~~~~~~~~~~~
G:/MABS/build/glslang-git/glslang/MachineIndependent/SymbolTable.h: In member function 'void glslang::TSymbolTable::amendSymbolIdLevel(glslang::TSymbol&)':
G:/MABS/build/glslang-git/glslang/MachineIndependent/SymbolTable.h:735:9: error: 'uint64_t' was not declared in this scope
  735 |         uint64_t level = (uint32_t)currentLevel() > MaxLevelInUniqueID ? MaxLevelInUniqueID : currentLevel();
      |         ^~~~~~~~
G:/MABS/build/glslang-git/glslang/MachineIndependent/SymbolTable.h:735:9: note: 'uint64_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
G:/MABS/build/glslang-git/glslang/MachineIndependent/SymbolTable.h:736:18: error: expected ';' before 'symbolId'
  736 |         uint64_t symbolId = symbol.getUniqueId();
      |                  ^~~~~~~~
G:/MABS/build/glslang-git/glslang/MachineIndependent/SymbolTable.h:737:9: error: 'symbolId' was not declared in this scope; did you mean 'symbol'?
  737 |         symbolId &= uniqueIdMask;
      |         ^~~~~~~~
      |         symbol
G:/MABS/build/glslang-git/glslang/MachineIndependent/SymbolTable.h:737:21: error: 'uniqueIdMask' was not declared in this scope; did you mean 'uniqueId'?
  737 |         symbolId &= uniqueIdMask;
      |                     ^~~~~~~~~~~~
      |                     uniqueId
G:/MABS/build/glslang-git/glslang/MachineIndependent/SymbolTable.h:738:22: error: 'level' was not declared in this scope
  738 |         symbolId |= (level << LevelFlagBitOffset);
      |                      ^~~~~
G:/MABS/build/glslang-git/glslang/MachineIndependent/SymbolTable.h:738:31: error: 'LevelFlagBitOffset' was not declared in this scope
  738 |         symbolId |= (level << LevelFlagBitOffset);
      |                               ^~~~~~~~~~~~~~~~~~
G:/MABS/build/glslang-git/glslang/MachineIndependent/SymbolTable.h: In member function 'void glslang::TSymbolTable::updateUniqueIdLevelFlag()':
G:/MABS/build/glslang-git/glslang/MachineIndependent/SymbolTable.h:932:9: error: 'uint64_t' was not declared in this scope
  932 |         uint64_t level = (uint32_t)currentLevel() > MaxLevelInUniqueID ? MaxLevelInUniqueID : currentLevel();
      |         ^~~~~~~~
G:/MABS/build/glslang-git/glslang/MachineIndependent/SymbolTable.h:932:9: note: 'uint64_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
G:/MABS/build/glslang-git/glslang/MachineIndependent/SymbolTable.h:933:21: error: 'uniqueIdMask' was not declared in this scope; did you mean 'uniqueId'?
  933 |         uniqueId &= uniqueIdMask;
      |                     ^~~~~~~~~~~~
      |                     uniqueId
G:/MABS/build/glslang-git/glslang/MachineIndependent/SymbolTable.h:934:22: error: 'level' was not declared in this scope
  934 |         uniqueId |= (level << LevelFlagBitOffset);
      |                      ^~~~~
G:/MABS/build/glslang-git/glslang/MachineIndependent/SymbolTable.h:934:31: error: 'LevelFlagBitOffset' was not declared in this scope
  934 |         uniqueId |= (level << LevelFlagBitOffset);
      |                               ^~~~~~~~~~~~~~~~~~
ninja: build stopped: subcommand failed.
ycwan commented 1 year ago

I have the same issue when updating MABS

logs.zip

ab-suite.build.log

17:04:34 ┌ glslang git ................................. [Updates found] 17:04:35 ├ Running uninstall... 17:04:35 ├ Running dependencies... 17:04:53 ├ Running cmake... 17:05:02 ├ Running build... Likely error (tail of the failed operation logfile): 933 | uniqueId &= uniqueIdMask; | ^~~~ | uniqueId C:/MinGW-w64/build/glslang-git/glslang/MachineIndependent/SymbolTable.h:934:22: error: 'level' was not declared in this scope 934 | uniqueId |= (level << LevelFlagBitOffset); | ^~~~~ C:/MinGW-w64/build/glslang-git/glslang/MachineIndependent/SymbolTable.h:934:31: error: 'LevelFlagBitOffset' was not declared in this scope 934 | uniqueId |= (level << LevelFlagBitOffset); | ^~~~~~ ninja: build stopped: subcommand failed. build failed. Check C:/MinGW-w64/build/glslang-git/build-64bit/ab-suite.build.log This is required for other packages, so this script will exit. 17:11:14 Creating diagnostics file...

Attach C:\MinGW-w64\build\logs.zip to the GitHub issue. Make sure the suite is up-to-date before reporting an issue. It might've been fixed already.

Try running the build again at a later time.

LigH-de commented 1 year ago

We may have to wait until KhronosGroup commits an already prepared patch...

LigH-de commented 1 year ago

Or someone with experience, like @1480c1 maybe, might turn this PR into a patch.

waldonnis commented 1 year ago

Or someone with experience, like @1480c1 maybe, might turn this PR into a patch.

If so, it has to be done for shaderc too, since media-suite_compile.sh checks out another copy of glslang in shaderc's third_party directory tree. I've done so locally temporarily since I needed a new build done and didn't want to mess with downgrading the toolchain, but it would be much better if the Khronos folks would just commit at least the necessary one-liner (if not that whole PR).

patrickenfuego commented 1 year ago

I came to report that I'm experiencing this issue as well, same error as posted above so I won't repeat it.

hydra3333 commented 1 year ago

me too :)

LigH-de commented 1 year ago

Tell it the KhronosGroup, they need to know it's getting urgent.

hydra3333 commented 1 year ago

OK. Tried the pull request patch over at their site and when applied here it builds.

https://github.com/KhronosGroup/glslang/issues/3139#issuecomment-1546609608

LigH-de commented 1 year ago

Can you mention a line to manually add to our suite to retrieve that PR and patch it here locally? I guess a do_patch would belong somewhere between lines 1980 and 2000 in build/media-suite_compile.sh?

diegocr commented 1 year ago

Until this is fixed upstream you can add the usual *_extra.sh files to patch this on the fly.

~/mabs/build/glslang_extra.sh :

_pre_ninja(){

    sed -i 's!#include <cstdio>!#include <cstdint>\n#include <cstdio>!' ${REPO_DIR}/glslang/Include/Common.h
}

~/mabs/build/shaderc_extra.sh

_pre_ninja(){

    sed -i 's!#include <cstdio>!#include <cstdint>\n#include <cstdio>!' ${REPO_DIR}/third_party/glslang/glslang/Include/Common.h
}

as a side note, we're anyway doomed with those latest builds, because libplacebo does now requires Vulkan 1.3 and FFmpeg is still restricting it to version 1.2 until a major revamp is made 👀

hydra3333 commented 1 year ago

In media-suite_compile.sh

Add line

    do_patch "https://patch-diff.githubusercontent.com/raw/KhronosGroup/glslang/pull/3144.patch" am

like this:

_check=(lib{glslang,OSDependent,HLSL,OGLCompiler,SPVRemapper}.a
        libSPIRV{,-Tools{,-opt,-link,-reduce}}.a glslang/SPIRV/GlslangToSpv.h)
if { { [[ $mpv != n ]]  && ! mpv_disabled libplacebo; } ||
     { [[ $ffmpeg != no ]] && enabled_any libplacebo libglslang; } } &&
    # 2023.05.13 https://patch-diff.githubusercontent.com/raw/KhronosGroup/glslang/pull/3144.patch
    do_vcs "$SOURCE_REPO_GLSLANG"; then
    do_uninstall "${_check[@]}"
    log dependencies /usr/bin/python ./update_glslang_sources.py
    do_patch "https://patch-diff.githubusercontent.com/raw/KhronosGroup/glslang/pull/3144.patch" am
    do_cmakeinstall -DUNIX=OFF
    do_checkIfExist
fi

The build doesn't appear to abort, even with the vulkan issue.

LigH-de commented 1 year ago

Well, glslang builds, but shaderc needs a similar one, executed in build/shaderc-git/third_party/glslang.

I will test this:

         do_uninstall "${_check[@]}" include/shaderc include/libshaderc_util

         cd third_party

         do_vcs_local "$SOURCE_REPO_GLSLANG" glslang
+        cd glslang
+        do_patch "https://patch-diff.githubusercontent.com/raw/KhronosGroup/glslang/pull/3144.patch" am
+        cd ..
         do_vcs_local "$SOURCE_REPO_SPIRV_TOOLS" spirv-tools
         do_vcs_local "$SOURCE_REPO_SPIRV_HEADERS" spirv-headers
         do_vcs_local "$SOURCE_REPO_SPIRV_CROSS" spirv-cross

_

PS: shaderc has built this way. And ffmpeg, eventually, too.

LigH-de commented 1 year ago

Fixed upstream.