wahern / luaossl

Most comprehensive OpenSSL module in the Lua universe.
http://25thandclement.com/~william/projects/luaossl.html
Other
140 stars 49 forks source link

Compilation fails on Rocky 8.7 #211

Closed 4mig4 closed 1 year ago

4mig4 commented 1 year ago

Compilation of luaossl fails on :

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.rockylinux.org/ --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --disable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 8.5.0 20210514 (Red Hat 8.5.0-16) (GCC) 

with:

$ luarocks install luaossl
Warning: falling back to wget - install luasec to get native HTTPS support
Installing https://luarocks.org/luaossl-20220711-0.src.rock

luaossl 20220711-0 depends on lua (5.1-1 provided by VM)
Applying patch config.h.diff...
Hunk 1 found at offset 2...
gcc -O2 -fPIC -I/home/user1/.luaver/lua/5.1.5/include -c src/openssl.c -o src/openssl.o -D_REENTRANT -D_THREAD_SAFE -DCOMPAT53_PREFIX=luaossl -D_GNU_SOURCE -I/usr/include -I/usr/include
src/openssl.c:2304:3: error: conflicting types for ‘EVP_KDF_CTX’
 } EVP_KDF_CTX;
   ^~~~~~~~~~~
In file included from /usr/include/openssl/err.h:20,
                 from src/openssl.c:68:
/usr/include/openssl/ossl_typ.h:100:31: note: previous declaration of ‘EVP_KDF_CTX’ was here
 typedef struct evp_kdf_ctx_st EVP_KDF_CTX;
                               ^~~~~~~~~~~
