开发者

Linking problem as I am making python module using OpenSSL + SWIG

I have a C file dtls_udp_echo.c in which I use SSL functions. I am trying to create a Python wrapper for this file using SWIG. I've done the following steps:

1) Created an interface file udp.i:

%module udp

%{
 /* Put header files here or function declarations like below */

 #define SWIG_FILE_WITH_INIT
 #include "dtls_udp_echo.h"

%}

int THREAD_setup();

int THREAD_cleanup();

int handle_socket_error();

int generate_cookie(SSL *ssl, unsigned char *cookie, unsigned int *cookie_len);

int verify_cookie(SSL *ssl, unsigned char *cookie, unsigned int cookie_len);

int dtls_verify_callback (int ok, X509_STORE_CTX *ctx) ;

void* connection_handle(void *info);

void start_server(int port, char *local_address);

void start_client(char *remote_address, char *local_address, int port, int length, int messagenumber);

2) Run the command swig -python udp.i.

3) Run the command gcc -O2 -fPIC -c dtls_udp_echo.c -I/usr/local/ssl/include -L开发者_如何学运维/usr/local/ssl/lib -lcrypto -lssl. The path to the include and library is correct, I checked it!

4) Run the command gcc -O2 -fPIC -c udp_wrap.c -I/usr/include/python2.5 -I/usr/local/ssl/include -L/usr/local/ssl/lib -lcrypto -lssl.

5) Run the command gcc -shared dtls_udp_echo.o udp_wrap.o -o _udp.so.

It seems to complete OK as no errors are reported. But, when I try to import the module, I get the following traceback:

>>> import udp
> Traceback (most recent call last):  
> File "<stdin>", line 1, in <module>  
> File "udp.py", line 28, in <module>
>     import _udp ImportError: ./_udp.so: undefined symbol:
> SSL_get_rbio

Can anybody help me to fix this problem?


It can't find the OpenSSL library. Add it to your ld search path; see the ldconfig(8) man page for details.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