Bug 242863 - www/h2o: Fails to build with security/libressl 3.0.2: error: static declaration of 'RSA_*' follows non-static declaration
Summary: www/h2o: Fails to build with security/libressl 3.0.2: error: static declarati...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Dave Cottlehuber
URL:
Keywords: needs-qa
Depends on:
Blocks:
 
Reported: 2019-12-24 15:54 UTC by Ulas SAYGIN
Modified: 2020-05-09 02:00 UTC (History)
3 users (show)

See Also:
dch: maintainer-feedback+
koobs: merge-quarterly?


Attachments
svn-diff-h2o-libressl (1.23 KB, patch)
2019-12-24 23:13 UTC, Walter Schwarzenfeld
no flags Details | Diff
svn-diff-h2o-libressl_v2 (2.12 KB, patch)
2019-12-25 14:50 UTC, Walter Schwarzenfeld
no flags Details | Diff
svn-diff-h2o-libressl_v3 (1.95 KB, patch)
2019-12-27 08:06 UTC, Walter Schwarzenfeld
no flags Details | Diff
svn-diff-h2o-libressl_v4 (2.82 KB, patch)
2020-01-12 14:20 UTC, Walter Schwarzenfeld
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ulas SAYGIN 2019-12-24 15:54:35 UTC
I am trying to install on VM , with 16GB ram , 8 core CPU,
FreeBSD 12.1 and latest port snapshot for NOW.
before installation , freebsd system updated.
for Every dependency ports , default options are selected.

after # make install clean,
you will see the error below.

/etc/make.conf

CPUTYPE?=native

CFLAGS=-O2 -pipe -fno-strict-aliasing

COPTFLAGS=$CFLAGS

MK_PROFILE=no

DEFAULT_VERSIONS+=ssl=libressl python=3.8 python2=2.7 python3=3.8 php=7.4 pgsql=12 mysql=5.7

OPTIONS_SET+=ICONV
OPTIONS_UNSET+=CUPS DEBUG DOCS FONTCONFIG NLS X11 MAN EXAMPLES MAN3
WITHOUT_MODULES=sound ntfs linux
WITHOUT=X11 MAN MAN3 MANPAGES EXAMPLES DOCS

ftp_curl_UNSET= TLS_SRP

security_p5-GSSAPI_SET = GSSAPI_MIT
OPTIONS_UNSET += GSSAPI_BASE
OPTIONS_SET += GSSAPI_NONE

config File /etc/src.conf
WITHOUT_ATM=YES
WITHOUT_BLUETOOTH=YES
WITHOUT_DICT=YES
WITHOUT_EXAMPLES=YES
WITHOUT_GAMES=YES
WITHOUT_IPFILTER=YES
WITHOUT_HTML=YES
WITHOUT_LPR=YES§
WITHOUT_NDIS=YES
WITHOUT_MAN=YES
WITHOUT_MANPAGES=YES
WITHOUT_MAN_UTILS=YES
WITHOUT_PROFILE=YES
WITHOUT_WIRELESS=YES
WITHOUT_WIRELESS_SUPPORT=YES
WITHOUT_WPA_SUPPLICANT_EAPOL=YES
after make install clean

the error is below.

-------------------- ERROR ------------------

/h2o/work/h2o-2.2.6/src/main.c
--- CMakeFiles/h2o.dir/deps/neverbleed/neverbleed.c.o ---
/usr/ports/www/h2o/work/h2o-2.2.6/deps/neverbleed/neverbleed.c:635:13: error: static declaration of 'RSA_get0_key' follows non-static declaration
static void RSA_get0_key(const RSA *rsa, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
^
/usr/local/include/openssl/rsa.h:399:6: note: previous declaration is here
void RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e,
^
/usr/ports/www/h2o/work/h2o-2.2.6/deps/neverbleed/neverbleed.c:650:12: error: static declaration of 'RSA_set0_key' follows non-static declaration
static int RSA_set0_key(RSA *rsa, BIGNUM *n, BIGNUM *e, BIGNUM *d)
^
/usr/local/include/openssl/rsa.h:401:5: note: previous declaration is here
int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d);
^
/usr/ports/www/h2o/work/h2o-2.2.6/deps/neverbleed/neverbleed.c:666:13: error: static declaration of 'RSA_set_flags' follows non-static declaration
static void RSA_set_flags(RSA *r, int flags)
^
/usr/local/include/openssl/rsa.h:409:6: note: previous declaration is here
void RSA_set_flags(RSA *r, int flags);
^
3 errors generated.
*** [CMakeFiles/h2o.dir/deps/neverbleed/neverbleed.c.o] Error code 1

make[4]: stopped in /usr/ports/www/h2o/work/.build
1 error

make[4]: stopped in /usr/ports/www/h2o/work/.build
*** [CMakeFiles/h2o.dir/all] Error code 2

