添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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

Hello,

i am trying since two days to complie the libwebsocket for my raspberry Pi 3.
I am trying with the normal jessie linux.
i am installed build-essential, cmake, libssl-dev, openssl-1.1.0c.
All passed.
Openssl is found in /usr/lib and /usr/include.
I run cmake without IPV6 and all ok.
But i can't make libwebsockets. There are thousend of errors while make it.
All errors are in ssl headers. Thinks linke "expected '=', ','......... before '{' token DEFINE .........

I am think that ssl isn't the problem. The ssl test and installing are passed good.
I am tring with differend openssl versions, too.

If i run the cmake without ssl, the make works good.
But i want to use the ssl in my project!

I don'T have any ideas what to try now.

Well I have built it on an rpi3 using debian before, I don't remember any problems. I switched it to Fedora after that.

Why don't you paste the first few errors verbatim?

Here are the output from the first lines.

[  1%] Building C object CMakeFiles/websockets.dir/lib/base64-decode.c.o
In file included from /usr/include/openssl/ssl.h:48:0,
                 from /home/pi/libwebsockets/lib/private-libwebsockets.h:274,
                 from /home/pi/libwebsockets/lib/base64-decode.c:43:
/usr/include/openssl/bio.h: In function 'DEPRECATEDIN_1_1_0':
/usr/include/openssl/bio.h:671:1: error: expected declaration specifiers before 'DEPRECATEDIN_1_1_0'
 DEPRECATEDIN_1_1_0(int BIO_get_port(const char *str, unsigned short *port_ptr))
/usr/include/openssl/bio.h:678:2: error: expected declaration specifiers before ';' token
In file included from /usr/include/openssl/buffer.h:23:0,
                 from /usr/include/openssl/x509.h:22,
                 from /usr/include/openssl/ssl.h:50,
                 from /home/pi/libwebsockets/lib/private-libwebsockets.h:274,
                 from /home/pi/libwebsockets/lib/base64-decode.c:43:
/usr/lib/gcc/arm-linux-gnueabihf/4.9/include/stddef.h:147:26: error: storage class specified for parameter 'ptrdiff_t'
 typedef __PTRDIFF_TYPE__ ptrdiff_t;
In file included from /usr/include/openssl/asn1.h:24:0,
                 from /usr/include/openssl/objects.h:916,
                 from /usr/include/openssl/evp.h:27,
                 from /usr/include/openssl/x509.h:23,
                 from /usr/include/openssl/ssl.h:50,
                 from /home/pi/libwebsockets/lib/private-libwebsockets.h:274,
                 from /home/pi/libwebsockets/lib/base64-decode.c:43:
/usr/include/openssl/bn.h:285:1: error: expected declaration specifiers before 'DEPRECATEDIN_0_9_8'
 DEPRECATEDIN_0_9_8(BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe,
/usr/include/openssl/bn.h:361:1: error: expected declaration specifiers before 'DEPRECATEDIN_0_9_8'
 DEPRECATEDIN_0_9_8(void BN_set_params(int mul, int high, int low, int mont))
In file included from /usr/include/openssl/crypto.h:29:0,
                 from /usr/include/openssl/comp.h:16,
                 from /usr/include/openssl/ssl.h:47,
                 from /home/pi/libwebsockets/lib/private-libwebsockets.h:274,
                 from /home/pi/libwebsockets/lib/base64-decode.c:43:
/usr/include/openssl/asn1.h:120:1: error: storage class specified for parameter 'sk_X509_ALGOR_compfunc'
 DEFINE_STACK_OF(X509_ALGOR)
/usr/include/openssl/asn1.h:120:1: error: storage class specified for parameter 'sk_X509_ALGOR_freefunc'
 DEFINE_STACK_OF(X509_ALGOR)
/usr/include/openssl/asn1.h:120:1: error: storage class specified for parameter 'sk_X509_ALGOR_copyfunc'
 DEFINE_STACK_OF(X509_ALGOR)
/usr/include/openssl/asn1.h:120:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 DEFINE_STACK_OF(X509_ALGOR)
/usr/include/openssl/asn1.h:120:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 DEFINE_STACK_OF(X509_ALGOR)
/usr/include/openssl/asn1.h:120:1: error: expected declaration specifiers or '...' before 'sk_X509_ALGOR_compfunc'
 DEFINE_STACK_OF(X509_ALGOR)
/usr/include/openssl/asn1.h:120:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 DEFINE_STACK_OF(X509_ALGOR)
/usr/include/openssl/asn1.h:120:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 DEFINE_STACK_OF(X509_ALGOR)
/usr/include/openssl/asn1.h:120:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 DEFINE_STACK_OF(X509_ALGOR)
/usr/include/openssl/asn1.h:120:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 DEFINE_STACK_OF(X509_ALGOR)
/usr/include/openssl/asn1.h:120:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 DEFINE_STACK_OF(X509_ALGOR)
/usr/include/openssl/asn1.h:120:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 DEFINE_STACK_OF(X509_ALGOR)
/usr/include/openssl/asn1.h:120:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 DEFINE_STACK_OF(X509_ALGOR)
/usr/include/openssl/asn1.h:120:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 DEFINE_STACK_OF(X509_ALGOR)
/usr/include/openssl/asn1.h:120:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 DEFINE_STACK_OF(X509_ALGOR)
/usr/include/openssl/asn1.h:120:1: error: expected declaration specifiers or '...' before 'sk_X509_ALGOR_freefunc'
 DEFINE_STACK_OF(X509_ALGOR)
/usr/include/openssl/asn1.h:120:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 DEFINE_STACK_OF(X509_ALGOR)
/usr/include/openssl/asn1.h:120:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 DEFINE_STACK_OF(X509_ALGOR)
/usr/include/openssl/asn1.h:120:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 DEFINE_STACK_OF(X509_ALGOR)
/usr/include/openssl/asn1.h:120:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 DEFINE_STACK_OF(X509_ALGOR)
/usr/include/openssl/asn1.h:120:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 DEFINE_STACK_OF(X509_ALGOR)
/usr/include/openssl/asn1.h:120:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 DEFINE_STACK_OF(X509_ALGOR)
/usr/include/openssl/asn1.h:120:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 DEFINE_STACK_OF(X509_ALGOR)
/usr/include/openssl/asn1.h:120:1: error: expected declaration specifiers or '...' before 'sk_X509_ALGOR_copyfunc'
 DEFINE_STACK_OF(X509_ALGOR)
/usr/include/openssl/asn1.h:120:1: error: expected declaration specifiers or '...' before 'sk_X509_ALGOR_freefunc'
 DEFINE_STACK_OF(X509_ALGOR)
/usr/include/openssl/asn1.h:120:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'sk_X509_ALGOR_set_cmp_func'
 DEFINE_STACK_OF(X509_ALGOR)
In file included from /usr/include/openssl/objects.h:916:0,
                 from /usr/include/openssl/evp.h:27,
                 from /usr/include/openssl/x509.h:23,
                 from /usr/include/openssl/ssl.h:50,
                 from /home/pi/libwebsockets/lib/private-libwebsockets.h:274,
                 from /home/pi/libwebsockets/lib/base64-decode.c:43:
/usr/include/openssl/asn1.h:167:3: error: storage class specified for parameter 'ASN1_ENCODING'
 } ASN1_ENCODING;
/usr/include/openssl/asn1.h:191:3: error: storage class specified for parameter 'ASN1_STRING_TABLE'
 } ASN1_STRING_TABLE;
In file included from /usr/include/openssl/crypto.h:29:0,
                 from /usr/include/openssl/comp.h:16,
                 from /usr/include/openssl/ssl.h:47,
                 from /home/pi/libwebsockets/lib/private-libwebsockets.h:274,
                 from /home/pi/libwebsockets/lib/base64-decode.c:43:
/usr/include/openssl/asn1.h:193:1: error: expected ';', ',' or ')' before '*' token
 DEFINE_STACK_OF(ASN1_STRING_TABLE)
