Autodesk / Aurora

Real-time GPU path tracing with a USD Hydra render delegate
Apache License 2.0
473 stars 30 forks source link

[compile error] ubuntu 20.04 compile error : AU_FAIL #4

Closed ZhongLingXiao closed 1 year ago

ZhongLingXiao commented 1 year ago

OS : WSL2 ubuntu 20.04 Branch : main

After execute cmd : cmake --build Build, it fail to build the project and show error below.

➜  Aurora git:(main) ✗ cmake --build Build

[  1%] Building CXX object Libraries/Foundation/CMakeFiles/Foundation.dir/Source/Utilities.cpp.o
/home/kazenzhong/dev/Aurora/Libraries/Foundation/Source/Utilities.cpp:86:45: error: ISO C++11 requires at least one argument for the "..." in a variadic macro [-Werror]
   86 |         AU_FAIL("Failed to get module path.");
      |                                             ^
In file included from /home/kazenzhong/dev/Aurora/Libraries/Foundation/Source/Utilities.cpp:15:
/home/kazenzhong/dev/Aurora/Libraries/Foundation/API/Aurora/Foundation/Utilities.h:120:2: error: extra ‘;’ [-Werror=pedantic]
  120 | };
      |  ^
In file included from /home/kazenzhong/dev/Aurora/Libraries/Foundation/Source/Utilities.cpp:16:
/home/kazenzhong/dev/Aurora/Libraries/Foundation/API/Aurora/Foundation/Log.h:308:6: error: extra ‘;’ [-Werror=pedantic]
  308 |     };
      |      ^
      |      -
/home/kazenzhong/dev/Aurora/Libraries/Foundation/API/Aurora/Foundation/Log.h: In instantiation of ‘std::string Aurora::Foundation::Log::stringFormat(const string&, Args ...) [with Args = {}; std::string = std::__cxx11::basic_string<char>]’:
/home/kazenzhong/dev/Aurora/Libraries/Foundation/API/Aurora/Foundation/Log.h:187:21:   required from ‘bool Aurora::Foundation::Log::log(Aurora::Foundation::Log::Level, std::ostream&, const string&, int, const string&, Args ...) [with Args = {}; std::ostream = std::basic_ostream<char>; std::string = std::__cxx11::basic_string<char>]’
/home/kazenzhong/dev/Aurora/Libraries/Foundation/API/Aurora/Foundation/Log.h:244:9:   required from ‘static bool Aurora::Foundation::Log::fail(const string&, int, const string&, Args ...) [with Args = {}; std::string = std::__cxx11::basic_string<char>]’
/home/kazenzhong/dev/Aurora/Libraries/Foundation/Source/Utilities.cpp:86:9:   required from here
/home/kazenzhong/dev/Aurora/Libraries/Foundation/API/Aurora/Foundation/Log.h:277:46: error: format not a string literal and no format arguments [-Werror=format-security]
  277 |         int size              = std::snprintf(nullptr, 0, formatStr, args...) + 2;
      |                                 ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kazenzhong/dev/Aurora/Libraries/Foundation/API/Aurora/Foundation/Log.h:288:22: error: format not a string literal and no format arguments [-Werror=format-security]
  288 |         std::snprintf(buf.data(), size, formatStr, args...);
      |         ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: error: unrecognized command line option ‘-Wno-gnu-zero-variadic-macro-arguments’ [-Werror]
cc1plus: all warnings being treated as errors
make[2]: *** [Libraries/Foundation/CMakeFiles/Foundation.dir/build.make:76: Libraries/Foundation/CMakeFiles/Foundation.dir/Source/Utilities.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:251: Libraries/Foundation/CMakeFiles/Foundation.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

It seems this error is related to compile flag in cmake file:

# add_compile_options(-Wall -Wextra -Wpedantic -Werror -Wno-unknown-pragmas -Wno-gnu-zero-variadic-macro-arguments)
add_compile_options(-Wall -Wextra -Wno-unknown-pragmas -Wno-gnu-zero-variadic-macro-arguments)

This will works after remove -Wpedantic -Werror, however I suppose there may be a more decent way to deal with this issue.

andy-shiue-autodesk commented 1 year ago

Which compiler did you use to build Aurora?

Also, even though I built Aurora successively on WSL2 two weeks ago, Aurora does not officially support WSL2. As far as I am aware, there is no Vulkan support on WSL2 yet (i.e. you cannot run Aurora).

andy-shiue-autodesk commented 1 year ago

I just tested it in WSL2. The errors you had are likely triggered by gcc. I got the same errors with gcc but built successfully with clang-11. clang-11 is the only compiler Aurora officially supported (for now).

I am closing the ticket. Please try building with clang-11. If you encounter any build errors, please feel free to reopen this ticket or create a new one.