Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to build #29

Open
ghost opened this issue Apr 7, 2023 · 5 comments
Open

Failed to build #29

ghost opened this issue Apr 7, 2023 · 5 comments

Comments

@ghost
Copy link

ghost commented Apr 7, 2023

$ 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!

@AirGuanZ
Copy link
Owner

AirGuanZ commented Apr 8, 2023

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

@ghost
Copy link
Author

ghost commented Apr 8, 2023

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
Copy link
Author

ghost commented Apr 8, 2023

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

@AirGuanZ
Copy link
Owner

AirGuanZ commented Apr 8, 2023

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.

@ghost
Copy link
Author

ghost commented Apr 19, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant