Open 1042198949 opened 1 week ago
Hello, from just the above compiler output, without any detail on the context of your build attempt, it is impossible to analyse what your problem is and how to potentially solve it.
Anyway, most likely you are better off using a recent OpenSSL version, where pretty sure all CMP features you may need are already included. Or why do you attempt to use this intermediate library?
Also when using the genCMPClient, which is recommendable, you likely won't need libcmp
.
I need to use CMPV2 to obtain CA certificates in the project (such as sending IR messages), so I made a simple a.c, to test whether cmp.h, cmp.so can be compiled and linked. (use openssl 1.1.1w) @ ![Uploading aa.c.png…]()
[root@localhost cmp]# [root@localhost cmp]# cat a.cc
int main(void) { return 0; } [root@localhost cmp]# [root@localhost cmp]# ll /usr/local/lib64/libcmp.so lrwxrwxrwx 1 root root 11 Nov 6 18:18 /usr/local/lib64/libcmp.so -> libcmp.so.2 lrwxrwxrwx 1 root root 13 Nov 6 18:18 /usr/local/lib64/libcmp.so.2 -> libcmp.so.2.0 -rwxr-xr-x 1 root root 323792 Nov 12 10:47 /usr/local/lib64/libcmp.so.2.0 [root@localhost cmp]# [root@localhost cmp]# g++ a.cc -I/usr/local/include/cmp -L /usr/local/lib64 -lcmp 2>aa.log [root@localhost cmp]# [root@localhost cmp]# cat aa.log In file included from openssl/cmp.h:23:0, from a.cc:1: /usr/local/include/cmp/openssl/crmf.h:63:1: error: expected constructor, destructor, or type conversion before ‘SKM_DEFINE_STACK_OF_INTERNAL’ SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CRMF_MSG, OSSL_CRMF_MSG, OSSL_CRMF_MSG) ^ In file included from openssl/cmp.h:23:0, from a.cc:1: /usr/local/include/cmp/openssl/crmf.h:91:43: error: variable or field ‘OSSL_CRMF_ATTRIBUTETYPEANDVALUE_free’ declared void void OSSL_CRMF_ATTRIBUTETYPEANDVALUE_free(OSSL_CRMF_ATTRIBUTETYPEANDVALUE v); ^ /usr/local/include/cmp/openssl/crmf.h:91:43: error: ‘OSSL_CRMF_ATTRIBUTETYPEANDVALUE’ was not declared in this scope /usr/local/include/cmp/openssl/crmf.h:91:76: error: ‘v’ was not declared in this scope void OSSL_CRMF_ATTRIBUTETYPEANDVALUE_free(OSSL_CRMF_ATTRIBUTETYPEANDVALUE *v); ^ /usr/local/include/cmp/openssl/crmf.h:95:29: error: expected constructor, destructor, or type conversion before ‘(’ token SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CRMF_ATTRIBUTETYPEANDVALUE, OSSL_CRMF_ATTRIBUTETYPEANDVALUE, OSSL_CRMF_ATTRIBUTETYPEANDVALUE) ^ In file included from /usr/include/openssl/objects.h:965:0, from /usr/include/openssl/evp.h:94, from /usr/include/openssl/x509.h:73, from /usr/include/openssl/x509v3.h:63, from /usr/local/include/cmp/openssl/crmf.h:29, from openssl/cmp.h:23, from a.cc:1: /usr/local/include/cmp/openssl/crmf.h:124:24: error: ‘OSSL_CRMF_PBMPARAMETER’ does not name a type DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_PBMPARAMETER) ^ /usr/local/include/cmp/openssl/crmf.h:124:24: error: variable or field ‘OSSL_CRMF_PBMPARAMETER_free’ declared void DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_PBMPARAMETER) ^ /usr/local/include/cmp/openssl/crmf.h:124:24: error: ‘OSSL_CRMF_PBMPARAMETER’ was not declared in this scope /usr/local/include/cmp/openssl/crmf.h:124:1: error: ‘a’ was not declared in this scope DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_PBMPARAMETER) ^ /usr/local/include/cmp/openssl/crmf.h:124:24: error: ‘OSSL_CRMF_PBMPARAMETER’ does not name a type DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_PBMPARAMETER) ^ /usr/local/include/cmp/openssl/crmf.h:124:24: error: ‘OSSL_CRMF_PBMPARAMETER’ was not declared in this scope DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_PBMPARAMETER) ^ /usr/local/include/cmp/openssl/crmf.h:124:1: error: ‘a’ was not declared in this scope DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_PBMPARAMETER) ^ /usr/local/include/cmp/openssl/crmf.h:124:1: error: expected primary-expression before ‘unsigned’ DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_PBMPARAMETER) ^ /usr/local/include/cmp/openssl/crmf.h:124:1: error: expression list treated as compound expression in initializer [-fpermissive] DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_PBMPARAMETER) ^ In file included from openssl/cmp.h:23:0, from a.cc:1: /usr/local/include/cmp/openssl/crmf.h:130:1: error: expected constructor, destructor, or type conversion before ‘SKM_DEFINE_STACK_OF_INTERNAL’ SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CRMF_CERTID, OSSL_CRMF_CERTID, OSSL_CRMF_CERTID) ^ In file included from /usr/include/openssl/objects.h:965:0, from /usr/include/openssl/evp.h:94, from /usr/include/openssl/x509.h:73, from /usr/include/openssl/x509v3.h:63, from /usr/local/include/cmp/openssl/crmf.h:29, from openssl/cmp.h:23, from a.cc:1: /usr/local/include/cmp/openssl/crmf.h:159:24: error: ‘OSSL_CRMF_PKIPUBLICATIONINFO’ does not name a type DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_PKIPUBLICATIONINFO) ^ /usr/local/include/cmp/openssl/crmf.h:159:24: error: variable or field ‘OSSL_CRMF_PKIPUBLICATIONINFO_free’ declared void DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_PKIPUBLICATIONINFO) ^ /usr/local/include/cmp/openssl/crmf.h:159:24: error: ‘OSSL_CRMF_PKIPUBLICATIONINFO’ was not declared in this scope /usr/local/include/cmp/openssl/crmf.h:159:1: error: ‘a’ was not declared in this scope
Without extern "C"
, the C++ compiler will mangle the names in the C header, resulting in linker errors because the C library expects unmangled names.
Without
extern "C"
, the C++ compiler will mangle the names in the C header, resulting in linker errors because the C library expects unmangled names.
This cannot be the issue here. Note that the above reported errors are by the compiler, not the linker.
Moreover, extern "C"
should meanwhile be in place wherever needed for use with C++.
I need to use CMPV2 to obtain CA certificates in the project (such as sending IR messages),
I see - and as can be inferred from #244, you use the genCMPClient.
so I made a simple a.c, to test whether cmp.h, cmp.so can be compiled and linked. (use openssl 1.1.1w)
Hmm, but OpenSSL 1.x is no more supported, both by OpenSSL itself and the genCMPClient its support libraries. Why don't you use at least 3.0?
Uploading aa.c.png…
This upload did not work.
/usr/local/include/cmp/openssl/crmf.h:63:1: error: expected constructor, destructor, or type conversion before ‘SKM_DEFINE_STACK_OF_INTERNAL’
SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CRMF_MSG, OSSL_CRMF_MSG, OSSL_CRMF_MSG)
You somehow seem to have a mix of OpenSSL versions, or at least have installed libcmp
needlessly.
Better uninstall libcmp
und upgrade your system to use at least OpenSSL 3.0,
which usually also has the effect that libcmp
is not needed.
Be sure also not to have multiple OpenSSL versions on your system, which may confuse many tools.
@1042198949 as mentioned, OpenSSL 1.x should not be used anymore. Did you meanwhile try with a supported OpenSSL version, so at least 3.0?
hello ,How to solve this problem
In file included from /usr/local/include/cmp/openssl/cmp.h:23:0, 2 from a.cc:2: 3 /usr/local/include/cmp/openssl/crmf.h:63:1: error: expected constructor, destructor, or type conversion before ‘SKM_DEFINE_STACK_OF_INTERNAL’ 4 SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CRMF_MSG, OSSL_CRMF_MSG, OSSL_CRMF_MSG) 5 ^ 6 In file included from /usr/local/include/cmp/openssl/cmp.h:23:0, 7 from a.cc:2: 8 /usr/local/include/cmp/openssl/crmf.h:91:43: error: variable or field ‘OSSL_CRMF_ATTRIBUTETYPEANDVALUE_free’ declared void 9 void OSSL_CRMF_ATTRIBUTETYPEANDVALUE_free(OSSL_CRMF_ATTRIBUTETYPEANDVALUE v); 10 ^ 11 /usr/local/include/cmp/openssl/crmf.h:91:43: error: ‘OSSL_CRMF_ATTRIBUTETYPEANDVALUE’ was not declared in this scope 12 /usr/local/include/cmp/openssl/crmf.h:91:76: error: ‘v’ was not declared in this scope 13 void OSSL_CRMF_ATTRIBUTETYPEANDVALUE_free(OSSL_CRMF_ATTRIBUTETYPEANDVALUE v); 14 ^ 15 /usr/local/include/cmp/openssl/crmf.h:95:29: error: expected constructor, destructor, or type conversion before ‘(’ token 16 SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CRMF_ATTRIBUTETYPEANDVALUE, OSSL_CRMF_ATTRIBUTETYPEANDVALUE, OSSL_CRMF_ATTRIBUTETYPEANDVALUE) 17 ^ 18 In file included from /home/xyp/cmpossl-cmp-old/testInclude/include/openssl/objects.h:15:0, 19 from /home/xyp/cmpossl-cmp-old/testInclude/include/openssl/evp.h:28, 20 from /home/xyp/cmpossl-cmp-old/testInclude/include/openssl/x509.h:18, 21 from /home/xyp/cmpossl-cmp-old/testInclude/include/openssl/x509v3.h:14, 22 from /usr/local/include/cmp/openssl/crmf.h:29, 23 from /usr/local/include/cmp/openssl/cmp.h:23, 24 from a.cc:2: 25 /usr/local/include/cmp/openssl/crmf.h:124:24: error: ‘OSSL_CRMF_PBMPARAMETER’ does not name a type 26 DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_PBMPARAMETER) 27 ^ 28 /home/xyp/cmpossl-cmp-old/testInclude/include/openssl/asn1.h:248:9: note: in definition of macro ‘DECLARE_ASN1_ALLOC_FUNCTIONS_name’ 29 type *name##_new(void); \ 30 ^ 31 /home/xyp/cmpossl-cmp-old/testInclude/include/openssl/asn1.h:217:39: note: in expansion of macro ‘DECLARE_ASN1_FUNCTIONS_name’ 32 # define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type) 33 ^ 34 /usr/local/include/cmp/openssl/crmf.h:124:1: note: in expansion of macro ‘DECLARE_ASN1_FUNCTIONS’ 35 DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_PBMPARAMETER) 36 ^ 37 /usr/local/include/cmp/openssl/crmf.h:124:24: error: variable or field ‘OSSL_CRMF_PBMPARAMETER_free’ declared void 38 DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_PBMPARAMETER) 39 ^