Bug 250128

Summary: www/epiphany: build error (no getrandom(2) on 11.x)
Product: Ports & Packages Reporter: John Hein <jcfyecrayz>
Component: Individual Port(s)Assignee: freebsd-gnome (Nobody) <gnome>
Status: Closed FIXED    
Severity: Affects Some People CC: desktop, diizzy
Priority: --- Flags: bugzilla: maintainer-feedback? (gnome)
Version: Latest   
Hardware: Any   
OS: Any   
URL: http://beefy9.nyi.freebsd.org/data/114amd64-default/553941/logs/epiphany-3.38.0_3.log
Attachments:
Description Flags
[patch] add alternate implementation for missing getrandom(2) on 11.x
none
[patch] add alternate implementation for missing getrandom(2) on 11.x (v2)
none
[patch] add alternate implementation for missing getrandom(2) on 11.x (v3) none

Description John Hein 2020-10-04 22:35:34 UTC
Created attachment 218527 [details]
[patch] add alternate implementation for missing getrandom(2) on 11.x

11.x port builds of www/epiphany fail to compile because of a missing prototype for getrandom(2).  Of course, the prototype is missing because the actual syscall is not available on 11.x (as of 11.4).

[41/201] cc -Ilib/libephymisc.so.p -Ilib -I../lib -I. -I.. -I../lib/contrib -I../lib/history -I../lib/safe-browsing -I/usr/local/include/cairo -I/usr/local/include -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include/pixman-1 -I/usr/local/include/freetype2 -I/usr/local/include/libdrm -I/usr/local/include/libpng16 -I/usr/local/include/gdk-pixbuf-2.0 -I/usr/local/include/gio-unix-2.0 -I/usr/local/include/gsettings-desktop-schemas -I/usr/local/include/gtk-3.0 -I/usr/local/include/pango-1.0 -I/usr/local/include/fribidi -I/usr/local/include/harfbuzz -I/usr/local/include/libepoll-shim -I/usr/local/include/atk-1.0 -I/usr/local/include/at-spi2-atk/2.0 -I/usr/local/include/dbus-1.0 -I/usr/local/lib/dbus-1.0/include -I/usr/local/include/at-spi-2.0 -I/usr/local/include/json-glib-1.0 -I/usr/local/include/libdazzle-1.0 -I/usr/local/include/libsecret-1 -I/usr/local/include/libsoup-2.4 -I/usr/local/include/libxml2 -I/usr/local/include/webkitgtk-4.0 -Xclang -fcolor-diagnostics -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O3 -Werror=declaration-after-statement -Werror=implicit-function-declaration -Wno-missing-field-initializers -Wno-unused-parameter -O2 -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -isystem /usr/local/include -fPIC -pthread -D_THREAD_SAFE -MD -MQ lib/libephymisc.so.p/ephy-sync-utils.c.o -MF lib/libephymisc.so.p/ephy-sync-utils.c.o.d -o lib/libephymisc.so.p/ephy-sync-utils.c.o -c ../lib/ephy-sync-utils.c
FAILED: lib/libephymisc.so.p/ephy-sync-utils.c.o 
cc -Ilib/libephymisc.so.p -Ilib -I../lib -I. -I.. -I../lib/contrib -I../lib/history -I../lib/safe-browsing -I/usr/local/include/cairo -I/usr/local/include -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include/pixman-1 -I/usr/local/include/freetype2 -I/usr/local/include/libdrm -I/usr/local/include/libpng16 -I/usr/local/include/gdk-pixbuf-2.0 -I/usr/local/include/gio-unix-2.0 -I/usr/local/include/gsettings-desktop-schemas -I/usr/local/include/gtk-3.0 -I/usr/local/include/pango-1.0 -I/usr/local/include/fribidi -I/usr/local/include/harfbuzz -I/usr/local/include/libepoll-shim -I/usr/local/include/atk-1.0 -I/usr/local/include/at-spi2-atk/2.0 -I/usr/local/include/dbus-1.0 -I/usr/local/lib/dbus-1.0/include -I/usr/local/include/at-spi-2.0 -I/usr/local/include/json-glib-1.0 -I/usr/local/include/libdazzle-1.0 -I/usr/local/include/libsecret-1 -I/usr/local/include/libsoup-2.4 -I/usr/local/include/libxml2 -I/usr/local/include/webkitgtk-4.0 -Xclang -fcolor-diagnostics -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O3 -Werror=declaration-after-statement -Werror=implicit-function-declaration -Wno-missing-field-initializers -Wno-unused-parameter -O2 -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -isystem /usr/local/include -fPIC -pthread -D_THREAD_SAFE -MD -MQ lib/libephymisc.so.p/ephy-sync-utils.c.o -MF lib/libephymisc.so.p/ephy-sync-utils.c.o.d -o lib/libephymisc.so.p/ephy-sync-utils.c.o -c ../lib/ephy-sync-utils.c
In file included from ../lib/ephy-sync-utils.c:30:
In file included from /usr/local/include/libsoup-2.4/libsoup/soup.h:28:
/usr/local/include/libsoup-2.4/libsoup/soup-date.h:63:10: warning: 'GTimeVal' is deprecated: Use 'GDateTime' instead [-Wdeprecated-declarations]
                                     GTimeVal       *time);
                                     ^
