address-info

View Ticket
Login
Ticket Hash: dfda165c8cb2b434793e1a1bf699bd5ed9274c1d
Title: address-info doesn't compile on FreeBSD
Status: Closed Type: Build_Problem
Severity: Important Priority: Immediate
Subsystem: Resolution: Fixed
Last Modified: 2019-05-12 21:54:47
Version Found In: 1.0.0
User Comments:
anonymous added on 2018-01-17 09:45:08: (text/x-fossil-wiki)
<h1>Description</h1>
Can't install the 'openssl' egg, because the compilation of 'address-info' on FreeBSD fails (diff for the fix is at the bottom)

<h1>System</h1>
<pre>
/tmp/address-info⟩ uname -v                                                                                                                                   
FreeBSD 11.1-STABLE #2 r327415+2236b971aa20(stable/11): Mon Jan  1 08:40:18 CET 2018     root@main.locweb:/usr/obj/usr/src/sys/J 
</pre>

<h1>Build Error</h1>
<pre>
/tmp/address-info⟩ chicken-install -n                                                                                                                         
retrieving ...
checking platform for `address-info' ...
checking dependencies for `address-info' ...
install order:
("address-info")
installing address-info: ...
changing current directory to .
  '/usr/local/bin/csi' -bnq -setup-mode -e "(require-library setup-api)" -e "(import setup-api)" -e "(setup-error-handling)" -e "(extension-name-and-version '(\"address-info\" \"\"))" -e "(keep-intermediates #t)" -e "(setup-install-mode #f)" 'address-info.setup'
  '/usr/local/bin/csc' -feature compiling-extension -setup-mode -k   -s -O2 -d1 address-info.scm -j address-info
address-info.c:72:47: error: incomplete definition of type 'struct sockaddr_in'
  port = ((struct sockaddr_in *)info->ai_addr)->sin_port;
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
address-info.c:72:19: note: forward declaration of 'struct sockaddr_in'
  port = ((struct sockaddr_in *)info->ai_addr)->sin_port;
                  ^
address-info.c:75:48: error: incomplete definition of type 'struct sockaddr_in6'
  port = ((struct sockaddr_in6 *)info->ai_addr)->sin6_port;
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
address-info.c:75:19: note: forward declaration of 'struct sockaddr_in6'
  port = ((struct sockaddr_in6 *)info->ai_addr)->sin6_port;
                  ^
address-info.c:97:37: error: incomplete definition of type 'struct sockaddr_in'
  src = &((struct sockaddr_in *)src)->sin_addr;
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
address-info.c:97:19: note: forward declaration of 'struct sockaddr_in'
  src = &((struct sockaddr_in *)src)->sin_addr;
                  ^
address-info.c:98:9: error: invalid application of 'sizeof' to an incomplete type 'struct sockaddr_in'
  len = sizeof(struct sockaddr_in);
        ^     ~~~~~~~~~~~~~~~~~~~~
address-info.c:97:19: note: forward declaration of 'struct sockaddr_in'
  src = &((struct sockaddr_in *)src)->sin_addr;
                  ^
address-info.c:101:38: error: incomplete definition of type 'struct sockaddr_in6'
  src = &((struct sockaddr_in6 *)src)->sin6_addr;
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
address-info.c:101:19: note: forward declaration of 'struct sockaddr_in6'
  src = &((struct sockaddr_in6 *)src)->sin6_addr;
                  ^
address-info.c:102:9: error: invalid application of 'sizeof' to an incomplete type 'struct sockaddr_in6'
  len = sizeof(struct sockaddr_in6);
        ^     ~~~~~~~~~~~~~~~~~~~~~
address-info.c:101:19: note: forward declaration of 'struct sockaddr_in6'
  src = &((struct sockaddr_in6 *)src)->sin6_addr;
                  ^
6 errors generated.
</pre>

<h1>Fix</h1>
After apply this patch, i can install the 'openssl' egg and query 'https' sites with the 'http-client' egg.
<pre>
/tmp/address-info⟩ diff -u address-info.scm.orig address-info.scm                                                                                             
--- address-info.scm.orig	2018-01-17 10:29:02.007032000 +0100
+++ address-info.scm	2018-01-17 10:29:56.393419000 +0100
@@ -50,6 +50,7 @@
 # include <sys/socket.h>
 # include <netdb.h>
 # include <arpa/inet.h>
+# include <netinet/in.h>
 #endif
 <#
</pre>

murphy added on 2019-05-12 21:54:47: (text/x-fossil-plain)
Fixed in revision [a44b02628c]