mitsuba-renderer / drjit

Dr.Jit — A Just-In-Time-Compiler for Differentiable Rendering
BSD 3-Clause "New" or "Revised" License
563 stars 40 forks source link

Fail to build with GCC 13 #225

Closed dongchen-yang closed 3 months ago

dongchen-yang commented 4 months ago

Hi thanks for your great work. I was trying to build it from source and followed the instructions in https://drjit.readthedocs.io/en/latest/firststeps-cpp.html, but I got this kind of error messages when compiling:

drjit-core/src/common.h:91:53: error: 'uint16_t' does not name a type
   91 | template <> struct uint_with_size<2> { using type = uint16_t; };

My Gcc version:

gcc (conda-forge gcc 13.2.0-7) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I think this might be an issue with gcc version. Could you give me some further instruction on how to fix it? Thanks in advance.

merlinND commented 3 months ago

Hello @dongchen-yang,

This sounds very similar to the compilation issue that was fixed by this PR: https://github.com/mitsuba-renderer/drjit-core/pull/77

Could you please double-check that that PR's fix is present in your local checkout of the repo?

dongchen-yang commented 3 months ago

Thanks for your reply. I cloned the newest drjit-core and seems this error has gone. However, I got this new error:

/mnt/data3/home/dongchen/code/drjit/ext/drjit-core/src/var.cpp:424:91: error: expected ')' before 'PRIxPTR'
  424 |         case VarType::Pointer: JIT_LITERAL_PRINT(uintptr_t, uintptr_t, (graphviz ? ("0x%" PRIxPTR) : (DRJIT_PTR)));
      |                                                                                    ~      ^~~~~~~
/mnt/data3/home/dongchen/code/drjit/ext/drjit-core/src/var.cpp:408:28: note: in definition of macro 'JIT_LITERAL_PRINT'
  408 |             var_buffer.fmt(fmtstr, (ptype) value);     \
      |                            ^~~~~~
/mnt/data3/home/dongchen/code/drjit/ext/drjit-core/src/var.cpp:17:1: note: 'PRIxPTR' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?
   16 | #include "registry.h"
  +++ |+#include <cinttypes>

by the way, I have also downgrading my gcc to 11.1

merlinND commented 3 months ago

Have you tried including the header suggested by the compiler's note? (#include <cinttypes>). The GCC version tested on the CI is GCC 9, some headers that are implicitly (transitively) included in one version may no longer be in the next one, so it's probably what yo're running into here.

dongchen-yang commented 3 months ago

No, I solved it by installing Visual Studio on my Windows OS. I installed the c/c++ compliers there and now it works well! I have also installed gcc-11 on Ubuntu and it is also successfully compiled there. Thanks for your kind reply!