错误:调用未声明的函数“OPENSSL_sk_find_all”

问题描述 投票:0回答:1

尝试在 OSX v13 上的 Python 3.10 上安装 M2Crypto==0.41.0,但遇到很多类似的错误,例如:

src/SWIG/_m2crypto_wrap.c:10746:17: error: call to undeclared function 'OPENSSL_sk_find_all'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        result = (int)OPENSSL_sk_find_all(arg1,(void const *)arg2,arg3);
                      ^
      src/SWIG/_m2crypto_wrap.c:10746:17: note: did you mean 'OPENSSL_sk_find_ex'?
      /opt/homebrew/Cellar/[email protected]/1.1.1w/include/openssl/stack.h:41:5: note: 'OPENSSL_sk_find_ex' declared here
      int OPENSSL_sk_find_ex(OPENSSL_STACK *st, const void *data);
          ^
      src/SWIG/_m2crypto_wrap.c:10991:20: error: call to undeclared function 'ossl_check_OPENSSL_STRING_type'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        result = (char *)ossl_check_OPENSSL_STRING_type(arg1);
                         ^
      src/SWIG/_m2crypto_wrap.c:10991:20: note: did you mean '_wrap_ossl_check_OPENSSL_STRING_type'?
      src/SWIG/_m2crypto_wrap.c:10975:22: note: '_wrap_ossl_check_OPENSSL_STRING_type' declared here
      SWIGINTERN PyObject *_wrap_ossl_check_OPENSSL_STRING_type(PyObject *self, PyObject *args) {
                           ^
      src/SWIG/_m2crypto_wrap.c:10991:12: warning: cast to 'char *' from smaller integer type 'int' [-Wint-to-pointer-cast]
        result = (char *)ossl_check_OPENSSL_STRING_type(arg1);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

已经尝试过

brew reinstall swig
并用谷歌搜索可能的答案,但无济于事。

python m2crypto
1个回答
0
投票

问题是我使用了错误的 LDFLAGS 和 CPPFLAGS,它们指向 openssl v1。

更新它们以指向 openssl v3 后,错误消失了。

export CPPFLAGS="$CPPFLAGS -I/opt/homebrew/Cellar/openssl@3/3.2.1/include"
export LDFLAGS="$LDFLAGS -L/opt/homebrew/Cellar/openssl@3/3.2.1/lib"
© www.soinside.com 2019 - 2024. All rights reserved.