make[3]: stopped in /usr/ports/www/h2o/work/.build
1 error

make[3]: stopped in /usr/ports/www/h2o/work/.build
*** [all] Error code 2

make[2]: stopped in /usr/ports/www/h2o/work/.build
1 error

make[2]: stopped in /usr/ports/www/h2o/work/.build
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/www/h2o
*** Error code 1

Stop.
make: stopped in /usr/ports/www/h2o
Comment 1 Walter Schwarzenfeld 2019-12-24 23:13:35 UTC
Created attachment 210208 [details]
svn-diff-h2o-libressl
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2019-12-25 02:16:21 UTC
@Walter Thank you for the patch. Has this been QA'd and confirmned to pass for all values of USES=ssl=<value> including openssl and *-devel ?
Comment 3 Walter Schwarzenfeld 2019-12-25 07:12:27 UTC
Sorry, forgot. It is not tested with openssl (cannot test with openssl in the moment).
Comment 4 Ulas SAYGIN 2019-12-25 14:07:20 UTC
I updated Makefile and created new file named on files/patch-deps_neverbleed-neverbleed.c and saved the patch like this but i got error below.

for information, without this patch , i installed h2o with openssl without problem. but after this patch i dont know does it work or not.


--- deps/neverbleed/neverbleed.c.orig   2019-12-24 22:26:48 UTC
+++ deps/neverbleed/neverbleed.c
@@ -630,7 +630,7 @@ static int sign_stub(struct expbuf_t *buf)
return 0;
  }