/usr/local/include/glib-2.0/glib/gtypes.h:545:35: note: 'GTimeVal' has been explicitly marked deprecated here
typedef struct _GTimeVal GTimeVal GLIB_DEPRECATED_TYPE_IN_2_62_FOR(GDateTime);
                                  ^
/usr/local/include/glib-2.0/glib/gversionmacros.h:923:49: note: expanded from macro 'GLIB_DEPRECATED_TYPE_IN_2_62_FOR'
# define GLIB_DEPRECATED_TYPE_IN_2_62_FOR(f)    GLIB_DEPRECATED_TYPE_FOR(f)
                                                ^
/usr/local/include/glib-2.0/glib/gmacros.h:1018:37: note: expanded from macro 'GLIB_DEPRECATED_TYPE_FOR'
#define GLIB_DEPRECATED_TYPE_FOR(f) G_DEPRECATED_FOR(f)
                                    ^
/usr/local/include/glib-2.0/glib/gmacros.h:952:44: note: expanded from macro 'G_DEPRECATED_FOR'
#define G_DEPRECATED_FOR(f) __attribute__((__deprecated__("Use '" #f "' instead")))
                                           ^
../lib/ephy-sync-utils.c:192:11: error: implicit declaration of function 'getrandom' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    ret = getrandom (out, num_bytes, 0);
          ^
1 warning and 1 error generated.
ninja: build stopped: subcommand failed.


See also freebsd package builder failure log:

http://beefy3.nyi.freebsd.org/data/114amd64-quarterly/551243/logs/epiphany-3.38.0.log


The attached patch implements a workaround for the missing getrandom(2).  When 11.x support ends, this can be removed (or if 11.x gets getrandom(2)).
Comment 1 John Hein 2020-10-04 22:44:02 UTC
Adding desktop@ due to gnome@ not being responsive these days.

No need to bump PORTREVISION - this just fixes a build error, so no valid 11.x package exists anyway for this PORTVERSION.

QA:
Patch tested in poudriere on 11.x (no-op for 12.x+).
Portlint: no new findings (feel free to fix USES ordering).
Comment 2 John Hein 2020-10-05 14:47:17 UTC
Created attachment 218542 [details]
[patch] add alternate implementation for missing getrandom(2) on 11.x (v2)

v2 of patch:
 - fix path in patch
 - address portlint warning (move USES)
Comment 3 John Hein 2020-10-06 01:51:37 UTC
Created attachment 218549 [details]
[patch] add alternate implementation for missing getrandom(2) on 11.x (v3)

Tweak patch - throw error if opening /dev/urandom fails (avoids potentially uninitialized 'ret').
Comment 4 John Hein 2020-11-05 13:17:18 UTC
Timeout?
This is still failing on the FreeBSD package builder.
Comment 5 commit-hook freebsd_committer freebsd_triage 2020-11-05 18:20:14 UTC
A commit references this bug:

Author: tcberner
Date: Thu Nov  5 18:20:06 UTC 2020
New revision: 554147
URL: https://svnweb.freebsd.org/changeset/ports/554147

Log:
  www/epiphany: build error (no getrandom(2) on 11.x)

  Add alternate implementation for missing getrandom(2) on 11.x (v2)

  PR:		250128
  Submitted by:	John Hein <jcfyecrayz@liamekaens.com>

Changes:
  head/www/epiphany/Makefile
  head/www/epiphany/files/extra-patch-lib_ephy-sync-utils.c