Skip to content

invalid use of incomplete type ‘struct ares_addrinfo_hints’ #346

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

Closed
t348575 opened this issue Aug 5, 2024 · 2 comments
Closed

invalid use of incomplete type ‘struct ares_addrinfo_hints’ #346

t348575 opened this issue Aug 5, 2024 · 2 comments

Comments

@t348575
Copy link

t348575 commented Aug 5, 2024

I'm trying to build drogon but I'm getting a compilation error in trantor. I followed the standard environment setup and build steps provided in the docs (using cmake). A separate clone of trantor on the latest release tag gives the same build error.

My environment:
OS: debian (WSL) (kernel 5.15)
Compiler: Tried both GCC 12 & Clang 16

/my_project/drogon/trantor/trantor/net/inner/AresResolver.cc: In constructor ‘trantor::AresResolver::LibraryInitializer::LibraryInitializer()’:
/my_project/drogon/trantor/trantor/net/inner/AresResolver.cc:56:18: error: invalid use of incomplete type ‘struct ares_addrinfo_hints’
   56 |     hints_ = new ares_addrinfo_hints;
      |                  ^~~~~~~~~~~~~~~~~~~
In file included from /my_project/drogon/trantor/trantor/net/inner/AresResolver.cc:8:
/my_project/drogon/trantor/trantor/net/inner/AresResolver.h:20:12: note: forward declaration of ‘struct ares_addrinfo_hints’
   20 |     struct ares_addrinfo_hints;
      |            ^~~~~~~~~~~~~~~~~~~
/my_project/drogon/trantor/trantor/net/inner/AresResolver.cc:57:11: error: invalid use of incomplete type ‘struct ares_addrinfo_hints’
   57 |     hints_->ai_flags = 0;
      |           ^~
/my_project/drogon/trantor/trantor/net/inner/AresResolver.h:20:12: note: forward declaration of ‘struct ares_addrinfo_hints’
   20 |     struct ares_addrinfo_hints;
      |            ^~~~~~~~~~~~~~~~~~~
/my_project/drogon/trantor/trantor/net/inner/AresResolver.cc:58:11: error: invalid use of incomplete type ‘struct ares_addrinfo_hints’
   58 |     hints_->ai_family = AF_INET;
      |           ^~
/my_project/drogon/trantor/trantor/net/inner/AresResolver.h:20:12: note: forward declaration of ‘struct ares_addrinfo_hints’
   20 |     struct ares_addrinfo_hints;
      |            ^~~~~~~~~~~~~~~~~~~
/my_project/drogon/trantor/trantor/net/inner/AresResolver.cc:59:11: error: invalid use of incomplete type ‘struct ares_addrinfo_hints’
   59 |     hints_->ai_socktype = 0;
      |           ^~
/my_project/drogon/trantor/trantor/net/inner/AresResolver.h:20:12: note: forward declaration of ‘struct ares_addrinfo_hints’
   20 |     struct ares_addrinfo_hints;
      |            ^~~~~~~~~~~~~~~~~~~
/my_project/drogon/trantor/trantor/net/inner/AresResolver.cc:60:11: error: invalid use of incomplete type ‘struct ares_addrinfo_hints’
   60 |     hints_->ai_protocol = 0;
      |           ^~
/my_project/drogon/trantor/trantor/net/inner/AresResolver.h:20:12: note: forward declaration of ‘struct ares_addrinfo_hints’
   20 |     struct ares_addrinfo_hints;
      |            ^~~~~~~~~~~~~~~~~~~
/my_project/drogon/trantor/trantor/net/inner/AresResolver.cc: In destructor ‘trantor::AresResolver::LibraryInitializer::~LibraryInitializer()’:
/my_project/drogon/trantor/trantor/net/inner/AresResolver.cc:65:5: error: possible problem detected in invocation of ‘operator delete’ [-Werror=delete-incomplete]
   65 |     delete hints_;
      |     ^~~~~~~~~~~~~
/my_project/drogon/trantor/trantor/net/inner/AresResolver.cc:65:12: error: invalid use of incomplete type ‘struct ares_addrinfo_hints’ [-Werror]
   65 |     delete hints_;
      |            ^~~~~~
/my_project/drogon/trantor/trantor/net/inner/AresResolver.h:20:12: note: forward declaration of ‘struct ares_addrinfo_hints’
   20 |     struct ares_addrinfo_hints;
      |            ^~~~~~~~~~~~~~~~~~~
/my_project/drogon/trantor/trantor/net/inner/AresResolver.cc:65:5: note: neither the destructor nor the class-specific ‘operator delete’ will be called, even if they are declared when the class is defined
   65 |     delete hints_;
      |     ^~~~~~~~~~~~~
/my_project/drogon/trantor/trantor/net/inner/AresResolver.cc: In member function ‘void trantor::AresResolver::resolveInLoop(const std::string&, const trantor::Resolver::ResolverResultsCallback&)’:
/my_project/drogon/trantor/trantor/net/inner/AresResolver.cc:134:5: error: ‘ares_getaddrinfo’ was not declared in this scope; did you mean ‘ares_addrinfo’?
  134 |     ares_getaddrinfo(ctx_,
      |     ^~~~~~~~~~~~~~~~
      |     ares_addrinfo
/my_project/drogon/trantor/trantor/net/inner/AresResolver.cc: In member function ‘void trantor::AresResolver::onQueryResult(int, ares_addrinfo*, const std::string&, const trantor::Resolver::ResolverResultsCallback&)’:
/my_project/drogon/trantor/trantor/net/inner/AresResolver.cc:185:55: error: invalid use of incomplete type ‘struct ares_addrinfo’
  185 |         auto pptr = (struct ares_addrinfo_node*)result->nodes;
      |                                                       ^~
/my_project/drogon/trantor/trantor/net/inner/AresResolver.h:18:12: note: forward declaration of ‘struct ares_addrinfo’
   18 |     struct ares_addrinfo;
@RushOnline
Copy link

hello, did you have a solutuion?

@t348575
Copy link
Author

t348575 commented May 3, 2025

Yea it was a weird issue with dependencies. Doing a clean install of all dependencies fixed it

@t348575 t348575 closed this as completed May 3, 2025
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

2 participants