koolkdev / wfs-tools

WFS (WiiU File System) Tools
MIT License
55 stars 5 forks source link

Compile errors on MacOS related to std:: lib #3

Closed benoror closed 7 months ago

benoror commented 2 years ago

Getting the following kind of failures while trying to compile on MacOS:

/Users/benoror/code/wfs-tools/wfslib/src/utils.h:15:43: error: no member named 'bit_width' in namespace 'std'
  return static_cast<size_t>(1ULL << std::bit_width(size - 1));
/Users/benoror/code/wfs-tools/wfslib/src/wfs.cpp:95:12: error: no member named 'popcount' in namespace 'std'; did you mean '__popcount'?
  if (std::popcount(xored_sector_size) != 1) {
      ~~~~~^~~~~~~~
           __popcount
/Users/benoror/code/wfs-tools/wfslib/src/directory.cpp:150:10: error: no matching function for call to 'distance'
  return std::distance(begin(), end());
         ^~~~~~~~~~~~~

Any hint would be appreciated!

koolkdev commented 2 years ago

Hey, it seems that you use an old version of clang (as it doesn't support bit_width/popcount), but sadly even the new versions of clang are missing some of C++20 features that this project use. For mac currently GCC 12.0 is required which should be official released in about two months. (Once it is released you can simply install it with brew)

Right now you will have to build the version of wfs tools from before the refactor: commit f0256259a8f396e234543e7615c42fe4836b486f @ wfslib

benoror commented 1 year ago

Hi! When checking out commit f0256259a8f396e234543e7615c42fe4836b486f in git submodule wfslib I get the following error:

Screen Shot 2022-11-27 at 19 29 05
Preset CMake variables:

  CMAKE_MODULE_PATH="/Users/benoror/code/benoror/wfs-tools/cmake"
  CMAKE_TOOLCHAIN_FILE:FILEPATH="/Users/benoror/code/benoror/wfs-tools/vcpkg/scripts/buildsystems/vcpkg.cmake"

-- Running vcpkg install
Detecting compiler hash for triplet x64-osx...
All requested packages are currently installed.
Restored 0 package(s) from /Users/benoror/.cache/vcpkg/archives in 27.76 us. Use --debug to see more details.
Total install time: 90.37 us
The package boost is compatible with built-in CMake targets:

    find_package(Boost REQUIRED [COMPONENTS <libs>...])
    target_link_libraries(main PRIVATE Boost::boost Boost::<lib1> Boost::<lib2> ...)

cryptopp provides CMake targets:

    # this is heuristically generated, and may not be correct
    find_package(cryptopp CONFIG REQUIRED)
    target_link_libraries(main PRIVATE cryptopp::cryptopp)

-- Running vcpkg install - done
CMake Error at CMakeLists.txt:5 (add_subdirectory):
  The source directory

    /Users/benoror/code/benoror/wfs-tools/wfslib

  does not contain a CMakeLists.txt file.

CMake Error at wfs-extract/CMakeLists.txt:17 (get_property):
  get_property could not find TARGET wfslib.  Perhaps it has not yet been
  created.

CMake Error at wfs-file-injector/CMakeLists.txt:17 (get_property):
  get_property could not find TARGET wfslib.  Perhaps it has not yet been
  created.

CMake Error at wfs-fuse/CMakeLists.txt:22 (get_property):
  get_property could not find TARGET wfslib.  Perhaps it has not yet been
  created.

-- Configuring incomplete, errors occurred!
See also "/Users/benoror/code/benoror/wfs-tools/build/default/CMakeFiles/CMakeOutput.log".
See also "/Users/benoror/code/benoror/wfs-tools/build/default/CMakeFiles/CMakeError.log".
benoror commented 1 year ago

gcc/g++ seems to be up to date

Screen Shot 2022-11-27 at 19 32 21 Screen Shot 2022-11-27 at 19 34 55
koolkdev commented 1 year ago

Hi! When checking out commit f0256259a8f396e234543e7615c42fe4836b486f in git submodule wfslib I get the following error:

Screen Shot 2022-11-27 at 19 29 05
Preset CMake variables:

  CMAKE_MODULE_PATH="/Users/benoror/code/benoror/wfs-tools/cmake"
  CMAKE_TOOLCHAIN_FILE:FILEPATH="/Users/benoror/code/benoror/wfs-tools/vcpkg/scripts/buildsystems/vcpkg.cmake"

-- Running vcpkg install
Detecting compiler hash for triplet x64-osx...
All requested packages are currently installed.
Restored 0 package(s) from /Users/benoror/.cache/vcpkg/archives in 27.76 us. Use --debug to see more details.
Total install time: 90.37 us
The package boost is compatible with built-in CMake targets:

    find_package(Boost REQUIRED [COMPONENTS <libs>...])
    target_link_libraries(main PRIVATE Boost::boost Boost::<lib1> Boost::<lib2> ...)

cryptopp provides CMake targets:

    # this is heuristically generated, and may not be correct
    find_package(cryptopp CONFIG REQUIRED)
    target_link_libraries(main PRIVATE cryptopp::cryptopp)

-- Running vcpkg install - done
CMake Error at CMakeLists.txt:5 (add_subdirectory):
  The source directory

    /Users/benoror/code/benoror/wfs-tools/wfslib

  does not contain a CMakeLists.txt file.

CMake Error at wfs-extract/CMakeLists.txt:17 (get_property):
  get_property could not find TARGET wfslib.  Perhaps it has not yet been
  created.

CMake Error at wfs-file-injector/CMakeLists.txt:17 (get_property):
  get_property could not find TARGET wfslib.  Perhaps it has not yet been
  created.

CMake Error at wfs-fuse/CMakeLists.txt:22 (get_property):
  get_property could not find TARGET wfslib.  Perhaps it has not yet been
  created.

-- Configuring incomplete, errors occurred!
See also "/Users/benoror/code/benoror/wfs-tools/build/default/CMakeFiles/CMakeOutput.log".
See also "/Users/benoror/code/benoror/wfs-tools/build/default/CMakeFiles/CMakeError.log".

Hey, that revision is incompatible with wfs-tools repository. It was built on its own, it contains all the tools (there are instructions in the readme file in it)

gcc/g++ seems to be up to date

Screen Shot 2022-11-27 at 19 32 21 Screen Shot 2022-11-27 at 19 34 55

Notice that gcc is Apple clang.and not the gcc installed from brew. You will have to set CC and CXX to the gcc/g++ binaries installed by brew

koolkdev commented 7 months ago

closing as it can be built on mac