[erlang-questions] Error compiling R11B-4 on FreeBSD 6.2 (patch)

Tom Samplonius <>
Mon Apr 23 04:07:24 CEST 2007


  I received the following error trying to compile R11B-4 on FreeBSD 6.2:

gcc  -g -O2 -fPIC -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -fno-strict-aliasing -I. -I../include -Iconnect -Iencode -Idecode -Imisc -Iepmd -Iregistry -Ii386-unknown-freebsd6.2   -D_REENTRANT -D_THREAD_SAFE -DPOSIX_THREADS -c connect/ei_resolve.c -o /usr/home/tom/lang/otp_src_R11B-4/lib/erl_interface/obj.mt/i386-unknown-freebsd6.2/ei_resolve.o
connect/ei_resolve.c: In function `ei_gethostbyname_r':
connect/ei_resolve.c:624: warning: passing arg 5 of `gethostbyname_r' from incompatible pointer type
connect/ei_resolve.c:624: error: too few arguments to function `gethostbyname_r'
connect/ei_resolve.c:624: warning: return makes pointer from integer without a cast
gmake[4]: *** [/usr/home/tom/lang/otp_src_R11B-4/lib/erl_interface/obj.mt/i386-unknown-freebsd6.2/ei_resolve.o] Error 1
gmake[4]: Leaving directory `/usr/home/tom/lang/otp_src_R11B-4/lib/erl_interface/src'
gmake[3]: *** [opt] Error 2
gmake[3]: Leaving directory `/usr/home/tom/lang/otp_src_R11B-4/lib/erl_interface/src'
gmake[2]: *** [opt] Error 2
gmake[2]: Leaving directory `/usr/home/tom/lang/otp_src_R11B-4/lib/erl_interface'
gmake[1]: *** [opt] Error 2
gmake[1]: Leaving directory `/usr/home/tom/lang/otp_src_R11B-4/lib'
gmake: *** [libs] Error 2


It turns out this is easy to fix, but other *BSDs might have the same problem.  Here is the patch:


*** ei_resolve.c.orig   Sun Apr 22 18:51:26 2007
--- ei_resolve.c        Sun Apr 22 18:52:05 2007
***************
*** 614,620 ****
  #ifndef HAVE_GETHOSTBYNAME_R
    return my_gethostbyname_r(name,hostp,buffer,buflen,h_errnop);
  #else
! #ifdef __GLIBC__
    struct hostent *result;

    gethostbyname_r(name, hostp, buffer, buflen, &result, h_errnop);
--- 614,620 ----
  #ifndef HAVE_GETHOSTBYNAME_R
    return my_gethostbyname_r(name,hostp,buffer,buflen,h_errnop);
  #else
! #if defined(__GLIBC__) || defined(__FreeBSD__)
    struct hostent *result;

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






Tom



More information about the erlang-questions mailing list