mmp / pbrt-v4

Source code to pbrt, the ray tracer described in the forthcoming 4th edition of the "Physically Based Rendering: From Theory to Implementation" book.
https://pbrt.org
Apache License 2.0
2.8k stars 429 forks source link

Compilation failed on Windows and Mingw #344

Closed MoamenAbdelsattar closed 1 year ago

MoamenAbdelsattar commented 1 year ago

I'm trying to compile pbrt-v4 on windows using Mingw, I got this error:

FAILED: CMakeFiles/pbrt_lib.dir/src/pbrt/textures.cpp.obj
c:\mingw64\bin\g++.exe -DNOMINMAX -DPBRT_HAS_INTRIN_H -DPBRT_HAVE__ALIGNED_MALLOC -DPBRT_IS_WINDOWS -DPBRT_NOINLINE=__attribute__((noinline)) -DPBRT_RESTRICT=__restrict__ -DPTEX_STATIC -I"(pbrt4-path)/src" -I"(pbrt4-path)/src/ext" -I"(pbrt4-path)/src/ext/stb" -I"(pbrt4-path)/src/ext/qoi" -I"(pbrt4-path)/src/ext/openexr/IlmBase/Imath" -I"(pbrt4-path)/src/ext/openexr/IlmBase/Half" -I"(pbrt4-path)/src/ext/openexr/IlmBase/Iex" -I"(pbrt4-path)/src/ext/openexr/OpenEXR/IlmImf" -I"(pbrt4-path)/bin/src/ext/openexr/IlmBase/config" -I"(pbrt4-path)/bin/src/ext/openexr/OpenEXR/config" -I"(pbrt4-path)/src/ext/zlib" -I"(pbrt4-path)/bin/src/ext/zlib" -I"(pbrt4-path)/src/ext/libdeflate" -I"(pbrt4-path)/src/ext/filesystem" -I"(pbrt4-path)/src/ext/ptex/src/ptex" -I"(pbrt4-path)/src/ext/double-conversion" -I"(pbrt4-path)/src/ext/openvdb/nanovdb" -I"(pbrt4-path)/bin" -I"(pbrt4-path)/src/ext/glfw/include" -I"(pbrt4-path)/src/ext/glad/include" -O3 -DNDEBUG -march=native -std=gnu++17 -MD -MT CMakeFiles/pbrt_lib.dir/src/pbrt/textures.cpp.obj -MF CMakeFiles\pbrt_lib.dir\src\pbrt\textures.cpp.obj.d -o CMakeFiles/pbrt_lib.dir/src/pbrt/textures.cpp.obj -c "(pbrt4-path)/src/pbrt/textures.cpp"
In file included from (pbrt4-path)/src/ext/ptex/src/ptex/Ptexture.h:65,
                 from (pbrt4-path)/src/pbrt/textures.cpp:24:
(pbrt4-path)/src/ext/ptex/src/ptex/PtexInt.h:49:27: error: conflicting declaration 'typedef char int8_t'
   49 | typedef __int8            int8_t;
      |                           ^~~~~~
In file included from c:\mingw64\lib\gcc\x86_64-w64-mingw32\12.2.0\include\stdint.h:9,
                 from (pbrt4-path)/src/pbrt/pbrt.h:8,
                 from (pbrt4-path)/src/pbrt/textures.h:8,
                 from (pbrt4-path)/src/pbrt/textures.cpp:5:
c:\mingw64\x86_64-w64-mingw32\include\stdint.h:35:21: note: previous declaration as 'typedef signed char int8_t'
   35 | typedef signed char int8_t;
      |                     ^~~~~~
ninja: build stopped: subcommand failed.
MoamenAbdelsattar commented 1 year ago

I'm sorry, I've only now noticed the previous issue. https://github.com/mmp/pbrt-v4/issues/297

odil24 commented 1 year ago

I'm sorry, I've only now noticed the previous issue. https://github.com/mmp/pbrt-v4/issues/297

Assalamu alaykum. Hey bro, can you share with me your compiled build for windows?

MoamenAbdelsattar commented 1 year ago

وعليكم السلام ورحمة الله وبركاته yes sure, but I'm getting another error probably due to corrupt installation of min-gw. I've got exams to study for and I can't find enough time to fix the error, so give me few days, sorry for that. Also please note that I'm building without gpu support because I don't have Optix installation.

odil24 commented 1 year ago

Oh, no problem but unfortunately I need CPU/GPU build for my addon for Blender.

MoamenAbdelsattar commented 1 year ago

Good luck, but if you are going to distribute an addon, you should NEVER take the build from someone else. You should build pbrt yourself. The build from someone else can be malicious, and you will be responsible for any harm happening to the users of your addon.