2014-06-09 47 views
0

我試圖構建openssl 1.0.1x,其中有各種各樣的mingw風味,並且出現以下錯誤。Openssl無法與mingw一起構建:「不提供有效的預處理令牌」

In file included from \android\external\openssl\crypto\er 
\err_all.c:60:0: 
/android/external/openssl/crypto/../include/openssl/ocsp. 
:539:24: error: pasting ")" and "_new" does not give a valid preprocessing token 
DECLARE_ASN1_FUNCTIONS(OCSP_RESPONSE) 
         ^
/android/external/openssl/crypto/../include/openssl/asn1. 
:333:8: note: in definition of macro 'DECLARE_ASN1_ALLOC_FUNCTIONS_name' 
    type *name##_new(void); \ 
     ^
/android/external/openssl/crypto/../include/openssl/asn1. 
:302:38: note: in expansion of macro 'DECLARE_ASN1_FUNCTIONS_name' 
#define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type) 
            ^
/android/external/openssl/crypto/../include/openssl/ocsp. 
:539:1: note: in expansion of macro 'DECLARE_ASN1_FUNCTIONS' 
DECLARE_ASN1_FUNCTIONS(OCSP_RESPONSE) 
^ 
/android/external/openssl/crypto/../include/openssl/ocsp. 
:539:24: error: pasting ")" and "_free" does not give a valid preprocessing token 
DECLARE_ASN1_FUNCTIONS(OCSP_RESPONSE) 
         ^
/android/external/openssl/crypto/../include/openssl/asn1. 
:334:7: note: in definition of macro 'DECLARE_ASN1_ALLOC_FUNCTIONS_name' 
    void name##_free(type *a); 
    ^
/android/external/openssl/crypto/../include/openssl/asn1. 
:302:38: note: in expansion of macro 'DECLARE_ASN1_FUNCTIONS_name' 
#define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type) 
            ^
/android/external/openssl/crypto/../include/openssl/ocsp. 
:539:1: note: in expansion of macro 'DECLARE_ASN1_FUNCTIONS' 
DECLARE_ASN1_FUNCTIONS(OCSP_RESPONSE) 
^ 
/android/external/openssl/crypto/../include/openssl/asn1. 
:316:8: error: pasting "d2i_" and "(" does not give a valid preprocessing token 
    type *d2i_##name(type **a, const unsigned char **in, long len); \ 
     ^

你有什麼想法嗎?

回答

1

根據this,mingw標題重新定義了openssl符號。

您需要取消定義它們。

以下添加到openssl/include/openssl/ocsp.h

#if defined(OPENSSL_SYS_WINDOWS) 
#include <windows.h> 
#undef X509_NAME 
#undef X509_EXTENSIONS 
#undef X509_CERT_PAIR 
#undef PKCS7_ISSUER_AND_SERIAL 
#undef OCSP_REQUEST 
#undef OCSP_RESPONSE 
#endif 
相關問題