Trying to compile mocxx on debian buster (latest stable) as described in README.md fails at either compiling or linking stage (both gcc or clang):
flo@tietokone:~/src/foreign/mocxx/build$ cmake ../ -GNinja -DCMAKE_BUILD_TYPE=Debug
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Mocxx 0.1.0
-- Configuring done
-- Generating done
-- Build files have been written to: /home/flo/src/foreign/mocxx/build
flo@tietokone:~/src/foreign/mocxx/build$ ninja
[1/3] Building CXX object test/CMakeFiles/test_mocxx.dir/TestBasics.cpp.o
FAILED: test/CMakeFiles/test_mocxx.dir/TestBasics.cpp.o
/usr/bin/c++ -I../include -I../test/include -I../vendor/catch/include -I../vendor/frida/linux/include -g -fdiagnostics-color=always -O0 -g -fno-inline-functions -fno-inline -std=gnu++17 -MD -MT test/CMakeFiles/test_mocxx.dir/TestBasics.cpp.o -MF test/CMakeFiles/test_mocxx.dir/TestBasics.cpp.o.d -o test/CMakeFiles/test_mocxx.dir/TestBasics.cpp.o -c ../test/TestBasics.cpp
In file included from ../test/TestBasics.cpp:3:
../include/mocxx/Mocxx.hpp:653:8: error: declaration of ‘bool mocxx::Mocxx::ResultGenerator(ResultGenerator&&, TargetResult (*)(TargetArgs ...))’ shadows template parameter
bool ResultGenerator(ResultGenerator&& generator,
^~~~~~~~~~~~~~~
../include/mocxx/Mocxx.hpp:650:12: note: template parameter ‘ResultGenerator’ declared here
template<typename ResultGenerator,
^~~~~~~~
../include/mocxx/Mocxx.hpp:686:8: error: declaration of ‘bool mocxx::Mocxx::ResultConstructor(TargetResult (*)(TargetArgs ...))’ shadows template parameter
bool ResultConstructor(TargetResult (*target)(TargetArgs...))
^~~~~~~~~~~~~~~~~
../include/mocxx/Mocxx.hpp:683:12: note: template parameter ‘ResultConstructor’ declared here
template<typename ResultConstructor,
^~~~~~~~
In file included from ../test/TestBasics.cpp:1:
../test/TestBasics.cpp: In function ‘void ____C_A_T_C_H____T_E_S_T____8()’:
../test/TestBasics.cpp:216:24: error: ‘std::filesystem’ has not been declared
REQUIRE_FALSE(std::filesystem::exists("doesn't exist"));
^~~~~~~~~~
../test/TestBasics.cpp:216:24: error: ‘std::filesystem’ has not been declared
REQUIRE_FALSE(std::filesystem::exists("doesn't exist"));
^~~~~~~~~~
../test/TestBasics.cpp:219:41: error: ‘filesystem’ in namespace ‘std’ does not name a type
REQUIRE(mocxx.Replace([](const std::filesystem::path& p) { return true; },
^~~~~~~~~~
../test/TestBasics.cpp:220:32: error: ‘std::filesystem’ has not been declared
std::filesystem::exists));
^~~~~~~~~~
../test/TestBasics.cpp: In lambda function:
../test/TestBasics.cpp:219:5: error: expected ‘{’ before ‘)’ token
REQUIRE(mocxx.Replace([](const std::filesystem::path& p) { return true; },
^~~~~~~
../test/TestBasics.cpp: In function ‘void ____C_A_T_C_H____T_E_S_T____8()’:
../test/TestBasics.cpp:219:5: error: no matching function for call to ‘mocxx::Mocxx::Replace(____C_A_T_C_H____T_E_S_T____8()::<lambda(int, int)>)’
In file included from ../test/TestBasics.cpp:3:
../include/mocxx/Mocxx.hpp:445:8: note: candidate: ‘template<bool isMember, class Replacement> bool mocxx::Mocxx::Replace(Replacement&&, std::conditional_t<isMember, decltype (mocxx::details::LambdaToMemberFunctionImpl((& Replacement::operator()))), decltype (mocxx::details::LambdaToFreeFunctionImpl((& Replacement::operator())))>)’
bool Replace(
^~~~~~~
../include/mocxx/Mocxx.hpp:445:8: note: template argument deduction/substitution failed:
In file included from ../test/TestBasics.cpp:1:
../test/TestBasics.cpp:219:5: note: candidate expects 2 arguments, 1 provided
REQUIRE(mocxx.Replace([](const std::filesystem::path& p) { return true; },
^~~~~~~
In file included from ../test/TestBasics.cpp:3:
../include/mocxx/Mocxx.hpp:495:8: note: candidate: ‘template<bool isMember, class Replacement> bool mocxx::Mocxx::Replace(Replacement&&, const string&)’
bool Replace(Replacement&& replacement, const std::string& target)
^~~~~~~
../include/mocxx/Mocxx.hpp:495:8: note: template argument deduction/substitution failed:
In file included from ../test/TestBasics.cpp:1:
../test/TestBasics.cpp:219:5: note: candidate expects 2 arguments, 1 provided
REQUIRE(mocxx.Replace([](const std::filesystem::path& p) { return true; },
^~~~~~~
../test/TestBasics.cpp:219:41: error: ‘filesystem’ in namespace ‘std’ does not name a type
REQUIRE(mocxx.Replace([](const std::filesystem::path& p) { return true; },
^~~~~~~~~~
../test/TestBasics.cpp:220:32: error: ‘std::filesystem’ has not been declared
std::filesystem::exists));
^~~~~~~~~~
../test/TestBasics.cpp: In lambda function:
../test/TestBasics.cpp:219:5: error: expected ‘{’ before ‘)’ token
REQUIRE(mocxx.Replace([](const std::filesystem::path& p) { return true; },
^~~~~~~
../test/TestBasics.cpp: In function ‘void ____C_A_T_C_H____T_E_S_T____8()’:
../test/TestBasics.cpp:219:5: error: no matching function for call to ‘mocxx::Mocxx::Replace(____C_A_T_C_H____T_E_S_T____8()::<lambda(int, int)>)’
In file included from ../test/TestBasics.cpp:3:
../include/mocxx/Mocxx.hpp:445:8: note: candidate: ‘template<bool isMember, class Replacement> bool mocxx::Mocxx::Replace(Replacement&&, std::conditional_t<isMember, decltype (mocxx::details::LambdaToMemberFunctionImpl((& Replacement::operator()))), decltype (mocxx::details::LambdaToFreeFunctionImpl((& Replacement::operator())))>)’
bool Replace(
^~~~~~~
../include/mocxx/Mocxx.hpp:445:8: note: template argument deduction/substitution failed:
In file included from ../test/TestBasics.cpp:1:
../test/TestBasics.cpp:219:5: note: candidate expects 2 arguments, 1 provided
REQUIRE(mocxx.Replace([](const std::filesystem::path& p) { return true; },
^~~~~~~
In file included from ../test/TestBasics.cpp:3:
../include/mocxx/Mocxx.hpp:495:8: note: candidate: ‘template<bool isMember, class Replacement> bool mocxx::Mocxx::Replace(Replacement&&, const string&)’
bool Replace(Replacement&& replacement, const std::string& target)
^~~~~~~
../include/mocxx/Mocxx.hpp:495:8: note: template argument deduction/substitution failed:
In file included from ../test/TestBasics.cpp:1:
../test/TestBasics.cpp:219:5: note: candidate expects 2 arguments, 1 provided
REQUIRE(mocxx.Replace([](const std::filesystem::path& p) { return true; },
^~~~~~~
../test/TestBasics.cpp:220:52: error: expected ‘)’ before ‘;’ token
std::filesystem::exists));
^
In file included from ../test/TestBasics.cpp:1:
../test/TestBasics.cpp:219:5: note: to match this ‘(’
REQUIRE(mocxx.Replace([](const std::filesystem::path& p) { return true; },
^~~~~~~
../test/TestBasics.cpp:222:18: error: ‘std::filesystem’ has not been declared
REQUIRE(std::filesystem::exists("how about now?"));
^~~~~~~~~~
../test/TestBasics.cpp:222:18: error: ‘std::filesystem’ has not been declared
REQUIRE(std::filesystem::exists("how about now?"));
^~~~~~~~~~
../test/TestBasics.cpp:226:12: error: ‘std::filesystem’ has not been declared
std::filesystem::exists("another overload still active", error));
^~~~~~~~~~
../test/TestBasics.cpp:226:12: error: ‘std::filesystem’ has not been declared
std::filesystem::exists("another overload still active", error));
^~~~~~~~~~
[2/3] Building CXX object test/CMakeFiles/test_mocxx.dir/Main.cpp.o
ninja: build stopped: subcommand failed.
flo@tietokone:~/src/foreign/mocxx/build$ cd ..
flo@tietokone:~/src/foreign/mocxx$ rm -r build
flo@tietokone:~/src/foreign/mocxx$ mkdir build; cd build
flo@tietokone:~/src/foreign/mocxx/build$ export CC=/usr/bin/clang
flo@tietokone:~/src/foreign/mocxx/build$ export CXX=/usr/bin/clang++
flo@tietokone:~/src/foreign/mocxx/build$ cmake ../ -GNinja -DCMAKE_BUILD_TYPE=Debug
-- The C compiler identification is Clang 7.0.1
-- The CXX compiler identification is Clang 7.0.1
-- Check for working C compiler: /usr/bin/clang
-- Check for working C compiler: /usr/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/clang++
-- Check for working CXX compiler: /usr/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Mocxx 0.1.0
-- Configuring done
-- Generating done
-- Build files have been written to: /home/flo/src/foreign/mocxx/build
flo@tietokone:~/src/foreign/mocxx/build$ ninja
[3/3] Linking CXX executable test/test_mocxx
FAILED: test/test_mocxx
: && /usr/bin/clang++ -g -lresolv -lpthread -ldl test/CMakeFiles/test_mocxx.dir/Main.cpp.o test/CMakeFiles/test_mocxx.dir/TestBasics.cpp.o -o test/test_mocxx ../vendor/frida/linux/lib/libfrida-gum.a && :
/usr/bin/ld: test/CMakeFiles/test_mocxx.dir/TestBasics.cpp.o: in function `std::filesystem::exists(std::filesystem::__cxx11::path const&)':
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/fs_ops.h:121: undefined reference to `std::filesystem::status(std::filesystem::__cxx11::path const&)'
/usr/bin/ld: test/CMakeFiles/test_mocxx.dir/TestBasics.cpp.o: in function `path<char [14], std::filesystem::__cxx11::path>':
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/fs_path.h:184: undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: test/CMakeFiles/test_mocxx.dir/TestBasics.cpp.o: in function `path<char [15], std::filesystem::__cxx11::path>':
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/fs_path.h:184: undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: test/CMakeFiles/test_mocxx.dir/TestBasics.cpp.o: in function `std::filesystem::exists(std::filesystem::__cxx11::path const&, std::error_code&)':
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/fs_ops.h:126: undefined reference to `std::filesystem::status(std::filesystem::__cxx11::path const&, std::error_code&)'
/usr/bin/ld: test/CMakeFiles/test_mocxx.dir/TestBasics.cpp.o: in function `path<char [30], std::filesystem::__cxx11::path>':
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/fs_path.h:184: undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
Trying to compile mocxx on debian buster (latest stable) as described in README.md fails at either compiling or linking stage (both gcc or clang):