fuzziqersoftware / resource_dasm

Classic Mac OS resource fork and application disassembler, with reverse-engineering tools for specific applications
MIT License
113 stars 12 forks source link

Unable to build on Fedora 40 #79

Closed nolrinale closed 6 months ago

nolrinale commented 6 months ago

I keep receiving this error while trying to build the library in Fedora 40


[ 71%] Building CXX object CMakeFiles/dupe_finder.dir/src/dupe_finder.cc.o
/home/maria/scratchpad/resource_dasm/src/dupe_finder.cc: In function ‘int main(int, const char**)’:
/home/maria/scratchpad/resource_dasm/src/dupe_finder.cc:117:13: error: ‘find_if’ was not declared in this scope; did you mean ‘std::ranges::find_if’?
  117 |         if (find_if(input_filenames.begin(), input_filenames.end(), [&](auto s) { return !strcmp(s, argv[x]); }) == input_filenames.end())
      |             ^~~~~~~
      |             std::ranges::find_if
In file included from /usr/include/c++/14/tuple:44,
                 from /usr/include/c++/14/bits/uses_allocator_args.h:39,
                 from /usr/include/c++/14/bits/memory_resource.h:41,
                 from /usr/include/c++/14/string:67,
                 from /usr/include/c++/14/bitset:52,
                 from /home/maria/scratchpad/resource_dasm/src/ResourceIDs.hh:3,
                 from /home/maria/scratchpad/resource_dasm/src/Cli.hh:3,
                 from /home/maria/scratchpad/resource_dasm/src/dupe_finder.cc:3:
/usr/include/c++/14/bits/ranges_util.h:543:33: note: ‘std::ranges::find_if’ declared here
  543 |   inline constexpr __find_if_fn find_if{};
      |                                 ^~~~~~~
make[2]: *** [CMakeFiles/dupe_finder.dir/build.make:76: CMakeFiles/dupe_finder.dir/src/dupe_finder.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:307: CMakeFiles/dupe_finder.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
Kristine1975 commented 6 months ago

This could be because libc++ and libstdc++ include different headers "behind the scenes" (in other headers). Please try to add #include <algorithm> to the includes, that should fix it:

#include <stdio.h>

#include "Cli.hh"
#include "IndexFormats/Formats.hh"
#include "ResourceFile.hh"
#include "TextCodecs.hh"
#include <phosg/Filesystem.hh>
#include <algorithm>           // <===
#include <stdexcept>
#include <string>
#include <unordered_map>
#include <unordered_set>
nolrinale commented 6 months ago

Thank you Kristine, adding #include <algorithm> to the files RealmzGlobalData.hh and ResourceIDs.hh allowed the building process to complete

fuzziqersoftware commented 6 months ago

Thanks - I've added the include to both files.