[Libwebsockets] compile warning - undefined function

andy at warmcat.com andy at warmcat.com
Sun Mar 15 20:21:12 CET 2020

On March 15, 2020 7:15:02 PM UTC, Jaco Kroon <jaco at uls.co.za> wrote:
>Hi Andy,
>On 2020/03/13 18:57, Andy Green wrote:
>> On 3/13/20 4:49 PM, Jaco Kroon wrote:
>>> Hi Andy,
>>> https://bugs.gentoo.org/709508 relates.
>>> In function ‘BN_bn2binpad’:
>>> error: implicit declaration of function ‘bn_check_top’
>>> [-Werror=implicit-function-declaration]
>>>     61 |     bn_check_top(a);
>>>        |     ^~~~~~~~~~~~
>>> cc1: all warnings being treated as errors
>>> ninja: build stopped: subcommand failed.
>>> I dug through my system quickly and honestly I'm not sure what the
>>> best way forward here is.
>> This is almost always due to not running, or problems with, the cmake
>> part of building lws.  There's definitely no problem building it on
>> 1.1.1d on any platform.
>>> Looks like bn_check_top is a #define in older versions of OpenSSL. 
>>> can confirm it was in openssl 1.0.1 but no longer in 1.1.1d.
>>> Even then it looks like it was a no-op, as in:
>>> #define b_check_top(a)
>>> Unless BN_DEBUG is defined before including.
>>> So may be OK so simply drop that line completely?
>>> Alternatively, perhaps wrap the line in #ifdef bn_check_top ...
>> Mmm if you look at the actual code it's like this
>> #if !defined(LWS_HAVE_BN_bn2binpad)
>> int BN_bn2binpad(const BIGNUM *a, unsigned char *to, int tolen)
>> {
>>     int i;
>>     BN_ULONG l;
>>     bn_check_top(a);
>> ie, it's already wrapped with LWS_HAVE_BN_bn2binpad... 1.1.1d has its
>> own bn2binpad, which cmake looks for
>Yea.  And because I'm using openssl 1.1.1d and the user of the system
>reporting the bug is using libressl ... *boom*.

That doesn't mean anything to me.

This problem is supposed to be coming on openssl 1.1.1d or some version of libressl (which?)

>Anyway, I've reverted to Gentoo's libressl guys, hopefully they'll let
>us know what needs to happen, might end being:
>+#ifdef bn_check_top
>     bn_check_top(a)
>I'm assuming you'll object to that?  Or do you perhaps have some other
>alternative suggestion?

Yes, debug it as suggested already -->

>> make a temporary ./build2 or whatever and do a fresh cmake in there, check if it can find OpenSSL's bn2binpad, if not, search ./build2/CMakeFiles/CMakeError.log and look for what happened when it checked if the function existed


>Kind Regards,

More information about the Libwebsockets mailing list