chrisstaite / DoTe

A simple DNS wrapping server to forward UDP requests to a DNS over TLS server
MIT License
43 stars 4 forks source link

Build error: 'time_t' has not been declared #14

Closed rampageX closed 3 years ago

rampageX commented 3 years ago

hardware: armv5 based router system: freshtomato build system: tomatoware native

uname -a
Linux netgear 2.6.36.4brcmarm #7 SMP PREEMPT Wed Aug 11 16:39:01 CEST 2021 armv7l GNU/Linux
cmake -version
cmake version 3.20.5

build log:

[T][netgear:/tmp/mnt/data/compile/DoTe/b]$ cmake ..
CMake Deprecation Warning at CMakeLists.txt:2 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- The CXX compiler identification is GNU 10.3.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /mmc/bin/distcc - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The C compiler identification is GNU 10.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /mmc/bin/distcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found OpenSSL: /mmc/lib/libcrypto.so (found version "1.1.1l")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /mnt/data/compile/DoTe/b
[T][netgear:/tmp/mnt/data/compile/DoTe/b]$ make
[  1%] Building CXX object CMakeFiles/dote_static.dir/src/openssl/ssl_factory.cpp.o
[  3%] Building CXX object CMakeFiles/dote_static.dir/src/openssl/context.cpp.o
[  5%] Building CXX object CMakeFiles/dote_static.dir/src/openssl/ssl_connection.cpp.o
[  7%] Building CXX object CMakeFiles/dote_static.dir/src/openssl/hostname_verifier.cpp.o
[  9%] Building CXX object CMakeFiles/dote_static.dir/src/openssl/spki_verifier.cpp.o
[ 11%] Building CXX object CMakeFiles/dote_static.dir/src/openssl/certificate_utilities.cpp.o
[ 12%] Building CXX object CMakeFiles/dote_static.dir/src/openssl/base64.cpp.o
[ 14%] Building CXX object CMakeFiles/dote_static.dir/src/socket.cpp.o
[ 16%] Building CXX object CMakeFiles/dote_static.dir/src/forwarder_connection.cpp.o
[ 18%] Building CXX object CMakeFiles/dote_static.dir/src/forwarder_config.cpp.o
[ 20%] Building CXX object CMakeFiles/dote_static.dir/src/client_forwarders.cpp.o
[ 22%] Building CXX object CMakeFiles/dote_static.dir/src/verify_cache.cpp.o
[ 24%] Building CXX object CMakeFiles/dote_static.dir/src/loop.cpp.o
distcc[12793] ERROR: compile /mnt/data/compile/DoTe/src/loop.cpp on 192.168.2.20 failed
distcc[12793] (dcc_build_somewhere) Warning: remote compilation of '/mnt/data/compile/DoTe/src/loop.cpp' failed, retrying locally
distcc[12793] Warning: failed to distribute /mnt/data/compile/DoTe/src/loop.cpp to 192.168.2.20, running locally instead
In file included from /mnt/data/compile/DoTe/include/loop.h:4,
                 from /mnt/data/compile/DoTe/src/loop.cpp:2:
/mnt/data/compile/DoTe/include/i_loop.h:25:62: error: 'time_t' has not been declared
   25 |     virtual bool registerRead(int handle, Callback callback, time_t timeout) = 0;
      |                                                              ^~~~~~
/mnt/data/compile/DoTe/include/i_loop.h:34:63: error: 'time_t' has not been declared
   34 |     virtual bool registerWrite(int handle, Callback callback, time_t timeout) = 0;
      |                                                               ^~~~~~
In file included from /mnt/data/compile/DoTe/src/loop.cpp:2:
/mnt/data/compile/DoTe/include/loop.h:36:54: error: 'time_t' has not been declared
   36 |     bool registerRead(int handle, Callback callback, time_t timeout) override;
      |                                                      ^~~~~~
/mnt/data/compile/DoTe/include/loop.h:45:55: error: 'time_t' has not been declared
   45 |     bool registerWrite(int handle, Callback callback, time_t timeout) override;
      |                                                       ^~~~~~
/mnt/data/compile/DoTe/include/loop.h:76:49: error: 'time_t' was not declared in this scope; did you mean 'size_t'?
   76 |         const std::map<int, std::pair<Callback, time_t>>& functions,
      |                                                 ^~~~~~
      |                                                 size_t
/mnt/data/compile/DoTe/include/loop.h:76:49: error: template argument 2 is invalid
/mnt/data/compile/DoTe/include/loop.h:76:55: error: template argument 2 is invalid
   76 |         const std::map<int, std::pair<Callback, time_t>>& functions,
      |                                                       ^~
/mnt/data/compile/DoTe/include/loop.h:76:55: error: template argument 4 is invalid
/mnt/data/compile/DoTe/include/loop.h:85:5: error: 'time_t' does not name a type; did you mean 'size_t'?
   85 |     time_t timeout(time_t now, std::map<int, std::pair<Callback, time_t>>& functions);
      |     ^~~~~~
      |     size_t
/mnt/data/compile/DoTe/include/loop.h:128:39: error: 'time_t' was not declared in this scope; did you mean 'timeout'?
  128 |     std::map<int, std::pair<Callback, time_t>> m_readFunctions;
      |                                       ^~~~~~
      |                                       timeout
/mnt/data/compile/DoTe/include/loop.h:128:39: error: template argument 2 is invalid
/mnt/data/compile/DoTe/include/loop.h:128:45: error: template argument 2 is invalid
  128 |     std::map<int, std::pair<Callback, time_t>> m_readFunctions;
      |                                             ^~
/mnt/data/compile/DoTe/include/loop.h:128:45: error: template argument 4 is invalid
/mnt/data/compile/DoTe/include/loop.h:130:39: error: 'time_t' was not declared in this scope; did you mean 'timeout'?
  130 |     std::map<int, std::pair<Callback, time_t>> m_writeFunctions;
      |                                       ^~~~~~
      |                                       timeout
/mnt/data/compile/DoTe/include/loop.h:130:39: error: template argument 2 is invalid
/mnt/data/compile/DoTe/include/loop.h:130:45: error: template argument 2 is invalid
  130 |     std::map<int, std::pair<Callback, time_t>> m_writeFunctions;
      |                                             ^~
/mnt/data/compile/DoTe/include/loop.h:130:45: error: template argument 4 is invalid
/mnt/data/compile/DoTe/src/loop.cpp: In member function 'void dote::Loop::populateFds(std::vector<pollfd>&)':
/mnt/data/compile/DoTe/src/loop.cpp:40:45: error: no matching function for call to 'dote::Loop::popluateFds(std::vector<pollfd>&, int&, int)'
   40 |     popluateFds(fds, m_readFunctions, POLLIN);
      |                                             ^
In file included from /mnt/data/compile/DoTe/src/loop.cpp:2:
/mnt/data/compile/DoTe/include/loop.h:113:17: note: candidate: 'template<class T> static void dote::Loop::popluateFds(std::vector<pollfd>&, const std::map<int, T>&, short int)'
  113 |     static void popluateFds(std::vector<pollfd>& fds,
      |                 ^~~~~~~~~~~
/mnt/data/compile/DoTe/include/loop.h:113:17: note:   template argument deduction/substitution failed:
/mnt/data/compile/DoTe/src/loop.cpp:40:45: note:   mismatched types 'const std::map<int, T>' and 'int'
   40 |     popluateFds(fds, m_readFunctions, POLLIN);
      |                                             ^
/mnt/data/compile/DoTe/src/loop.cpp:41:47: error: no matching function for call to 'dote::Loop::popluateFds(std::vector<pollfd>&, int&, int)'
   41 |     popluateFds(fds, m_writeFunctions, POLLOUT);
      |                                               ^
In file included from /mnt/data/compile/DoTe/src/loop.cpp:2:
/mnt/data/compile/DoTe/include/loop.h:113:17: note: candidate: 'template<class T> static void dote::Loop::popluateFds(std::vector<pollfd>&, const std::map<int, T>&, short int)'
  113 |     static void popluateFds(std::vector<pollfd>& fds,
      |                 ^~~~~~~~~~~
/mnt/data/compile/DoTe/include/loop.h:113:17: note:   template argument deduction/substitution failed:
/mnt/data/compile/DoTe/src/loop.cpp:41:47: note:   mismatched types 'const std::map<int, T>' and 'int'
   41 |     popluateFds(fds, m_writeFunctions, POLLOUT);
      |                                               ^
/mnt/data/compile/DoTe/src/loop.cpp: At global scope:
/mnt/data/compile/DoTe/src/loop.cpp:93:6: error: no declaration matches 'void dote::Loop::callCallback(const std::map<int, std::pair<std::function<void(int)>, long int> >&, int)'
   93 | void Loop::callCallback(
      |      ^~~~
In file included from /mnt/data/compile/DoTe/src/loop.cpp:2:
/mnt/data/compile/DoTe/include/loop.h:75:17: note: candidate is: 'static void dote::Loop::callCallback(const int&, int)'
   75 |     static void callCallback(
      |                 ^~~~~~~~~~~~
/mnt/data/compile/DoTe/include/loop.h:14:7: note: 'class dote::Loop' defined here
   14 | class Loop : public ILoop
      |       ^~~~
/mnt/data/compile/DoTe/src/loop.cpp:104:6: error: no declaration matches 'bool dote::Loop::registerRead(int, dote::ILoop::Callback, time_t)'
  104 | bool Loop::registerRead(int handle, Callback callback, time_t timeout)
      |      ^~~~
In file included from /mnt/data/compile/DoTe/src/loop.cpp:2:
/mnt/data/compile/DoTe/include/loop.h:36:10: note: candidate is: 'virtual bool dote::Loop::registerRead(int, dote::ILoop::Callback, int)'
   36 |     bool registerRead(int handle, Callback callback, time_t timeout) override;
      |          ^~~~~~~~~~~~
/mnt/data/compile/DoTe/include/loop.h:14:7: note: 'class dote::Loop' defined here
   14 | class Loop : public ILoop
      |       ^~~~
/mnt/data/compile/DoTe/src/loop.cpp:115:6: error: no declaration matches 'bool dote::Loop::registerWrite(int, dote::ILoop::Callback, time_t)'
  115 | bool Loop::registerWrite(int handle, Callback callback, time_t timeout)
      |      ^~~~
In file included from /mnt/data/compile/DoTe/src/loop.cpp:2:
/mnt/data/compile/DoTe/include/loop.h:45:10: note: candidate is: 'virtual bool dote::Loop::registerWrite(int, dote::ILoop::Callback, int)'
   45 |     bool registerWrite(int handle, Callback callback, time_t timeout) override;
      |          ^~~~~~~~~~~~~
/mnt/data/compile/DoTe/include/loop.h:14:7: note: 'class dote::Loop' defined here
   14 | class Loop : public ILoop
      |       ^~~~
/mnt/data/compile/DoTe/src/loop.cpp: In member function 'virtual void dote::Loop::removeRead(int)':
/mnt/data/compile/DoTe/src/loop.cpp:140:21: error: request for member 'erase' in '((dote::Loop*)this)->dote::Loop::m_readFunctions', which is of non-class type 'int'
  140 |     m_readFunctions.erase(handle);
      |                     ^~~~~
/mnt/data/compile/DoTe/src/loop.cpp: In member function 'virtual void dote::Loop::removeWrite(int)':
/mnt/data/compile/DoTe/src/loop.cpp:145:22: error: request for member 'erase' in '((dote::Loop*)this)->dote::Loop::m_writeFunctions', which is of non-class type 'int'
  145 |     m_writeFunctions.erase(handle);
      |                      ^~~~~
/mnt/data/compile/DoTe/src/loop.cpp: At global scope:
/mnt/data/compile/DoTe/src/loop.cpp:153:8: error: no declaration matches 'time_t dote::Loop::timeout(time_t, std::map<int, std::pair<std::function<void(int)>, long int> >&)'
  153 | time_t Loop::timeout(time_t now, std::map<int, std::pair<Callback, time_t>>& functions)
      |        ^~~~
In file included from /mnt/data/compile/DoTe/src/loop.cpp:2:
/mnt/data/compile/DoTe/include/loop.h:90:9: note: candidate is: 'int dote::Loop::timeout()'
   90 |     int timeout();
      |         ^~~~~~~
/mnt/data/compile/DoTe/include/loop.h:14:7: note: 'class dote::Loop' defined here
   14 | class Loop : public ILoop
      |       ^~~~
/mnt/data/compile/DoTe/src/loop.cpp: In member function 'int dote::Loop::timeout()':
/mnt/data/compile/DoTe/src/loop.cpp:188:55: error: no matching function for call to 'dote::Loop::timeout(time_t&, int&)'
  188 |     time_t earliestRead = timeout(now, m_readFunctions);
      |                                                       ^
/mnt/data/compile/DoTe/src/loop.cpp:185:5: note: candidate: 'int dote::Loop::timeout()'
  185 | int Loop::timeout()
      |     ^~~~
/mnt/data/compile/DoTe/src/loop.cpp:185:5: note:   candidate expects 0 arguments, 2 provided
/mnt/data/compile/DoTe/src/loop.cpp:189:57: error: no matching function for call to 'dote::Loop::timeout(time_t&, int&)'
  189 |     time_t earliestWrite = timeout(now, m_writeFunctions);
      |                                                         ^
/mnt/data/compile/DoTe/src/loop.cpp:185:5: note: candidate: 'int dote::Loop::timeout()'
  185 | int Loop::timeout()
      |     ^~~~
/mnt/data/compile/DoTe/src/loop.cpp:185:5: note:   candidate expects 0 arguments, 2 provided
distcc[12793] ERROR: compile /mnt/data/compile/DoTe/src/loop.cpp on localhost failed
make[2]: *** [CMakeFiles/dote_static.dir/build.make:244: CMakeFiles/dote_static.dir/src/loop.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:115: CMakeFiles/dote_static.dir/all] Error 2
make: *** [Makefile:101: all] Error 2
chrisstaite commented 3 years ago

I've added the header, see if that sorts it.