/usr/include/openssl/asn1.h:193:1: error: expected declaration specifiers or '...' before 'ASN1_STRING_TABLE'
 DEFINE_STACK_OF(ASN1_STRING_TABLE)
/usr/include/openssl/asn1.h:193:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
 DEFINE_STACK_OF(ASN1_STRING_TABLE)
/usr/include/openssl/asn1.h:193:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
 DEFINE_STACK_OF(ASN1_STRING_TABLE)
          

Mmmm I download latest openssl from git and have a look, because Fedora 25 Openssl doesn't have that DEPRECATED... string, it's still 1.0.2

What I find is that it is declared initially in ./include/openssl/opensslconf.h.in. I guess, because of the .in, when you build openssl, it gets processed into opensslconf.h.

Many other includes have #include <openssl/opensslconf.h> at the top.

So I can imagine two ways to get this problem

You did something a bit avant garde and copied the dist ./include/* into /usr/include by hand. Then there is no openssl/opensslconf.h; if you copied it over the distro openssl version, the old opensslconf.h will remain there, clueless about this new define. You should install using make install or similar that is part of openssl... that will install the generated conf include

There might be some new precedence requirement about order of #include openssl files now that we don't know about; you have to first include one that brings in openssl/opensslconf.h

Anything sound familiar?

No, i don't understand what to do.
Here are my standard include files for openssl
There is no .in

pi@raspberrypi:/usr/include/openssl $ dir aes.h bio.h cast.h conf.h dh.h ecdh.h err.h krb5_asn.h md5.h ocsp.h pem.h rc2.h safestack.h ssl23.h symhacks.h ui.h asn1.h blowfish.h cmac.h crypto.h dsa.h ecdsa.h evp.h kssl.h mdc2.h opensslconf.h pkcs12.h rc4.h seed.h ssl2.h tls1.h whrlpool.h asn1_mac.h bn.h cms.h ct.h dso.h ec.h hmac.h lhash.h modes.h opensslv.h pkcs7.h rc5.h sha.h ssl3.h ts.h x509.h asn1t.h buffer.h comp.h des.h dtls1.h engine.h idea.h md2.h objects.h ossl_typ.h pqueue.h ripemd.h srp.h ssl.h txt_db.h x509v3.h async.h camellia.h conf_api.h des_old.h ebcdic.h e_os2.h kdf.h md4.h obj_mac.h pem2.h rand.h rsa.h srtp.h stack.h ui_compat.h x509_vfy.h

According to this

https://packages.debian.org/search?keywords=openssl

Jessie is on 1.0.1... is that really giving you errors about DEPRECATEDIN_1_1_0?

Sid is on 1.1.0... did you build the later openssl yourself or install the sid package?

i downloaded openssl from ftp.openssl.org/source/...
i tried the old version: openssl-1.0.2h.tar.gz
and the actually version: openssl-1.1.0c.tar.gz
i build it by myself. (make depend, make, make test, make, make install)

  • A lot of packages default to install in /usr/local/... worth checking that... in fact https://wiki.openssl.org/index.php/Compilation_and_Installation specifically warns against installing on top of the distro base path /usr
  • PREFIX and OPENSSLDIR
    --prefix and --openssldir control the configuration of installed components. The behavior and interactions of --prefix and --openssldir are slightly different between OpenSSL 1.0.2 and below, and OpenSSL 1.1.0 and above.
    The rule of thumb to use when you want something that "just works" for all recent versions of OpenSSL, including OpenSSL 1.0.2 and 1.1.0, is:
        specify both --prefix and --openssldir
        set --prefix and --openssldir to the same location
    One word of caution is avoid --prefix=/usr when OpenSSL versions are not binary compatible. You will replace the distro's version of OpenSSL with your version of OpenSSL. It will most likely break everything, including the package management system. 
    
  • But you are saying 'same issues'... that's a big clue if so because 1.0.x openssl includes will not contain the string DEPRECATEDIN_1_1_0.
  • Really the same or first few errors different?

  • not seeing any problem in lws yet...
  •