[erlang-patches] Make Erlang compile on FreeBSD 6.3

Akira Kitada <>
Sun Oct 12 03:22:29 CEST 2008


To build R12B-4 on FreeBSD 6.3, I had to apply the following patches.
Your can reproduce this problem by simply invoking "./configure
--enable-threads --enable-dynamic-ssl-lib && gmake"
(If you run configure without arguments, the build will fail, but
that's another story)

(1) gethostbyname_r argument
[Problem]
gcc  -g -O2 -DEI_64BIT -fPIC -Wall -Wstrict-prototypes
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline
-fno-strict-aliasing -I. -I../include -Iconnect -Iencode -Idecode
-Imisc -Iepmd -Iregistry -Ix86_64-unknown-freebsd6.3   -D_REENTRANT
-D_THREAD_SAFE -DPOSIX_THREADS -c connect/ei_resolve.c -o
/home/akira/src/otp_src_R12B-4/lib/erl_interface/obj.mt/x86_64-unknown-freebsd6.3/ei_resolve.o
connect/ei_resolve.c: In function `ei_gethostbyname_r':
connect/ei_resolve.c:629: warning: passing arg 5 of `gethostbyname_r'
from incompatible pointer type
connect/ei_resolve.c:629: error: too few arguments to function `gethostbyname_r'
connect/ei_resolve.c:629: warning: return makes pointer from integer
without a cast

[Fix]
--- lib/erl_interface/src/connect/ei_resolve.c.orig     2008-10-12
08:41:50.000000000 +0900
+++ lib/erl_interface/src/connect/ei_resolve.c  2008-10-12
08:42:23.000000000 +0900
@@ -619,7 +619,7 @@
 #ifndef HAVE_GETHOSTBYNAME_R
   return my_gethostbyname_r(name,hostp,buffer,buflen,h_errnop);
 #else
-#ifdef __GLIBC__
+#if (defined(__GLIBC__) || (__FreeBSD_version >= 602000))
   struct hostent *result;

   gethostbyname_r(name, hostp, buffer, buflen, &result, h_errnop);


(2) Type of get_extended_mem

[Problem]
gcc -c -o ../priv/obj/x86_64-unknown-freebsd6.3/memsup.o -g -O2
-I/home/akira/src/otp_src_R12B-4/erts/x86_64-unknown-freebsd6.3
-DHAVE_CONFIG_H  memsup.c
memsup.c: In function `get_extended_mem':
memsup.c:456: error: void value not ignored as it ought to be

[Fix]
http://www.freebsd.org/cgi/cvsweb.cgi/ports/lang/erlang/files/patch-lib_os__mon_c__src_memsup.c



More information about the erlang-patches mailing list