-#if !OPENSSL_1_1_API
+#if !OPENSSL_1_1_API && !defined(LIBRESSL_VERSION_NUMBER)
static void RSA_get0_key(const RSA *rsa, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
  {


######### ERROR with Patch #########

--- CMakeFiles/h2o.dir/deps/neverbleed/neverbleed.c.o ---
/usr/ports/www/h2o/work/h2o-2.2.6/deps/neverbleed/neverbleed.c:635:13: error: static declaration of 'RSA_get0_key' follows non-static declarati                                                                                              on
static void RSA_get0_key(const RSA *rsa, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
            ^
/usr/local/include/openssl/rsa.h:399:6: note: previous declaration is here
void RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e,
     ^
/usr/ports/www/h2o/work/h2o-2.2.6/deps/neverbleed/neverbleed.c:650:12: error: static declaration of 'RSA_set0_key' follows non-static declarati                                                                                              on
static int RSA_set0_key(RSA *rsa, BIGNUM *n, BIGNUM *e, BIGNUM *d)
           ^
/usr/local/include/openssl/rsa.h:401:5: note: previous declaration is here
int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d);
    ^
/usr/ports/www/h2o/work/h2o-2.2.6/deps/neverbleed/neverbleed.c:666:13: error: static declaration of 'RSA_set_flags' follows non-static declarat                                                                                              ion
static void RSA_set_flags(RSA *r, int flags)
            ^
/usr/local/include/openssl/rsa.h:409:6: note: previous declaration is here
void RSA_set_flags(RSA *r, int flags);
     ^
3 errors generated.
*** [CMakeFiles/h2o.dir/deps/neverbleed/neverbleed.c.o] Error code 1

make[4]: stopped in /usr/ports/www/h2o/work/.build
1 error

make[4]: stopped in /usr/ports/www/h2o/work/.build
*** [CMakeFiles/h2o.dir/all] Error code 2

make[3]: stopped in /usr/ports/www/h2o/work/.build
1 error

make[3]: stopped in /usr/ports/www/h2o/work/.build
*** [all] Error code 2

make[2]: stopped in /usr/ports/www/h2o/work/.build
1 error

make[2]: stopped in /usr/ports/www/h2o/work/.build
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/www/h2o
*** Error code 1

Stop.
make: stopped in /usr/ports/www/h2o
Comment 5 Walter Schwarzenfeld 2019-12-25 14:50:31 UTC
Created attachment 210225 [details]
svn-diff-h2o-libressl_v2

Ok, please try this one, this should work.
Comment 6 Ulas SAYGIN 2019-12-27 06:49:31 UTC
New ERROR here

--- CMakeFiles/h2o.dir/deps/neverbleed/neverbleed.c.o ---
/usr/ports/www/h2o/work/h2o-2.2.6/deps/neverbleed/neverbleed.c:635:13: error: st                                                             atic declaration of 'RSA_get0_key' follows non-static declaration
static void RSA_get0_key(const RSA *rsa, const BIGNUM **n, const BIGNUM **e, con                                                             st BIGNUM **d)
            ^
/usr/local/include/openssl/rsa.h:399:6: note: previous declaration is here
void RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e,
     ^
/usr/ports/www/h2o/work/h2o-2.2.6/deps/neverbleed/neverbleed.c:650:12: error: st                                                             atic declaration of 'RSA_set0_key' follows non-static declaration
static int RSA_set0_key(RSA *rsa, BIGNUM *n, BIGNUM *e, BIGNUM *d)
           ^
/usr/local/include/openssl/rsa.h:401:5: note: previous declaration is here
int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d);
    ^
/usr/ports/www/h2o/work/h2o-2.2.6/deps/neverbleed/neverbleed.c:666:13: error: st                                                             atic declaration of 'RSA_set_flags' follows non-static declaration
static void RSA_set_flags(RSA *r, int flags)
            ^
/usr/local/include/openssl/rsa.h:409:6: note: previous declaration is here
void RSA_set_flags(RSA *r, int flags);
     ^
--- CMakeFiles/h2o.dir/deps/picotls/lib/picotls.c.o ---
--- CMakeFiles/h2o.dir/deps/neverbleed/neverbleed.c.o ---
3 errors generated.
*** [CMakeFiles/h2o.dir/deps/neverbleed/neverbleed.c.o] Error code 1

make[4]: stopped in /usr/ports/www/h2o/work/.build
--- CMakeFiles/h2o.dir/deps/picotls/lib/picotls.c.o ---
[ 60%] Building C object CMakeFiles/h2o.dir/deps/picotls/lib/picotls.c.o
/usr/bin/cc  -I/usr/ports/www/h2o/work/h2o-2.2.6/deps/mruby/include -I/usr/ports                                                             /www/h2o/work/h2o-2.2.6/deps/mruby-input-stream/src -I/usr/ports/www/h2o/work/h2                                                             o-2.2.6/include -I/usr/ports/www/h2o/work/h2o-2.2.6/deps/cloexec -I/usr/ports/ww                                                             w/h2o/work/h2o-2.2.6/deps/brotli/enc -I/usr/ports/www/h2o/work/h2o-2.2.6/deps/go                                                             lomb/usr/ports/www/h2o/work/h2o-2.2.6/deps/libgkc -I/usr/ports/www/h2o/work/h2o-                                                             2.2.6/deps/libyrmcds -I/usr/ports/www/h2o/work/h2o-2.2.6/deps/klib -I/usr/ports/                                                             www/h2o/work/h2o-2.2.6/deps/neverbleed -I/usr/ports/www/h2o/work/h2o-2.2.6/deps/                                                             picohttpparser -I/usr/ports/www/h2o/work/h2o-2.2.6/deps/picotest -I/usr/ports/ww                                                             w/h2o/work/h2o-2.2.6/deps/yaml/include -I/usr/ports/www/h2o/work/h2o-2.2.6/deps/                                                             yoml -I/usr/local/include -I/usr/ports/www/h2o/work/h2o-2.2.6/deps/picotls/deps/                                                             cifra/src/ext -I/usr/ports/www/h2o/work/h2o-2.2.6/deps/picotls/deps/cifra/src -I                                                             /usr/ports/www/h2o/work/h2o-2.2.6/deps/picotls/deps/micro-ecc -I/usr/ports/www/h                                                             2o/work/h2o-2.2.6/deps/picotls/include -O2 -g -Wall -Wno-unused-value -Wno-unuse                                                             d-function -O2 -pipe -fno-strict-aliasing -march=native  -fstack-protector-stron                                                             g -DH2O_ROOT="/usr/local" -DH2O_CONFIG_PATH="etc/h2o.conf" -pthread -O2 -pipe -f                                                             no-strict-aliasing -march=native  -fstack-protector-strong   -DH2O_USE_LIBUV=0 -                                                             DH2O_USE_BROTLI=1 -DH2O_USE_MRUBY=1 -DH2O_USE_PICOTLS=1 -o CMakeFiles/h2o.dir/de                                                             ps/picotls/lib/picotls.c.o   -c /usr/ports/www/h2o/work/h2o-2.2.6/deps/picotls/l                                                             ib/picotls.c
1 error

make[4]: stopped in /usr/ports/www/h2o/work/.build
*** [CMakeFiles/h2o.dir/all] Error code 2

make[3]: stopped in /usr/ports/www/h2o/work/.build
1 error

make[3]: stopped in /usr/ports/www/h2o/work/.build
*** [all] Error code 2

make[2]: stopped in /usr/ports/www/h2o/work/.build
1 error

make[2]: stopped in /usr/ports/www/h2o/work/.build
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/www/h2o
*** Error code 1

Stop.
make: stopped in /usr/ports/www/h2o
Comment 7 Walter Schwarzenfeld 2019-12-27 08:06:48 UTC
Created attachment 210249 [details]
svn-diff-h2o-libressl_v3

Aah.. I was little puzzled .... it is the same error as with libressl. Only needs to remove "static".
Comment 8 Ulas SAYGIN 2019-12-27 11:09:43 UTC
Yes it seems same error before second patch. 
i dont get it. there is no change.
do i need only to remove static?
Comment 9 Ulas SAYGIN 2019-12-27 11:17:50 UTC
Patch Version 3 ERROR

ports/www/h2o/work/h2o-2.2.6/deps/picotls/lib/openssl.c
--- CMakeFiles/h2o.dir/deps/neverbleed/neverbleed.c.o ---
/usr/ports/www/h2o/work/h2o-2.2.6/deps/neverbleed/neverbleed.c:635:13: error: static declaration of 'RSA_get0_key' follows non-static declaration
static void RSA_get0_key(const RSA *rsa, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
            ^
/usr/local/include/openssl/rsa.h:399:6: note: previous declaration is here
void RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e,
     ^
/usr/ports/www/h2o/work/h2o-2.2.6/deps/neverbleed/neverbleed.c:650:12: error: static declaration of 'RSA_set0_key' follows non-static declaration
static int RSA_set0_key(RSA *rsa, BIGNUM *n, BIGNUM *e, BIGNUM *d)
           ^
/usr/local/include/openssl/rsa.h:401:5: note: previous declaration is here
int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d);
    ^
/usr/ports/www/h2o/work/h2o-2.2.6/deps/neverbleed/neverbleed.c:666:13: error: static declaration of 'RSA_set_flags' follows non-static declaration
static void RSA_set_flags(RSA *r, int flags)
            ^
/usr/local/include/openssl/rsa.h:409:6: note: previous declaration is here
void RSA_set_flags(RSA *r, int flags);
     ^
3 errors generated.
*** [CMakeFiles/h2o.dir/deps/neverbleed/neverbleed.c.o] Error code 1

make[4]: stopped in /usr/ports/www/h2o/work/.build
1 error

make[4]: stopped in /usr/ports/www/h2o/work/.build
*** [CMakeFiles/h2o.dir/all] Error code 2

make[3]: stopped in /usr/ports/www/h2o/work/.build
1 error

make[3]: stopped in /usr/ports/www/h2o/work/.build
*** [all] Error code 2

make[2]: stopped in /usr/ports/www/h2o/work/.build
1 error

make[2]: stopped in /usr/ports/www/h2o/work/.build
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/www/h2o
*** Error code 1

Stop.
make: stopped in /usr/ports/www/h2o
Comment 10 Walter Schwarzenfeld 2019-12-27 11:27:17 UTC
Maybe, you did something wrong. I have patched out "static". And you have it still...
Comment 11 Walter Schwarzenfeld 2019-12-27 11:31:22 UTC
I think  at least the second patch should work (also for openssl), maybe also the first. I rather think the third patch is wrong for openssl.
Comment 12 Ulas SAYGIN 2019-12-27 14:31:28 UTC
firstly, without any patch i was able to install with openssl and no problem.

secondly, for patch, if there is no any problem about character conversation for editors. I applied patch manually like this,
I updated Makefile myself with ee and
created file on files/patch-deps_neverbleed-neverbleed.c

and i copy your patch to this file.

Which part i am doing worng or 
can you help me about doing better without mistake?

thank you very much Mr. Walter.
Comment 13 Walter Schwarzenfeld 2019-12-27 18:00:52 UTC
I don't know whar may went wrong.

I do it in following way:
cd /usr/ports/www/h20
patch < svn-diff-h2o-libressl_v2
rm files patch-deps_neverbleed-neverbleed.c.orig (if exists - this a svn nonsense, a file with size 0)

and run
make install clean

and have a different result like you (it works for libressl).
Comment 14 Walter Schwarzenfeld 2019-12-27 18:02:07 UTC
correct was a typo in it:

rm files/patch-deps_neverbleed-neverbleed.c.orig
Comment 15 Ulas SAYGIN 2019-12-28 15:51:59 UTC
I have done this. I will Try first patch too and i will tell the result.

root@h2olibre:/usr/ports/www/h2o # patch < svn-diff-h2o-libressl_v2
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Index: Makefile
|===================================================================
|--- Makefile   (revision 520822)
|+++ Makefile   (working copy)
--------------------------
Patching file Makefile using Plan A...
Hunk #1 failed at 4.
Hunk #2 failed at 23.
2 out of 2 hunks failed--saving rejects to Makefile.rej
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Index: files/patch-deps_neverbleed-neverbleed.c
|===================================================================
|--- files/patch-deps_neverbleed-neverbleed.c   (nonexistent)
|+++ files/patch-deps_neverbleed-neverbleed.c   (working copy)
--------------------------
(Creating file files/patch-deps_neverbleed-neverbleed.c...)
Patching file files/patch-deps_neverbleed-neverbleed.c using Plan A...
Empty context always matches.
Hunk #1 succeeded at 1.
Hmm...  Ignoring the trailing garbage.
done
root@h2olibre:/usr/ports/www/h2o # make install clean

.....

/usr/ports/www/h2o/work/h2o-2.2.6/deps/neverbleed/neverbleed.c:635:13: error: static declaration of 'RSA_get0_key' follows non-static declaration
static void RSA_get0_key(const RSA *rsa, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
            ^
/usr/local/include/openssl/rsa.h:399:6: note: previous declaration is here
void RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e,
     ^
/usr/ports/www/h2o/work/h2o-2.2.6/deps/neverbleed/neverbleed.c:650:12: error: static declaration of 'RSA_set0_key' follows non-static declaration
static int RSA_set0_key(RSA *rsa, BIGNUM *n, BIGNUM *e, BIGNUM *d)
           ^
/usr/local/include/openssl/rsa.h:401:5: note: previous declaration is here
int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d);
    ^
/usr/ports/www/h2o/work/h2o-2.2.6/deps/neverbleed/neverbleed.c:666:13: error: static declaration of 'RSA_set_flags' follows non-static declaration
static void RSA_set_flags(RSA *r, int flags)
            ^
/usr/local/include/openssl/rsa.h:409:6: note: previous declaration is here
void RSA_set_flags(RSA *r, int flags);
     ^
3 errors generated.
*** [CMakeFiles/h2o.dir/deps/neverbleed/neverbleed.c.o] Error code 1

make[4]: stopped in /usr/ports/www/h2o/work/.build
1 error

make[4]: stopped in /usr/ports/www/h2o/work/.build
*** [CMakeFiles/h2o.dir/all] Error code 2

make[3]: stopped in /usr/ports/www/h2o/work/.build
1 error

make[3]: stopped in /usr/ports/www/h2o/work/.build
*** [all] Error code 2

make[2]: stopped in /usr/ports/www/h2o/work/.build
1 error

make[2]: stopped in /usr/ports/www/h2o/work/.build
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/www/h2o
*** Error code 1

Stop.
make: stopped in /usr/ports/www/h2o
Comment 16 Ulas SAYGIN 2019-12-28 15:56:50 UTC
Trying First Patch,,

root@h2olibre:/usr/ports/www/h2o/files # ls
h2o.conf.sample.in                      patch-deps_neverbleed-neverbleed.c
h2o.in                                  patch-deps_neverbleed-neverbleed.c.orig
root@h2olibre:/usr/ports/www/h2o/files # rm patch-deps_neverbleed-neverbleed.c
root@h2olibre:/usr/ports/www/h2o/files # rm patch-deps_neverbleed-neverbleed.c.orig

root@h2olibre:/usr/ports/www/h2o/files # cd ..
root@h2olibre:/usr/ports/www/h2o # ls
distinfo                        Makefile.orig                   pkg-plist
files                           Makefile.rej                    svn-diff-h2o-libressl_v2
Makefile                        pkg-descr                       work

root@h2olibre:/usr/ports/www/h2o # ls
distinfo                        Makefile.rej                    svn-diff-h2o-libressl_v2
files                           pkg-descr                       work
Makefile                        pkg-plist
Makefile.orig                   svn-diff-h2o-libressl

root@h2olibre:/usr/ports/www/h2o # patch < svn-diff-h2o-libressl
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Index: Makefile
|===================================================================
|--- Makefile   (revision 520822)
|+++ Makefile   (working copy)
--------------------------
Patching file Makefile using Plan A...
Hunk #1 failed at 4.
1 out of 1 hunks failed--saving rejects to Makefile.rej
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Index: files/patch-deps_neverbleed-neverbleed.c
|===================================================================
|--- files/patch-deps_neverbleed-neverbleed.c   (nonexistent)
|+++ files/patch-deps_neverbleed-neverbleed.c   (working copy)
--------------------------
(Creating file files/patch-deps_neverbleed-neverbleed.c...)
Patching file files/patch-deps_neverbleed-neverbleed.c using Plan A...
Empty context always matches.
Hunk #1 succeeded at 1.
Hmm...  Ignoring the trailing garbage.
done

root@h2olibre:/usr/ports/www/h2o # make install clean
===>  Building for h2o-2.2.6
/usr/local/bin/cmake -S/usr/ports/www/h2o/work/h2o-2.2.6 -B/usr/ports/www/h2o/work/.build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/bin/cmake -E cmake_progress_start /usr/ports/www/h2o/work/.build/CMakeFiles /usr/ports/www/h2o/work/.build/CMakeFiles/progress.marks
/usr/bin/make -f CMakeFiles/Makefile2 all
--- CMakeFiles/mruby.dir/all ---
--- CMakeFiles/libh2o.dir/all ---
--- CMakeFiles/libh2o-evloop.dir/all ---
--- CMakeFiles/mruby.dir/all ---
/usr/bin/make -f CMakeFiles/mruby.dir/build.make CMakeFiles/mruby.dir/depend
--- CMakeFiles/libh2o.dir/all ---
/usr/bin/make -f CMakeFiles/libh2o.dir/build.make CMakeFiles/libh2o.dir/depend
--- CMakeFiles/libh2o-evloop.dir/all ---
/usr/bin/make -f CMakeFiles/libh2o-evloop.dir/build.make CMakeFiles/libh2o-evloop.dir/depend
--- CMakeFiles/mruby.dir/all ---
--- CMakeFiles/mruby.dir/depend ---
cd /usr/ports/www/h2o/work/.build && /usr/local/bin/cmake -E cmake_depends "Unix Makefiles" /usr/ports/www/h2o/work/h2o-2.2.6 /usr/ports/www/h2o/work/h2o-2.2.6 /usr/ports/www/h2o/work/.build /usr/ports/www/h2o/work/.build /usr/ports/www/h2o/work/.build/CMakeFiles/mruby.dir/DependInfo.cmake --color=
/usr/bin/make -f CMakeFiles/mruby.dir/build.make CMakeFiles/mruby.dir/build
--- CMakeFiles/libh2o.dir/all ---
--- CMakeFiles/libh2o.dir/depend ---
--- CMakeFiles/mruby.dir/all ---
--- CMakeFiles/mruby ---
--- CMakeFiles/libh2o-evloop.dir/all ---
--- CMakeFiles/libh2o-evloop.dir/depend ---
--- CMakeFiles/libh2o.dir/all ---
cd /usr/ports/www/h2o/work/.build && /usr/local/bin/cmake -E cmake_depends "Unix Makefiles" /usr/ports/www/h2o/work/h2o-2.2.6 /usr/ports/www/h2o/work/h2o-2.2.6 /usr/ports/www/h2o/work/.build /usr/ports/www/h2o/work/.build /usr/ports/www/h2o/work/.build/CMakeFiles/libh2o.dir/DependInfo.cmake --color=
--- CMakeFiles/mruby.dir/all ---
cd /usr/ports/www/h2o/work/h2o-2.2.6/deps/mruby && MRUBY_TOOLCHAIN=clang MRUBY_CONFIG=/usr/ports/www/h2o/work/h2o-2.2.6/misc/mruby_config.rb MRUBY_BUILD_DIR=/usr/ports/www/h2o/work/.build/mruby ruby minirake
--- CMakeFiles/libh2o-evloop.dir/all ---
cd /usr/ports/www/h2o/work/.build && /usr/local/bin/cmake -E cmake_depends "Unix Makefiles" /usr/ports/www/h2o/work/h2o-2.2.6 /usr/ports/www/h2o/work/h2o-2.2.6 /usr/ports/www/h2o/work/.build /usr/ports/www/h2o/work/.build /usr/ports/www/h2o/work/.build/CMakeFiles/libh2o-evloop.dir/DependInfo.cmake --color=
--- CMakeFiles/libh2o.dir/all ---
/usr/bin/make -f CMakeFiles/libh2o.dir/build.make CMakeFiles/libh2o.dir/build
--- CMakeFiles/libh2o-evloop.dir/all ---
/usr/bin/make -f CMakeFiles/libh2o-evloop.dir/build.make CMakeFiles/libh2o-evloop.dir/build
--- CMakeFiles/libh2o.dir/all ---
[ 55%] Built target libh2o
--- CMakeFiles/libh2o-evloop.dir/all ---
[ 55%] Built target libh2o-evloop
--- CMakeFiles/mruby.dir/all ---
(in /usr/ports/www/h2o/work/h2o-2.2.6/deps/mruby)
PKG-CONFIG onigmo
PKG-CONFIG oniguruma

Build summary:

================================================
      Config Name: host
 Output Directory: ../../../.build/mruby/host
         Binaries: mruby-config, mrbc
    Included Gems:
             mruby-pack
             mruby-input-stream - 1.0.0 - InputStream class for Rack
             mruby-time - standard Time class
             mruby-file-stat
             mruby-io
             mruby-errno
             mruby-array-ext - Array class extension
             mruby-dir
             mruby-compiler - mruby compiler library
             mruby-eval - standard Kernel#eval method
             mruby-require
             mruby-env
             mruby-onig-regexp
             mruby-sprintf - standard Kernel#sprintf method
             mruby-iijson
             mruby-digest
             mruby-print - standard print/puts/p
             mruby-bin-strip - irep dump debug section remover command
               - Binaries: mruby-strip
             mruby-object-ext - Object class extension
             mruby-fiber - Fiber class
             mruby-error - extensional error handling
             mruby-range-ext - Range class extension
             mruby-proc-ext - Proc class extension
             mruby-exit - Kernel#exit method
             mruby-inline-struct - inline structure
             mruby-enum-ext - Enumerable module extension
             mruby-hash-ext - Hash class extension
             mruby-enumerator - Enumerator class
             mruby-string-ext - String class extension
             mruby-toplevel-ext - toplevel object (main) methods extension
             mruby-math - standard Math module
             mruby-struct - standard Struct class
             mruby-class-ext - class/module extension
             mruby-bin-mirb - mirb command
               - Binaries: mirb
             mruby-enum-lazy - Enumerator::Lazy class
             mruby-objectspace - ObjectSpace class
             mruby-kernel-ext - Kernel module extension
             mruby-symbol-ext - Symbol class extension
             mruby-bin-mrbc - mruby compiler executable
             mruby-random - Random class
             mruby-bin-mruby - mruby command
               - Binaries: mruby
             mruby-numeric-ext - Numeric class extension
================================================

[ 55%] Built target mruby
--- CMakeFiles/h2o.dir/all ---
/usr/bin/make -f CMakeFiles/h2o.dir/build.make CMakeFiles/h2o.dir/depend
--- CMakeFiles/h2o.dir/depend ---
cd /usr/ports/www/h2o/work/.build && /usr/local/bin/cmake -E cmake_depends "Unix Makefiles" /usr/ports/www/h2o/work/h2o-2.2.6 /usr/ports/www/h2o/work/h2o-2.2.6 /usr/ports/www/h2o/work/.build /usr/ports/www/h2o/work/.build /usr/ports/www/h2o/work/.build/CMakeFiles/h2o.dir/DependInfo.cmake --color=
/usr/bin/make -f CMakeFiles/h2o.dir/build.make CMakeFiles/h2o.dir/build
--- CMakeFiles/h2o.dir/deps/neverbleed/neverbleed.c.o ---
[ 55%] Building C object CMakeFiles/h2o.dir/deps/neverbleed/neverbleed.c.o
/usr/bin/cc  -I/usr/ports/www/h2o/work/h2o-2.2.6/deps/mruby/include -I/usr/ports/www/h2o/work/h2o-2.2.6/deps/mruby-input-stream/src -I/usr/ports/www/h2o/work/h2o-2.2.6/include -I/usr/ports/www/h2o/work/h2o-2.2.6/deps/cloexec -I/usr/ports/www/h2o/work/h2o-2.2.6/deps/brotli/enc -I/usr/ports/www/h2o/work/h2o-2.2.6/deps/golomb/usr/ports/www/h2o/work/h2o-2.2.6/deps/libgkc -I/usr/ports/www/h2o/work/h2o-2.2.6/deps/libyrmcds -I/usr/ports/www/h2o/work/h2o-2.2.6/deps/klib -I/usr/ports/www/h2o/work/h2o-2.2.6/deps/neverbleed -I/usr/ports/www/h2o/work/h2o-2.2.6/deps/picohttpparser -I/usr/ports/www/h2o/work/h2o-2.2.6/deps/picotest -I/usr/ports/www/h2o/work/h2o-2.2.6/deps/yaml/include -I/usr/ports/www/h2o/work/h2o-2.2.6/deps/yoml -I/usr/local/include -I/usr/ports/www/h2o/work/h2o-2.2.6/deps/picotls/deps/cifra/src/ext -I/usr/ports/www/h2o/work/h2o-2.2.6/deps/picotls/deps/cifra/src -I/usr/ports/www/h2o/work/h2o-2.2.6/deps/picotls/deps/micro-ecc -I/usr/ports/www/h2o/work/h2o-2.2.6/deps/picotls/include -O2 -g -Wall -Wno-unused-value -Wno-unused-function -O2 -pipe -fno-strict-aliasing -march=native  -fstack-protector-strong -DH2O_ROOT="/usr/local" -DH2O_CONFIG_PATH="etc/h2o.conf" -pthread -O2 -pipe -fno-strict-aliasing -march=native  -fstack-protector-strong   -DH2O_USE_LIBUV=0 -DH2O_USE_BROTLI=1 -DH2O_USE_MRUBY=1 -DH2O_USE_PICOTLS=1 -o CMakeFiles/h2o.dir/deps/neverbleed/neverbleed.c.o   -c /usr/ports/www/h2o/work/h2o-2.2.6/deps/neverbleed/neverbleed.c
/usr/ports/www/h2o/work/h2o-2.2.6/deps/neverbleed/neverbleed.c:635:13: error: static declaration of 'RSA_get0_key' follows non-static declaration
static void RSA_get0_key(const RSA *rsa, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
            ^
/usr/local/include/openssl/rsa.h:399:6: note: previous declaration is here
void RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e,
     ^
/usr/ports/www/h2o/work/h2o-2.2.6/deps/neverbleed/neverbleed.c:650:12: error: static declaration of 'RSA_set0_key' follows non-static declaration
static int RSA_set0_key(RSA *rsa, BIGNUM *n, BIGNUM *e, BIGNUM *d)
           ^
/usr/local/include/openssl/rsa.h:401:5: note: previous declaration is here
int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d);
    ^
/usr/ports/www/h2o/work/h2o-2.2.6/deps/neverbleed/neverbleed.c:666:13: error: static declaration of 'RSA_set_flags' follows non-static declaration
static void RSA_set_flags(RSA *r, int flags)
            ^
/usr/local/include/openssl/rsa.h:409:6: note: previous declaration is here
void RSA_set_flags(RSA *r, int flags);
     ^
3 errors generated.
*** [CMakeFiles/h2o.dir/deps/neverbleed/neverbleed.c.o] Error code 1

make[4]: stopped in /usr/ports/www/h2o/work/.build
1 error

make[4]: stopped in /usr/ports/www/h2o/work/.build
*** [CMakeFiles/h2o.dir/all] Error code 2

make[3]: stopped in /usr/ports/www/h2o/work/.build
1 error

make[3]: stopped in /usr/ports/www/h2o/work/.build
*** [all] Error code 2

make[2]: stopped in /usr/ports/www/h2o/work/.build
1 error

make[2]: stopped in /usr/ports/www/h2o/work/.build
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/www/h2o
*** Error code 1

Stop.
make: stopped in /usr/ports/www/h2o
Comment 17 Ulas SAYGIN 2020-01-05 22:17:47 UTC
any changes?
Comment 18 Walter Schwarzenfeld 2020-01-10 21:21:46 UTC
h2o-devel has in neverbleed.c: 

   633 #if !OPENSSL_1_1_API && (!defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x2070000fL)
    634 
    635 static void RSA_get0_key(const RSA *rsa, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
    636 {
    637     if (n) {
    638         *n = rsa->n;
    639     }


it is nearly the same as my first patch.
Comment 19 Walter Schwarzenfeld 2020-01-10 21:23:27 UTC
By the way the REINPLACE_CMD in the Makefile in h2o and h2o-devel does nothing and can be removed.

=> post-patch:
        @${REINPLACE_CMD} -e 's|exec perl|exec ${LOCALBASE}/bin/perl|' \
       ......
Comment 20 Dave Cottlehuber freebsd_committer freebsd_triage 2020-01-10 22:41:10 UTC
thanks Walter for the patch v2! I assume the 2019-12-24 version is obsolete too
now.

under poudriere, 12.1-RELEASE

- h2o compiles fine with ssl= (default)
- h2o fails with ssl=libressl for me

http://pkg.skunkwerks.at/poudriere/data/12_1_x64-default/2020-01-10_22h31m31s/logs/errors/h2o-2.2.6_1.log has more details.

Any suggestions on what's missing?

I'll remove the REINPLACE_CMD once we have this patch sorted out, we now have
an rc.d var to handle this instead.
Comment 21 Walter Schwarzenfeld 2020-01-10 23:05:31 UTC
Try the h2o-devel version, I works without patch for libressl on 12.0 (in the moment only tested with the port).
Comment 22 Walter Schwarzenfeld 2020-01-11 04:31:44 UTC
(In reply to Dave Cottlehuber from comment #20)

h2o-devel builds fine with libressl with poudriere.

And I am little bit puzzled:

h2o with patch_v2 builds also fine with libressl with poudriere.
Comment 23 Walter Schwarzenfeld 2020-01-11 06:13:48 UTC
Sorry, I had a new poudriere jail and it ignored my make.conf.
You are right, h2o and h2o-devel failed with same errors.
Comment 24 Walter Schwarzenfeld 2020-01-11 07:06:48 UTC
I think I found it. We need patch_v2 and in the Makefile

     64 + .include <bsd.port.pre.mk>
     65 + .if ${SSL_DEFAULT:Mlibressl*}
     66 + USES+=  localbase
     67 + .endif

    ....
    89 - .include <bsd.port.mk>
    89 + .include <bsd.port.post.mk>
Comment 25 Walter Schwarzenfeld 2020-01-11 07:20:58 UTC
h2o-devel don't needs the patch, only needs the change in the Makefile.
Comment 26 Walter Schwarzenfeld 2020-01-12 14:20:16 UTC
Created attachment 210656 [details]
svn-diff-h2o-libressl_v4
Comment 27 Christian S.J. Peron freebsd_committer freebsd_triage 2020-04-16 23:13:29 UTC
I think we have a candidate patch here:

https://reviews.freebsd.org/D24455
Comment 28 commit-hook freebsd_committer freebsd_triage 2020-05-09 01:52:08 UTC
A commit references this bug:

Author: csjp
Date: Sat May  9 01:52:03 UTC 2020
New revision: 534701
URL: https://svnweb.freebsd.org/changeset/ports/534701

Log:
  Fix h2o build when building with libressl

  PR:	242863
  Reported by:	Ulas SAYGIN
  Reviewed by:	dch
  Approved by:	dch
  Differential Revision:	https://reviews.freebsd.org/D24455

Changes:
  head/www/h2o/files/patch-deps_neverbleed_neverbleed.c
Comment 29 Christian S.J. Peron freebsd_committer freebsd_triage 2020-05-09 02:00:41 UTC
Fixed in https://svnweb.freebsd.org/ports?view=revision&revision=534701