Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build error for version 2.0.3 and 2.1 #666

Closed
annaseufert opened this issue Nov 10, 2016 · 6 comments
Closed

Build error for version 2.0.3 and 2.1 #666

annaseufert opened this issue Nov 10, 2016 · 6 comments

Comments

@annaseufert
Copy link

When I try to build version 2.0.3 or 2.1.0, I get this error:

-- Configuring done
-- Generating done
-- Build files have been written to: /home/developer/workspace_clion/dev/contrib/libwebsockets/libwebsockets-2.1.0/build
Scanning dependencies of target websockets
[  1%] Building C object CMakeFiles/websockets.dir/lib/base64-decode.c.o
[  2%] Building C object CMakeFiles/websockets.dir/lib/handshake.c.o
[  3%] Building C object CMakeFiles/websockets.dir/lib/libwebsockets.c.o
[  5%] Building C object CMakeFiles/websockets.dir/lib/service.c.o
[  6%] Building C object CMakeFiles/websockets.dir/lib/pollfd.c.o
[  7%] Building C object CMakeFiles/websockets.dir/lib/output.c.o
[  9%] Building C object CMakeFiles/websockets.dir/lib/parsers.c.o
[ 10%] Building C object CMakeFiles/websockets.dir/lib/context.c.o
[ 11%] Building C object CMakeFiles/websockets.dir/lib/alloc.c.o
[ 12%] Building C object CMakeFiles/websockets.dir/lib/header.c.o
[ 14%] Building C object CMakeFiles/websockets.dir/lib/client.c.o
[ 15%] Building C object CMakeFiles/websockets.dir/lib/client-handshake.c.o
[ 16%] Building C object CMakeFiles/websockets.dir/lib/client-parser.c.o
[ 18%] Building C object CMakeFiles/websockets.dir/lib/ssl.c.o
[ 19%] Building C object CMakeFiles/websockets.dir/lib/ssl-server.c.o
[ 20%] Building C object CMakeFiles/websockets.dir/lib/ssl-client.c.o
cc1: warnings being treated as errors
/home/developer/workspace_clion/dev/contrib/libwebsockets/libwebsockets-2.1.0/lib/ssl-client.c: In function 'lws_ssl_client_bio_create':
/home/developer/workspace_clion/dev/contrib/libwebsockets/libwebsockets-2.1.0/lib/ssl-client.c:58: error: implicit declaration of function 'SSL_get0_param'
/home/developer/workspace_clion/dev/contrib/libwebsockets/libwebsockets-2.1.0/lib/ssl-client.c:58: error: assignment makes pointer from integer without a cast
/home/developer/workspace_clion/dev/contrib/libwebsockets/libwebsockets-2.1.0/lib/ssl-client.c:60: error: implicit declaration of function 'X509_VERIFY_PARAM_set_hostflags'
/home/developer/workspace_clion/dev/contrib/libwebsockets/libwebsockets-2.1.0/lib/ssl-client.c:61: error: 'X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS' undeclared (first use in this function)
/home/developer/workspace_clion/dev/contrib/libwebsockets/libwebsockets-2.1.0/lib/ssl-client.c:61: error: (Each undeclared identifier is reported only once
/home/developer/workspace_clion/dev/contrib/libwebsockets/libwebsockets-2.1.0/lib/ssl-client.c:61: error: for each function it appears in.)
/home/developer/workspace_clion/dev/contrib/libwebsockets/libwebsockets-2.1.0/lib/ssl-client.c:62: error: implicit declaration of function 'X509_VERIFY_PARAM_set1_host'
make[2]: *** [CMakeFiles/websockets.dir/lib/ssl-client.c.o] Error 1
make[1]: *** [CMakeFiles/websockets.dir/all] Error 2

what my build script does:

cmake -DCMAKE_TOOLCHAIN_FILE=$CURRENT_DIR/toolchain-armv5te.cmake -DCMAKE_BUILD_TYPE=Release $OPENSSL_LIB_PATH  $CURRENT_DIR/$LWS_DIR
cmake --build . --config Release

Do you have any idea how to solve this?

@lws-team
Copy link
Member