src/openssl.c:2306:13: error: conflicting types for ‘EVP_KDF_CTX_free’
 static void EVP_KDF_CTX_free(EVP_KDF_CTX *kctx) {
             ^~~~~~~~~~~~~~~~
In file included from src/openssl.c:619:
/usr/include/openssl/kdf.h:29:6: note: previous declaration of ‘EVP_KDF_CTX_free’ was here
 void EVP_KDF_CTX_free(EVP_KDF_CTX *ctx);
      ^~~~~~~~~~~~~~~~
src/openssl.c:2427: warning: "EVP_KDF_HKDF_MODE_EXTRACT_AND_EXPAND" redefined
 #define EVP_KDF_HKDF_MODE_EXTRACT_AND_EXPAND EVP_PKEY_HKDEF_MODE_EXTRACT_AND_EXPAND

In file included from src/openssl.c:619:
/usr/include/openssl/kdf.h:65: note: this is the location of the previous definition
 # define EVP_KDF_HKDF_MODE_EXTRACT_AND_EXPAND  0

src/openssl.c:2433: warning: "EVP_KDF_HKDF_MODE_EXTRACT_ONLY" redefined
 #define EVP_KDF_HKDF_MODE_EXTRACT_ONLY EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY

In file included from src/openssl.c:619:
/usr/include/openssl/kdf.h:66: note: this is the location of the previous definition
 # define EVP_KDF_HKDF_MODE_EXTRACT_ONLY        1

src/openssl.c:2437: warning: "EVP_KDF_HKDF_MODE_EXPAND_ONLY" redefined
 #define EVP_KDF_HKDF_MODE_EXPAND_ONLY EVP_PKEY_HKDEF_MODE_EXPAND_ONLY

In file included from src/openssl.c:619:
/usr/include/openssl/kdf.h:67: note: this is the location of the previous definition
 # define EVP_KDF_HKDF_MODE_EXPAND_ONLY         2

src/openssl.c:2440:12: error: conflicting types for ‘EVP_KDF_vctrl’
 static int EVP_KDF_vctrl(EVP_KDF_CTX *kctx, int cmd, va_list args) {
            ^~~~~~~~~~~~~
In file included from src/openssl.c:619:
/usr/include/openssl/kdf.h:33:5: note: previous declaration of ‘EVP_KDF_vctrl’ was here
 int EVP_KDF_vctrl(EVP_KDF_CTX *ctx, int cmd, va_list args);
     ^~~~~~~~~~~~~
src/openssl.c:2605:12: error: conflicting types for ‘EVP_KDF_ctrl’
 static int EVP_KDF_ctrl(EVP_KDF_CTX *kctx, int cmd, ...) {
            ^~~~~~~~~~~~
In file included from src/openssl.c:619:
/usr/include/openssl/kdf.h:32:5: note: previous declaration of ‘EVP_KDF_ctrl’ was here
 int EVP_KDF_ctrl(EVP_KDF_CTX *ctx, int cmd, ...);
     ^~~~~~~~~~~~
src/openssl.c:2634:12: error: conflicting types for ‘EVP_KDF_derive’
 static int EVP_KDF_derive(EVP_KDF_CTX *kctx, unsigned char *out, size_t outlen, void *params) {
            ^~~~~~~~~~~~~~
In file included from src/openssl.c:619:
/usr/include/openssl/kdf.h:36:5: note: previous declaration of ‘EVP_KDF_derive’ was here
 int EVP_KDF_derive(EVP_KDF_CTX *ctx, unsigned char *key, size_t keylen);
     ^~~~~~~~~~~~~~
src/openssl.c: In function ‘kdf_derive’:
src/openssl.c:2427:46: error: ‘EVP_KDF_HKDF_MODE_EXTRACT_AND_EXPAND’ undeclared (first use in this function)
 #define EVP_KDF_HKDF_MODE_EXTRACT_AND_EXPAND EVP_PKEY_HKDEF_MODE_EXTRACT_AND_EXPAND
                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/openssl.c:12291:5: note: in expansion of macro ‘EVP_KDF_HKDF_MODE_EXTRACT_AND_EXPAND’
     EVP_KDF_HKDF_MODE_EXTRACT_AND_EXPAND,
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/openssl.c:2427:46: note: each undeclared identifier is reported only once for each function it appears in
 #define EVP_KDF_HKDF_MODE_EXTRACT_AND_EXPAND EVP_PKEY_HKDEF_MODE_EXTRACT_AND_EXPAND
                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/openssl.c:12291:5: note: in expansion of macro ‘EVP_KDF_HKDF_MODE_EXTRACT_AND_EXPAND’
     EVP_KDF_HKDF_MODE_EXTRACT_AND_EXPAND,
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/openssl.c:2433:40: error: ‘EVP_KDF_HKDF_MODE_EXTRACT_ONLY’ undeclared (first use in this function)
 #define EVP_KDF_HKDF_MODE_EXTRACT_ONLY EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/openssl.c:12294:5: note: in expansion of macro ‘EVP_KDF_HKDF_MODE_EXTRACT_ONLY’
     EVP_KDF_HKDF_MODE_EXTRACT_ONLY,
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/openssl.c:2437:39: error: ‘EVP_KDF_HKDF_MODE_EXPAND_ONLY’ undeclared (first use in this function)
 #define EVP_KDF_HKDF_MODE_EXPAND_ONLY EVP_PKEY_HKDEF_MODE_EXPAND_ONLY
                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/openssl.c:12297:5: note: in expansion of macro ‘EVP_KDF_HKDF_MODE_EXPAND_ONLY’
     EVP_KDF_HKDF_MODE_EXPAND_ONLY,
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: Build error: Failed compiling object src/openssl.o
daurnimator commented 1 year ago

Duplicate of https://github.com/wahern/luaossl/issues/175#issuecomment-655266000

4mig4 commented 1 year ago

set HAVE_EVP_KDF_CTX=1

I'm afraid this proposed solution will now cause a different issue with OpenSSL 1.1.1.

Since #199 (20220711):

https://github.com/wahern/luaossl/blob/247c0d9e12d2c654284c259f8cdb2a6ecf9d81b5/src/openssl.c#L624-L626

and because core_names.h does not exist in OpenSSL 1.1.1, compiling will fail with a openssl/core_names.h: No such file or directory.

This is exaclty what is happening

$ luarocks install luaossl CFLAGS="-O2 -fPIC -DHAVE_EVP_KDF_CTX=1"
Installing https://luarocks.org/luaossl-20220711-0.src.rock

luaossl 20220711-0 depends on lua (5.1-1 provided by VM)
Applying patch config.h.diff...
Hunk 1 found at offset 2...
gcc -O2 -fPIC -DHAVE_EVP_KDF_CTX=1 -I/home/user1/.luaver/lua/5.1.5/include -c src/openssl.c -o src/openssl.o -D_REENTRANT -D_THREAD_SAFE -DCOMPAT53_PREFIX=luaossl -D_GNU_SOURCE -I/usr/include -I/usr/include
src/openssl.c:623:10: fatal error: openssl/core_names.h: No such file or directory
 #include <openssl/core_names.h>
          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

Error: Build error: Failed compiling object src/openssl.o
4mig4 commented 1 year ago

solution for me was to use : luarocks install mna/luaossl