Skip to content
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

Compiling problem on FreeBSD #109

Open
sakai366 opened this issue Jul 22, 2024 · 3 comments
Open

Compiling problem on FreeBSD #109

sakai366 opened this issue Jul 22, 2024 · 3 comments

Comments

@sakai366
Copy link

A compiling problem occurs due to missing #include <netinet/in.h> in src/random.cpp.
Will you fix the source?

diff --git a/src/random.cpp b/src/random.cpp
index c87170b..872d418 100644
--- a/src/random.cpp
+++ b/src/random.cpp
@@ -81,6 +81,7 @@ static uint64_t hash_machine_identifier () {
 #ifndef __WIN32
 
 extern "C" {
+#include <netinet/in.h>
 #include <ifaddrs.h>
 #include <netdb.h>
 #include <stdio.h>
@m-fleury
Copy link
Collaborator

What is the compilation issue? I assume that some type is not defined on FreeBSD, but which one?

@sakai366
Copy link
Author

The current code in master branch causes the following compile error on FreeBSD:

g++ -Wall -Wextra -O3 -DNDEBUG -I../build -I/home/fs6/sakai/proj/naps/cadical/src -c /home/fs6/sakai/proj/naps/cadical/src/random.cpp -o src/random.o
/home/fs6/sakai/proj/naps/cadical/src/random.cpp: In function 'uint64_t CaDiCaL::hash_network_addresses()':
/home/fs6/sakai/proj/naps/cadical/src/random.cpp:112:48: error: invalid application of 'sizeof' to incomplete type 'CaDiCaL::hash_network_addresses()::sockaddr_in'
  112 |         const int size = (family == AF_INET) ? sizeof (struct sockaddr_in)
      |                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/fs6/sakai/proj/naps/cadical/src/random.cpp:113:48: error: invalid application of 'sizeof' to incomplete type 'CaDiCaL::hash_network_addresses()::sockaddr_in6'
  113 |                                              : sizeof (struct sockaddr_in6);
      |                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

@m-fleury
Copy link
Collaborator

m-fleury commented Jul 28, 2024

Seems to be a freebsd thing: on linux and openbsd, netdb.h actually includes netinet/in.h but not on freebsd https://github.com/OpenOrbis/freebsd-headers/blob/master/include/lwres/netdb.h.

The next release should include the missing import.

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