Atrc icon indicating copy to clipboard operation
Atrc copied to clipboard

Failed to build

Open ghost opened this issue 1 year ago • 5 comments

$ cmake ..
-- Building for: Ninja
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/msys64/mingw64/bin/cc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/msys64/mingw64/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Build spdlog: 1.4.3
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Build type: Release
CMake Error at CMakeLists.txt:60 (ADD_SUBDIRECTORY):
  The source directory

    C:/msys64/home/Administrator/Atrc/lib/utility

  does not contain a CMakeLists.txt file.


CMake Error at CMakeLists.txt:62 (TARGET_COMPILE_DEFINITIONS):
  Cannot specify compile definitions for target "AGZUtils" which is not built
  by this project.


CMake Error at CMakeLists.txt:63 (SET_TARGET_PROPERTIES):
  SET_TARGET_PROPERTIES Can not find target to add properties to: AGZUtils


-- Configuring incomplete, errors occurred!

ghost avatar Apr 07 '23 19:04 ghost

Submodules should be cloned recursively. Try git clone --recursive RepoURL.

AirGuanZ avatar Apr 08 '23 04:04 AirGuanZ

Submodules should be cloned recursively. Try git clone --recursive RepoURL.

I didn't clone the repo recursively, but latter I use this command:

git submodule update --init --recursive

I think it's equivalent? I will reclone your repo recursively to try if it help.

ghost avatar Apr 08 '23 06:04 ghost

It turned out the two commands are not equivalent. Cloned the repo recursively and cmake configuration done. But build failed:

[61/169] Building CXX object lib/utility/CMakeFiles/AGZUtils.dir/src/image/load_image.cpp.obj
FAILED: lib/utility/CMakeFiles/AGZUtils.dir/src/image/load_image.cpp.obj
C:\msys64\mingw64\bin\c++.exe -DAGZ_UTILS_SSE -IC:/msys64/home/Administrator/Atrc/lib/utility/include -IC:/msys64/home/Administrator/Atrc/lib/utility/ext/avir -O3 -DNDEBUG -std=gnu++17 -MD -MT lib/utility/CMakeFiles/AGZUtils.dir/src/image/load_image.cpp.obj -MF lib\utility\CMakeFiles\AGZUtils.dir\src\image\load_image.cpp.obj.d -o lib/utility/CMakeFiles/AGZUtils.dir/src/image/load_image.cpp.obj -c C:/msys64/home/Administrator/Atrc/lib/utility/src/image/load_image.cpp
In file included from C:/msys64/home/Administrator/Atrc/lib/utility/include/agz-utils/misc.h:8,
                 from C:/msys64/home/Administrator/Atrc/lib/utility/src/image/load_image.cpp:6:
C:/msys64/home/Administrator/Atrc/lib/utility/include/agz-utils/misc/endian.h:6:10: fatal error: endian.h: No such file or directory
    6 | #include <endian.h>
      |          ^~~~~~~~~~
compilation terminated.
[62/169] Building CXX object lib/utility/CMakeFiles/AGZUtils.dir/src/image/save_image.cpp.obj
FAILED: lib/utility/CMakeFiles/AGZUtils.dir/src/image/save_image.cpp.obj
C:\msys64\mingw64\bin\c++.exe -DAGZ_UTILS_SSE -IC:/msys64/home/Administrator/Atrc/lib/utility/include -IC:/msys64/home/Administrator/Atrc/lib/utility/ext/avir -O3 -DNDEBUG -std=gnu++17 -MD -MT lib/utility/CMakeFiles/AGZUtils.dir/src/image/save_image.cpp.obj -MF lib\utility\CMakeFiles\AGZUtils.dir\src\image\save_image.cpp.obj.d -o lib/utility/CMakeFiles/AGZUtils.dir/src/image/save_image.cpp.obj -c C:/msys64/home/Administrator/Atrc/lib/utility/src/image/save_image.cpp
In file included from C:/msys64/home/Administrator/Atrc/lib/utility/include/agz-utils/math/impl/tensor.inl:6,
                 from C:/msys64/home/Administrator/Atrc/lib/utility/include/agz-utils/math/math.h:55,
                 from C:/msys64/home/Administrator/Atrc/lib/utility/include/agz-utils/math.h:3,
                 from C:/msys64/home/Administrator/Atrc/lib/utility/include/agz-utils/image/save_image.h:5,
                 from C:/msys64/home/Administrator/Atrc/lib/utility/src/image/save_image.cpp:5:
C:/msys64/home/Administrator/Atrc/lib/utility/include/agz-utils/alloc/alloc.h: In function 'void* agz::alloc::aligned_alloc(size_t, size_t)':
C:/msys64/home/Administrator/Atrc/lib/utility/include/agz-utils/alloc/alloc.h:73:22: error: 'aligned_alloc' is not a member of 'std'; did you mean 'aligned_union'?
   73 |     void *ret = std::aligned_alloc(align, byte_size);
      |                      ^~~~~~~~~~~~~
      |                      aligned_union
[63/169] Building CXX object lib/utility/CMakeFiles/AGZUtils.dir/src/mesh/load_mesh.cpp.obj
FAILED: lib/utility/CMakeFiles/AGZUtils.dir/src/mesh/load_mesh.cpp.obj
C:\msys64\mingw64\bin\c++.exe -DAGZ_UTILS_SSE -IC:/msys64/home/Administrator/Atrc/lib/utility/include -IC:/msys64/home/Administrator/Atrc/lib/utility/ext/avir -O3 -DNDEBUG -std=gnu++17 -MD -MT lib/utility/CMakeFiles/AGZUtils.dir/src/mesh/load_mesh.cpp.obj -MF lib\utility\CMakeFiles\AGZUtils.dir\src\mesh\load_mesh.cpp.obj.d -o lib/utility/CMakeFiles/AGZUtils.dir/src/mesh/load_mesh.cpp.obj -c C:/msys64/home/Administrator/Atrc/lib/utility/src/mesh/load_mesh.cpp
In file included from C:/msys64/home/Administrator/Atrc/lib/utility/include/agz-utils/math/impl/tensor.inl:6,
                 from C:/msys64/home/Administrator/Atrc/lib/utility/include/agz-utils/math/math.h:55,
                 from C:/msys64/home/Administrator/Atrc/lib/utility/include/agz-utils/math.h:3,
                 from C:/msys64/home/Administrator/Atrc/lib/utility/include/agz-utils/mesh/load_mesh.h:3,
                 from C:/msys64/home/Administrator/Atrc/lib/utility/src/mesh/load_mesh.cpp:2:
C:/msys64/home/Administrator/Atrc/lib/utility/include/agz-utils/alloc/alloc.h: In function 'void* agz::alloc::aligned_alloc(size_t, size_t)':
C:/msys64/home/Administrator/Atrc/lib/utility/include/agz-utils/alloc/alloc.h:73:22: error: 'aligned_alloc' is not a member of 'std'; did you mean 'aligned_union'?
   73 |     void *ret = std::aligned_alloc(align, byte_size);
      |                      ^~~~~~~~~~~~~
      |                      aligned_union
[64/169] Building CXX object lib/utility/CMakeFiles/AGZUtils.dir/src/mesh/tinyply.cpp.obj
[65/169] Building CXX object lib/spdlog/CMakeFiles/spdlog.dir/src/fmt.cpp.obj
[66/169] Building CXX object lib/spdlog/CMakeFiles/spdlog.dir/src/spdlog.cpp.obj

ghost avatar Apr 08 '23 06:04 ghost

Please note that only MSVC and clang++ in Linux were tested. Using other compilers or environments is theoretically feasible, but there may be some minor issues that need to be fixed.

The endian.h is not available on Windows. agz-utils uses it for endian determination in gnu environment. Please remove the gnu macros in agz-utils/misc/endian.h.

As for std::aligned_alloc, It appears that mingw64 doesn't provide the std::aligned_alloc function in C++17. However, there is a workaround using _aligned_malloc on Windows. You can try changing AGZ_CC_MSVC in agz-utils/alloc/alloc.h to match mingw64.

I may attempt to fix the compilation issues on mingw later.

AirGuanZ avatar Apr 08 '23 12:04 AirGuanZ

Please note that only MSVC and clang++ in Linux were tested. Using other compilers or environments is theoretically feasible, but there may be some minor issues that need to be fixed.

The endian.h is not available on Windows. agz-utils uses it for endian determination in gnu environment. Please remove the gnu macros in agz-utils/misc/endian.h.

As for std::aligned_alloc, It appears that mingw64 doesn't provide the std::aligned_alloc function in C++17. However, there is a workaround using _aligned_malloc on Windows. You can try changing AGZ_CC_MSVC in agz-utils/alloc/alloc.h to match mingw64.

I may attempt to fix the compilation issues on mingw later.

Doing as you said, but run into another problem:

[61/169] Building CXX object lib/utility/CMakeFiles/AGZUtils.dir/src/image/load_image.cpp.obj
FAILED: lib/utility/CMakeFiles/AGZUtils.dir/src/image/load_image.cpp.obj
C:\msys64\mingw64\bin\c++.exe -DAGZ_UTILS_SSE -IC:/msys64/home/Administrator/Atrc/lib/utility/include -IC:/msys64/home/Administrator/Atrc/lib/utility/ext/avir -O3 -DNDEBUG -std=gnu++17 -MD -MT lib/utility/CMakeFiles/AGZUtils.dir/src/image/load_image.cpp.obj -MF lib\utility\CMakeFiles\AGZUtils.dir\src\image\load_image.cpp.obj.d -o lib/utility/CMakeFiles/AGZUtils.dir/src/image/load_image.cpp.obj -c C:/msys64/home/Administrator/Atrc/lib/utility/src/image/load_image.cpp
In file included from C:/msys64/home/Administrator/Atrc/lib/utility/include/agz-utils/misc.h:23,
                 from C:/msys64/home/Administrator/Atrc/lib/utility/src/image/load_image.cpp:6:
C:/msys64/home/Administrator/Atrc/lib/utility/include/agz-utils/misc/unreachable.h: In function 'void agz::misc::unreachable()':
C:/msys64/home/Administrator/Atrc/lib/utility/include/agz-utils/misc/unreachable.h:12:5: error: '__assume' was not declared in this scope
   12 |     __assume(0);
      |     ^~~~~~~~
[62/169] Building CXX object lib/utility/CMakeFiles/AGZUtils.dir/src/mesh/tinyply.cpp.obj
[63/169] Building CXX object lib/utility/CMakeFiles/AGZUtils.dir/src/image/save_image.cpp.obj
[64/169] Building CXX object lib/spdlog/CMakeFiles/spdlog.dir/src/fmt.cpp.obj
[65/169] Building CXX object lib/spdlog/CMakeFiles/spdlog.dir/src/spdlog.cpp.obj
[66/169] Building CXX object lib/utility/CMakeFiles/AGZUtils.dir/src/mesh/load_mesh.cpp.obj
ninja: build stopped: subcommand failed.

ghost avatar Apr 19 '23 17:04 ghost