litespeedtech / openlitespeed

Our high-performance, lightweight, open source HTTP server
https://openlitespeed.org
GNU General Public License v3.0
1.16k stars 189 forks source link

OpenLiteSpeed 1.7.14 Build error(s) on FreeBSD 13/12.2 #294

Open kalleboy opened 2 years ago

kalleboy commented 2 years ago

Hello there, I've a personal web server box running FreeBSD 13. I'm getting errors during build.sh, here are the details;

Steps I followed; 1- fetch https://openlitespeed.org/packages/openlitespeed-1.7.14.src.tgz 2- tar zxf openlitespeed-1.7.14.src.tgz 3- cd openlitespeed-1.7.14 4- ./build.sh (tried both openlitespeed-1.7.14.src.tgz and the latest master.zip file on Github here, both failed)

during the build, the errors I get:

Error 1:

[ 81%] Building CXX object ssl/test/CMakeFiles/handshaker.dir/handshaker.cc.o [ 82%] Building CXX object ssl/test/CMakeFiles/bssl_shim.dir/test_config.cc.o [ 82%] Building CXX object crypto/CMakeFiles/crypto_test.dir/fipsmodule/aes/aes_test.cc.o /root/third-party/src/boringssl/ssl/test/handshaker.cc:96:18: error: use of undeclared identifier 'kControlMsgWantRead' char msg = kControlMsgWantRead; ^ /root/third-party/src/boringssl/ssl/test/handshaker.cc:99:18: error: use of undeclared identifier 'kControlMsgWriteCompleted' msg != kControlMsgWriteCompleted) { ^ /root/third-party/src/boringssl/ssl/test/handshaker.cc:127:14: error: use of undeclared identifier 'kControlMsgDone' char msg = kControlMsgDone; ^ /root/third-party/src/boringssl/ssl/test/handshaker.cc:191:16: error: use of undeclared identifier 'kControlMsgError' char msg = kControlMsgError; ^ /root/third-party/src/boringssl/ssl/test/handshaker.cc:205:14: error: use of undeclared identifier 'kControlMsgDone' char msg = kControlMsgDone; ^ /root/third-party/src/boringssl/ssl/test/handshaker.cc:216:20: error: use of undeclared identifier 'kControlMsgError' const char msg = kControlMsgError; ^ /root/third-party/src/boringssl/ssl/test/handshaker.cc:217:19: error: use of undeclared identifier 'kFdControl' if (write_eintr(kFdControl, &msg, 1) != 1) { ^ /root/third-party/src/boringssl/ssl/test/handshaker.cc:248:28: error: use of undeclared identifier 'kFdControl' ssize_t len = read_eintr(kFdControl, request.data(), request.size()); ^ /root/third-party/src/boringssl/ssl/test/handshaker.cc:256:49: error: use of undeclared identifier 'kFdControl' if (!GenerateHandshakeHint(config, request, kFdControl)) { ^ /root/third-party/src/boringssl/ssl/test/handshaker.cc:260:29: error: use of undeclared identifier 'kFdProxyToHandshaker' if (!Handshaker(config, kFdProxyToHandshaker, kFdHandshakerToProxy, ^ /root/third-party/src/boringssl/ssl/test/handshaker.cc:260:51: error: use of undeclared identifier 'kFdHandshakerToProxy' if (!Handshaker(config, kFdProxyToHandshaker, kFdHandshakerToProxy, ^ /root/third-party/src/boringssl/ssl/test/handshaker.cc:261:30: error: use of undeclared identifier 'kFdControl' request, kFdControl)) { ^ 12 errors generated. --- ssl/test/CMakeFiles/handshaker.dir/handshaker.cc.o --- *** [ssl/test/CMakeFiles/handshaker.dir/handshaker.cc.o] Error code 1

make[2]: stopped in /root/third-party/src/boringssl/build 1 error

make[2]: stopped in /root/third-party/src/boringssl/build --- ssl/test/CMakeFiles/handshaker.dir/all --- *** [ssl/test/CMakeFiles/handshaker.dir/all] Error code 2

make[1]: stopped in /root/third-party/src/boringssl/build --- crypto/CMakeFiles/crypto_test.dir/all --- *** [crypto/CMakeFiles/crypto_test.dir/all] Error code 6

make[1]: stopped in /root/third-party/src/boringssl/build --- ssl/test/CMakeFiles/bssl_shim.dir/all --- *** [ssl/test/CMakeFiles/bssl_shim.dir/all] Error code 6

make[1]: stopped in /root/third-party/src/boringssl/build

Error 2:

/usr/local/bin/ld: /root/third-party/src/lmdb/libraries/liblmdb/mdb_stat.c:237: undefined reference to mdb_dbi_open' /usr/local/bin/ld: /root/third-party/src/lmdb/libraries/liblmdb/mdb_stat.c:242: undefined reference tomdb_stat' /usr/local/bin/ld: /root/third-party/src/lmdb/libraries/liblmdb/mdb_stat.c:248: undefined reference to mdb_dbi_close' /usr/local/bin/ld: /root/third-party/src/lmdb/libraries/liblmdb/mdb_stat.c:250: undefined reference tomdb_cursor_close' /usr/local/bin/ld: /root/third-party/src/lmdb/libraries/liblmdb/mdb_stat.c:226: undefined reference to mdb_strerror' /usr/local/bin/ld: /root/third-party/src/lmdb/libraries/liblmdb/mdb_stat.c:244: undefined reference tomdb_strerror' collect2: error: ld returned 1 exit status *** Error code 1

Stop. make: stopped in /root/third-party/src/lmdb/libraries/liblmdb Cloning into 'curl'...

Error 3: make: "/root/third-party/src/ModSecurity/Makefile" line 3441: Need an operator make: "/root/third-party/src/ModSecurity/Makefile" line 3443: Need an operator make: "/root/third-party/src/ModSecurity/Makefile" line 3445: Need an operator make: "/root/third-party/src/ModSecurity/Makefile" line 3449: Need an operator make: "/root/third-party/src/ModSecurity/Makefile" line 3453: Need an operator make: "/root/third-party/src/ModSecurity/Makefile" line 3455: Need an operator make: "/root/third-party/src/ModSecurity/Makefile" line 3468: Need an operator make: "/root/third-party/src/ModSecurity/Makefile" line 3470: Error in archive specification: "" make: "/root/third-party/src/ModSecurity/Makefile" line 3475: warning: duplicate script for target "ifeq" ignored make: "/root/third-party/src/ModSecurity/Makefile" line 3452: warning: using previous script for "ifeq" defined here make: "/root/third-party/src/ModSecurity/Makefile" line 3476: Need an operator make: "/root/third-party/src/ModSecurity/Makefile" line 3477: warning: duplicate script for target "ifeq" ignored make: "/root/third-party/src/ModSecurity/Makefile" line 3452: warning: using previous script for "ifeq" defined here make: "/root/third-party/src/ModSecurity/Makefile" line 3477: warning: duplicate script for target "(no,yes)" ignored make: "/root/third-party/src/ModSecurity/Makefile" line 3452: warning: using previous script for "(no,yes)" defined here make: "/root/third-party/src/ModSecurity/Makefile" line 3478: Need an operator make: "/root/third-party/src/ModSecurity/Makefile" line 3480: Need an operator make: "/root/third-party/src/ModSecurity/Makefile" line 3481: Need an operator make: "/root/third-party/src/ModSecurity/Makefile" line 3483: Need an operator make: Fatal errors encountered -- cannot continue make: stopped in /root/third-party/src/ModSecurity cp: src/.libs/libmodsecurity.a: No such file or directory liblsquic Need to git download the submodule ... Cloning into 'lsquic'...

Error 4 (Final):

[ 78%] Built target ssi [ 78%] Building CXX object src/sslpp/CMakeFiles/sslpp.dir/sslsesscache.cpp.o In file included from /root/openlitespeed-master/src/sslpp/sslocspstapling.cpp:46: /root/openlitespeed-master/src/sslpp/ocsp/ocsp.h:153:1: error: unknown type name 'DECLARE_ASN1_SET_OF' DECLARE_ASN1_SET_OF(OCSP_ONEREQ) ^ /root/openlitespeed-master/src/sslpp/ocsp/ocsp.h:153:33: error: expected ';' after top level declarator DECLARE_ASN1_SET_OF(OCSP_ONEREQ) ^ ; /root/openlitespeed-master/src/sslpp/ocsp/ocsp.h:287:1: error: unknown type name 'DECLARE_ASN1_SET_OF' DECLARE_ASN1_SET_OF(OCSP_SINGLERESP) ^ /root/openlitespeed-master/src/sslpp/ocsp/ocsp.h:287:37: error: expected ';' after top level declarator DECLARE_ASN1_SET_OF(OCSP_SINGLERESP) ^ ; 4 errors generated. --- src/sslpp/CMakeFiles/sslpp.dir/sslocspstapling.cpp.o --- *** [src/sslpp/CMakeFiles/sslpp.dir/sslocspstapling.cpp.o] Error code 1

make[2]: stopped in /root/openlitespeed-master/build *** [all] Error code 6

make: stopped in /root/openlitespeed-master/build 1 error

make: stopped in /root/openlitespeed-master/build cp: build/src/openlitespeed: No such file or directory cp: build/src/modules/modreqparser/.so: No such file or directory cp: build/src/modules/modinspector/.so: No such file or directory cp: build/src/modules/uploadprogress/*.so: No such file or directory Start to pack files. Building finished, please run ./install.sh for installation. You may want to update the ols.conf to change the settings before installation. Enjoy.

So these are the errors I get during build. By the way, I tried to re-format my OS, install the necessary packages like;

pkg install png jpeg-turbo freetype2 cclient icu libxslt libzip libiconv libsodium libgd re2c bison ruby ImageMagick7 libmaxminddb rcs expat udns wget curl lang/gcc cmake git libtool autoconf automake go patch python gmake libxml2 modsecurity3-3.0.5 perl5-5.32.1_1 pcre pcre2

..thinking got the errors above, due to lack of them, but nothing changed. Any idea, help or suggestion would be much appreciated!

Regards.

root@test:~/# uname -a
FreeBSD test 13.0-RELEASE FreeBSD 13.0-RELEASE #0
kalleboy commented 2 years ago

Update: I've now tried the same installation steps on a FreeBSD 12.2 (latest version of 12.x branch), absolutely same build errors occur:

[ 93%] Building CXX object src/thread/CMakeFiles/thread.dir/offloader.cpp.o In file included from /root/openlitespeed-1.7.14/src/sslpp/sslocspstapling.cpp:46: /root/openlitespeed-1.7.14/src/sslpp/ocsp/ocsp.h:153:1: error: unknown type name 'DECLARE_ASN1_SET_OF' DECLARE_ASN1_SET_OF(OCSP_ONEREQ) ^ /root/openlitespeed-1.7.14/src/sslpp/ocsp/ocsp.h:153:33: error: expected ';' after top level declarator DECLARE_ASN1_SET_OF(OCSP_ONEREQ) ^ ; /root/openlitespeed-1.7.14/src/sslpp/ocsp/ocsp.h:287:1: error: unknown type name 'DECLARE_ASN1_SET_OF' DECLARE_ASN1_SET_OF(OCSP_SINGLERESP) ^ /root/openlitespeed-1.7.14/src/sslpp/ocsp/ocsp.h:287:37: error: expected ';' after top level declarator DECLARE_ASN1_SET_OF(OCSP_SINGLERESP) ^ ; 4 errors generated. --- src/sslpp/CMakeFiles/sslpp.dir/sslocspstapling.cpp.o --- *** [src/sslpp/CMakeFiles/sslpp.dir/sslocspstapling.cpp.o] Error code 1

make[2]: stopped in /root/openlitespeed-1.7.14/build 1 error

make[2]: stopped in /root/openlitespeed-1.7.14/build --- src/sslpp/CMakeFiles/sslpp.dir/all --- *** [src/sslpp/CMakeFiles/sslpp.dir/all] Error code 2

make[1]: stopped in /root/openlitespeed-1.7.14/build --- src/thread/CMakeFiles/thread.dir/all --- *** [src/thread/CMakeFiles/thread.dir/all] Error code 2

make[1]: stopped in /root/openlitespeed-1.7.14/build 2 errors

make[1]: stopped in /root/openlitespeed-1.7.14/build *** [all] Error code 2

make: stopped in /root/openlitespeed-1.7.14/build 1 error

make: stopped in /root/openlitespeed-1.7.14/build cp: build/src/openlitespeed: No such file or directory cp: build/src/modules/modreqparser/.so: No such file or directory cp: build/src/modules/modinspector/.so: No such file or directory cp: build/src/modules/uploadprogress/*.so: No such file or directory You must reboot the server to ensure the settings change take effect. Start to pack files. Building finished, please run ./install.sh for installation. You may want to update the ols.conf to change the settings before installation. Enjoy.

root@test:~/openlitespeed-1.7.14 # uname -a FreeBSD test 12.2-RELEASE FreeBSD 12.2-RELEASE r366954 GENERIC amd64

karlisk commented 2 years ago

I think it's the same problem as on Ubuntu: Build error at sslpp #289

Just like you under FreeBSD, I've also tried running the build with different Distro release version under Ubuntu, but this error breaks the build in all of them.

I've tried going through the commit history to potentially find a working build, but so far have been unsuccessful - maybe the problem isn't with "sslocspstapling.cpp" but with changes to the build script for 'sslpp'.

kalleboy commented 2 years ago

Thanks for your reply @karlisk - it seems noone answers here :/ Theese are serious build bugs/errors (in the end the installation gets interrupted) - however they aren't interested..

karlisk commented 2 years ago

Thanks for your reply @karlisk - it seems noone answers here :/ Theese are serious build bugs/errors (in the end the installation gets interrupted) - however they aren't interested..

I doubt lack of activity is any indication of lack of motivation or action - my uneducated guess is that active development happens behind scenes in private repos dedicated to the paid enterprise version. Changes/updates probably get merged after they've been implemented into the enterprise version, at least that's what it seems like judging by how carefully the pull requests are processed (probably to avoid merge conflicts when pushing in updates already applied to the enterprise version repos). Also guessing that fixes / replies are posted only when there's something to post, tho seeing some indication confirming bugs / errors would be nice.

karlisk commented 2 years ago

It is odd tho that this, based on what I've experienced, affects any build - that would mean the builds for OSS releases also should be broken. Maybe grabbing SRPM for a RHEL/CentOS release and inspecting the SPEC files (or the equivalent files for Ubuntu) might reveal any workarounds/fixes needed? Due to little experience with BSD, I'm unsure about FreeBSD - are there any precompiled binaries available from repos (my understanding was that everything always gets built on the target machine from sources)?

kalleboy commented 2 years ago

I doubt lack of activity is any indication of lack of motivation or action.

An action usually and basically requires (further) information. It seems, they aren't interested in need of (getting further) information, on the issue we talk about here.

No, there's no precompiled binary available for OLS on FreeBSD.

litespeedtech commented 2 years ago

Please try the latest code in v1_7 branch, it should compile with updated boringSSL.

kalleboy commented 2 years ago

Please try the latest code in v1_7 branch, it should compile with updated boringSSL.

Hello, thanks for your reply.

Tried the latest code in v1_7 branch. The same error(s) happened. Please see the screenshots;

BoringSSL build error: https://ibb.co/qMxFt0L liblmdb error: https://ibb.co/3Bn80Ry libmaxminddb-error: https://ibb.co/tb3TGvj udns error: https://ibb.co/wM06yQX Final build error: https://ibb.co/zbM892f

litespeedtech commented 2 years ago

Sorry, there is not much we can do with third-party library build failure. FreeBSD build tool chain need to be fixed. It may involve switching compiler, add more macros, patch system header files, etc.

kalleboy commented 2 years ago

Sorry, there is not much we can do with third-party library build failure. FreeBSD build tool chain need to be fixed. It may involve switching compiler, add more macros, patch system header files, etc.

Thanks for your reply. How to disable those modules and prevent their installation on FreeBSD, at least?

Just to achieve an OpenLiteSpeed + PHP (I handle the PHP setup, myself, no problem with that) without any 3rd party modules..

If that's not possible too, should we declare FreeBSD as unsupported OS for OpenLiteSpeed? That's a huge loss, I can say :(

1- How to disable installation of BoringSSL, liblmdb, libmaxminddb, udns with OpenLiteSpeed? 2- How to point theBoringSSL in the FreeBSD's ports (/usr/ports) which gets compiled successfully, to OpenLiteSpeed, so that it can use this one?

These third-party libraries are all compiling and running fine under "/usr/ports", please see;

https://www.freshports.org/net/libmaxminddb/ https://www.freshports.org/databases/lmdb/ https://www.freshports.org/dns/udns/ https://www.freshports.org/security/boringssl/

Why not use them, instead of fetching them from their repositories and trying to compile?

3- Is it even possible to use OpenSSL and reject BoringSSL totally? Google says:

BoringSSL is a fork of OpenSSL that is designed to meet Google's needs.

Although BoringSSL is an open source project, it is not intended for general use, as OpenSSL is. We don't recommend that third parties depend upon it. Doing so is likely to be frustrating because there are no guarantees of API or ABI stability.

Programs ship their own copies of BoringSSL when they use it and we update everything as needed when deciding to make API changes. This allows us to mostly avoid compromises in the name of compatibility. It works for us, but it may not work for you.

litespeedtech commented 2 years ago

Yes, those libraries will compile fine, and OLS will compile in FreeBSD, it just need tweaks with the build tool chain. We need specific version of BoringSSL, it is required to be compiled from source, but failures in build the tests can be ignored, the library works. To use libraries from ports, you need to update CMakeList.txt to link against /usr/local/lib, but it may end up with version compatibility issues. Anyway, FreeBSD need a lot more efforts to compile, but it is the fun part for people stick with FreeBSD. :-)

kalleboy commented 2 years ago

Thanks for your return.

How to set OLS to not install anything (no Quic/HTTP3/BoringSSL, ModSecurity and geoip stuff) but only itself? Would commenting these lines do that?

https://github.com/litespeedtech/openlitespeed/blob/master/CMakeLists.txt#L134:L150

kalleboy commented 2 years ago

Sorry for the bump but anyone?

karlisk commented 2 years ago

Looking at the /build.sh and /dist/install.sh

In build.sh here is this bit of relevance:

cd ..
if [ ! -d third-party ]; then

    git clone https://github.com/litespeedtech/third-party.git
    mkdir third-party/lib64
    cd third-party/script/

    #Remove  unittest-cpp and add bcrypt
    sed -i -e "s/unittest-cpp/bcrypt/g" ./build_ols.sh

    if [ "${ISLINUX}" != "yes" ] || [ "${MACHINE}" != "x86_64" ] ; then
        sed -i -e "s/psol/ /g"  ./build_ols.sh
    fi

    ./build_ols.sh

fi

Which, downloads the third-party from which it runs the /script/build_ols.sh in which it has the following line of relevance: BUILD_LIBS="brotli zlib bssl bcrypt expat geoip ip2loc libmaxminddb luajit pcre psol udns unittest-cpp lmdb curl libxml2 yajl libmodsec"

From this I can tell you that you can in theory run a build without third party plugins like ModSecurity or GeoIP... but I'd avoid doing that because I'm not sure if OLS will even run without those modules.

But if you want to go ahead, you can try modifying /build.sh to have this line instead (this should leave in stuff that I'm pretty sure is absolutely necessary, like 'zlib', 'pcre', 'luajit', and so on ... I don't know about BooringSSL, but I'm pretty sure it's critical dependency, so I'd avoid excluding 'bssl'):

    #Remove  3rd party modules
    sed -i -e "s/unittest-cpp/bcrypt/geoip/ip2loc/libmaxminddb/psol/lmdb/libmodsec/g" ./build_ols.sh