[erlang-questions] OTP 19.1 compilation fails

Bogdan Andu bog495@REDACTED
Mon Sep 26 12:02:46 CEST 2016


I propose a diff for a clean compilation

$ diff -u /home/andu/otp_src_19.1/erts/emulator/sys/unix/sys.c.orig 
/home/andu/otp_src_19.1/erts/emulator/sys/unix/sys.c      
--- /home/andu/otp_src_19.1/erts/emulator/sys/unix/sys.c.orig   Mon Sep 26 
12:59:49 2016
+++ /home/andu/otp_src_19.1/erts/emulator/sys/unix/sys.c        Mon Sep 26 
13:00:19 2016
@@ -715,13 +715,13 @@
 static RETSIGTYPE suspend_signal(int signum)
 #endif
 {
-    int res, buf[1], __errno = errno;
+    int res, buf[1], errno_tmp = errno;
     do {
         res = read(sig_suspend_fds[0], buf, sizeof(int));
     } while (res < 0 && errno == EINTR);
 
     /* restore previous errno in case read changed it */
-    errno = __errno;
+    errno = errno_tmp;
 }
 #endif /* #ifdef ERTS_SYS_SUSPEND_SIGNAL */


On Monday, September 26, 2016 at 12:31:28 PM UTC+3, Bogdan Andu wrote:
>
> Hi,
>
> after applying patches from port/lang/erlang/19/patches
> otp 19.1 fails to compile on OpenBSD 5.7/amd64 with error:
>
> ....................
> CC     obj/x86_64-unknown-openbsd5.7/opt/smp/sys.o
> sys/unix/sys.c: In function 'suspend_signal':
> sys/unix/sys.c:718: error: called object '__errno' is not a function
> sys/unix/sys.c:721: error: called object '__errno' is not a function
> sys/unix/sys.c:724: error: called object '__errno' is not a function
> x86_64-unknown-openbsd5.7/Makefile:677: recipe for target 'obj/x86_64-unknown-openbsd5.7/opt/smp/sys.o' failed
> gmake[3]: *** [obj/x86_64-unknown-openbsd5.7/opt/smp/sys.o] Error 1
> gmake[3]: Leaving directory '/home/andu/otp_src_19.1/erts/emulator'
> /home/andu/otp_src_19.1/make/run_make.mk:35: recipe for target 'opt' failed
> gmake[2]: *** [opt] Error 2
> gmake[2]: Leaving directory '/home/andu/otp_src_19.1/erts/emulator'
> Makefile:61: recipe for target 'smp' failed
> gmake[1]: *** [smp] Error 2
> gmake[1]: Leaving directory '/home/andu/otp_src_19.1/erts'
> Makefile:444: recipe for target 'emulator' failed
> gmake: *** [emulator] Error 2
>
> becsuse in OpenBSD __errno is a function, see: /usr/include/signal.h
>
> $ gcc -v
> Reading specs from /usr/lib/gcc-lib/amd64-unknown-openbsd5.7/4.2.1/specs
> Target: amd64-unknown-openbsd5.7
> Configured with: OpenBSD/amd64 system compiler
> Thread model: posix
> gcc version 4.2.1 20070719
>
> $ diff -u /home/andu/otp_src_19.0/erts/emulator/sys/unix/sys.c 
> /home/andu/otp_src_19.1/erts/emulator/sys/unix/sys.c
> --- /home/andu/otp_src_19.0/erts/emulator/sys/unix/sys.c        Tue Jun 21 
> 21:55:58 2016
> +++ /home/andu/otp_src_19.1/erts/emulator/sys/unix/sys.c        Tue Sep 20 
> 22:11:23 2016
> @@ -715,11 +715,13 @@
>  static RETSIGTYPE suspend_signal(int signum)
>  #endif
>  {
> -   int res;
> -   int buf[1];
> -   do {
> -     res = read(sig_suspend_fds[0], buf, sizeof(int));
> -   } while (res < 0 && errno == EINTR);
> +    int res, buf[1], __errno = errno;
> +    do {
> +        res = read(sig_suspend_fds[0], buf, sizeof(int));
> +    } while (res < 0 && errno == EINTR);
> +
> +    /* restore previous errno in case read changed it */
> +    errno = __errno;
>  }
>  #endif /* #ifdef ERTS_SYS_SUSPEND_SIGNAL */
>
> In opt 19.1 is introduced this variable (__errno) which in OpenBSD is a 
> function.
>
>
> Regards,
> /Bogdan
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160926/8b7c6d06/attachment.htm>


More information about the erlang-questions mailing list