Hey there, I have been trying to rebuild blender for the past days (main branch, haven’t pulled since 2 or 3 months), but even after completely removing the build directories, double checking dependencies etc. I keep having the same errors (on Ubuntu 24.04), all related to Template declarations from the changes in #137441:
[ 15%] Building CXX object extern/draco/CMakeFiles/extern_draco.dir/src/decoder.cpp.o
/home/meredith/blender-git/blender/source/blender/gpu/shaders/common/gpu_shader_math_vector_lib.glsl:285:0: error: Template declaration unsupported syntax
template<typename VecT, int dim>
^
I cannot attach my log as well as my CMakeCache.txt, but you can view them in the blender chat thread. Can someone help me figure this out?
I honnestly don’t understand how that can fail. This looks like some regex did not work properly. What is your compiler?
Can you also try to run this from the build folder? ./bin/glsl_preprocess ../blender/source/blender/draw/engines/eevee/shaders/eevee_shadow_tracing_lib.glsl ../out.glsl ../out.hh
And attach the resulting ../out.glsl and ../out.hh files?
I can try to escape all the characters in the regexes to see if that makes a difference:
diff --git a/source/blender/gpu/glsl_preprocess/glsl_preprocess.hh b/source/blender/gpu/glsl_preprocess/glsl_preprocess.hh
index d1bb4ee6c13..63d4665642f 100644
--- a/source/blender/gpu/glsl_preprocess/glsl_preprocess.hh
+++ b/source/blender/gpu/glsl_preprocess/glsl_preprocess.hh
@@ -324,7 +324,7 @@ class Preprocessor {
std::string out_str = str;
{
/* Transform template definition into macro declaration. */
- std::regex regex(R"(template<([\w\d\n, ]+)>(\s\w+\s)(\w+)\()");
+ std::regex regex(R"(template<([\w\d\n\,\ ]+)>(\s\w+\s)(\w+)\()");
out_str = std::regex_replace(out_str, regex, "#define $3_TEMPLATE($1)$2$3@(");
}
{
@@ -385,7 +385,7 @@ class Preprocessor {
{
/* Replace explicit instantiation by macro call. */
/* Only `template ret_t fn<T>(args);` syntax is supported. */
- std::regex regex_instance(R"(template \w+ (\w+)<([\w+, \n]+)>\(([\w+ ,\n]+)\);)");
+ std::regex regex_instance(R"(template \w+ (\w+)<([\w+\,\ \n]+)>\(([\w+\ \,\n]+)\);)");
/* Notice the stupid way of keeping the number of lines the same by copying the argument list
* inside a multi-line comment. */
out_str = std::regex_replace(out_str, regex_instance, "$1_TEMPLATE($2)/*$3*/");