LuisaGroup / LuisaRender

High-Performance Cross-Platform Monte Carlo Renderer Based on LuisaCompute
BSD 3-Clause "New" or "Revised" License
417 stars 29 forks source link

ZipArchiveIOSystem.cpp:99:12: error: ‘voidpf’ does not name a type; did you mean ‘void’? #16

Closed disini closed 1 year ago

disini commented 1 year ago

Hello,

there is another error when I execute the make command,

ZipArchiveIOSystem.cpp:99:12: error: ‘voidpf’ does not name a type; did you mean ‘void’?

[ 14%] Linking C shared module ../../../../../bin/liblc-hlsl-builtin.so
[ 14%] Built target luisa-compute-hlsl-builtin55: clang-sys, serde, typenum...
[ 14%] Building CXX object src/ext/tinyexr/code/CMakeFiles/assimp.dir/Geometry/GeometryUtils.cpp.o
[ 14%] Building CXX object src/ext/tinyexr/code/CMakeFiles/assimp.dir/Common/Base64.cpp.o
/media/liusheng/Projects/project/game_engines/LuisaRender/github/LuisaGroup/LuisaRender/LuisaRender/src/ext/assimp/code/Common/ZipArchiveIOSystem.cpp:99:12: error: ‘voidpf’ does not name a type; did you mean ‘void’?
   99 |     static voidpf open(voidpf opaque, const char *filename, int mode);
      |            ^~~~~~
      |            void
/media/liusheng/Projects/project/game_engines/LuisaRender/github/LuisaGroup/LuisaRender/LuisaRender/src/ext/assimp/code/Common/ZipArchiveIOSystem.cpp:100:12: error: ‘voidpf’ does not name a type; did you mean ‘void’?
  100 |     static voidpf opendisk(voidpf opaque, voidpf stream, uint32_t number_disk, int mode);
      |            ^~~~~~
      |            void
/media/liusheng/Projects/project/game_engines/LuisaRender/github/LuisaGroup/LuisaRender/LuisaRender/src/ext/assimp/code/Common/ZipArchiveIOSystem.cpp:101:12: error: ‘uLong’ does not name a type; did you mean ‘ulong’?
  101 |     static uLong read(voidpf opaque, voidpf stream, void *buf, uLong size);
      |            ^~~~~
      |            ulong

I searched the ‘voidpf’ in the whole directory and find it in

src/ext/tinyexr/deps/miniz/miniz.h,

So I added in the `ZipArchiveIOSystem.cpp:

#include <tinyexr/deps/miniz/miniz.h>

I tried to ignore that warning and execute make, the former error was gone but it shows:

[ 19%] Building CXX object src/ext/tinyexr/code/CMakeFiles/assimp.dir/PostProcessing/GenVertexNormalsProcess.cpp.o
In file included from /usr/local/include/minizip/mz_compat.h:16,
                 from /usr/local/include/minizip/unzip.h:10,
                 from /media/liusheng/Projects/project/game_engines/LuisaRender/github/LuisaGroup/LuisaRender/LuisaRender/src/ext/assimp/code/Common/ZipArchiveIOSystem.cpp:64:
/usr/local/include/minizip/mz.h:17: error: "MZ_VERSION" redefined [-Werror]
   17 | #define MZ_VERSION                      ("4.0.0")
      | 
In file included from /media/liusheng/Projects/project/game_engines/LuisaRender/github/LuisaGroup/LuisaRender/LuisaRender/src/ext/assimp/code/Common/ZipArchiveIOSystem.cpp:47:
/media/liusheng/Projects/project/game_engines/LuisaRender/github/LuisaGroup/LuisaRender/LuisaRender/src/ext/assimp/../tinyexr/deps/miniz/miniz.h:278: note: this is the location of the previous definition
  278 | #define MZ_VERSION "11.0.2"
      | 
cc1plus: all warnings being treated as errors
make[2]: *** [src/ext/tinyexr/code/CMakeFiles/assimp.dir/build.make:216:src/ext/tinyexr/code/CMakeFiles/assimp.dir/Common/ZipArchiveIOSystem.cpp.o] 错误 1
make[2]: *** 正在等待未完成的任务....
make[1]: *** [CMakeFiles/Makefile2:1163:src/ext/tinyexr/code/CMakeFiles/assimp.dir/all] 错误 2
make[1]: *** 正在等待未完成的任务....
warning: `luisa_compute_ir` (lib) generated 15 warnings (run `cargo fix --lib -p luisa_compute_ir` to apply 8 suggestions)
    Finished release [optimized] target(s) in 5.30s

it seems a conflict between two different versions of the MZ_VERSION macro in the "src/ext/tinyexr/deps/miniz/miniz.h" file and the system header file.

So I checked the ZipArchiveIOSystem.cpp again and comment the #include line I added. And I found the cause in

#ifdef ASSIMP_USE_HUNTER
    #include <minizip/unzip.h>
#else
    #include <unzip.h>

there's no minizip directory in the src directory and it subdirectories .

Should I download it myself or there's something wrong with my manipulation ? Thanks!

Mike-Leo-Smith commented 1 year ago

Likely, the different versions of miniz in tinyexr and assimp caused the compilation error. I'll see if there's any way to resolve it.

disini commented 1 year ago

Likely, the different versions of miniz in tinyexr and assimp caused the compilation error. I'll see if there's any way to resolve it.

Thanks so much!

Mike-Leo-Smith commented 1 year ago

Hi, @disini

I have updated the build process. LuisaRender will now try to find zlib on your system before building minizip for both assimp and tinyexr. Hopefully, this will resolve the conflict.

disini commented 1 year ago

Hi, @disini

I have updated the build process. LuisaRender will now try to find zlib on your system before building minizip for both assimp and tinyexr. Hopefully, this will resolve the conflict.

Hi @Mike-Leo-Smith , Thanks so much for your great job, now it can be compiled perfectly with the very original files cloned from the server, I don't need to change anything, that's awesome! Thank you!

Mike-Leo-Smith commented 1 year ago

Hi, @disini I have updated the build process. LuisaRender will now try to find zlib on your system before building minizip for both assimp and tinyexr. Hopefully, this will resolve the conflict.

Hi @Mike-Leo-Smith , Thanks so much for your great job, now it can be compiled perfectly with the very original files cloned from the server, I don't need to change anything, that's awesome! Thank you!

Wonderful to hear that! Thank you!