The missing function exists in OpenSSL 1.0.2 and above.

https://www.openssl.org/docs/man1.0.2/ssl/SSL_get0_param.html

Either

  • update your OpenSSL
  • if your cross OpenSSL is >= 1.0.2, since you are building cross, you may be picking up OpenSSL includes from your native build machine instead of the cross build OpenSSL if that has an older OpenSSL
  • if you don't actually care about clientside lws functionality, dodge the issue by disabling it at cmake with LWS_WITHOUT_CLIENT

I don't recommend disabling just the code trying to use the OpenSSL apis that make trouble, by, eg, more #ifdef or whatever. Because it enforces OpenSSL to check the server hostname used to make the connection matches a valid name in the server cert, which you will want if you want client ssl connections at all.

@annaseufert
Copy link
Author

Regarding your points:

  1. I used OpenSSL 1.0.2g. Now it's updated to 1.1.0c, but the problem still occurs.
  2. The include directory of the OpenSSL cross build is correct aswell.
    When I build lws, it prints just the right location
    OpenSSL include dir: /home/developer/workspace_clion/dev/contrib/openssl/arm/include/openssl
  3. And - unfortunately - I especially need the clientside lws funtionality

Thanks for your help! Maybe you have some more ideas?
(2.0.0 worked just fine - if that helps)

@lws-team
Copy link
Member

I used OpenSSL 1.0.2g
It should have the api then...

(2.0.0 worked just fine - if that helps)
It didn't try to use this api.

If I look for the api definition on my Fedora box, it's like this

$ grep SSL_get0_param /usr/include/openssl/ -R
/usr/include/openssl/ssl.h:X509_VERIFY_PARAM *SSL_get0_param(SSL *ssl);

If you go looking for it down /home/developer/workspace_clion/dev/contrib/openssl/arm/include/openssl where is it found by grep?

Does it change anything if you move your native includes out of the way temporarily?

sudo mv /usr/include/openssl /root or so

@annaseufert
Copy link
Author

grep also finds it in my dir:

$ grep SSL_get0_param /home/developer/workspace_clion/dev/contrib/openssl/arm/include/openssl -R 
/home/developer/workspace_clion/dev/contrib/openssl/arm/include/openssl/ssl.h:__owur X509_VERIFY_PARAM *SSL_get0_param(SSL *ssl);

OpenSSL is not in my native includes, so there's nothing to move out of the way...

@lws-team
Copy link
Member

lws-team commented Nov 14, 2016

Right, but

  1. you are getting
/home/developer/workspace_clion/dev/contrib/libwebsockets/libwebsockets-2.1.0/lib/ssl-client.c:58: error: implicit declaration of function 'SSL_get0_param'
  1. You have the declaration in

/home/developer/workspace_clion/dev/contrib/openssl/arm/include/openssl/ssl.h

  1. You think you are including it

OpenSSL include dir: /home/developer/workspace_clion/dev/contrib/openssl/arm/include/openssl

Unless I miss the point somewhere, it seems not everything that you think is happening, is happening.

How about

  1. temporarily hack a line of trash near the top of /home/developer/workspace_clion/dev/contrib/openssl/arm/include/openssl/ssl.h like just

x

or so that isn't legal C, and see if the compiler chokes on it or not when you rebuild.

  1. internally, lws is including that file like this

#include <openssl/ssl.h>

Then it seems it would expect the include path to just be

/home/developer/workspace_clion/dev/contrib/openssl/arm/include

Can you try that?

@annaseufert
Copy link
Author

i found it!

the previous developer defined the openssl path like this in the bash script:

OPENSSL_LIB_PATH+=" -DLWS_OPENSSL_INCLUDE_DIRS=$CURRENT_DIR/../openssl/arm/include/openssl"
OPENSSL_LIB_PATH+=" -DLWS_OPENSSL_LIBRARIES=$CURRENT_DIR/../openssl/arm/lib/libssl.so;$CURRENT_DIR/../openssl/arm/lib/libcrypto.so"

The second line is the "evil" one. Now i erased it and everything is fine :)
Thanks a lot for the support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants