savoirfairelinux / opendht

OpenDHT: a C++17 Distributed Hash Table implementation
GNU General Public License v3.0
1.03k stars 172 forks source link

Exception raised by generateEcIdentity on Windows #722

Open Harold-Glitch opened 2 months ago

Harold-Glitch commented 2 months ago

Unable to run dhtchat after successful compilation and link on Windows.

Caused in tools_common.h by

dht::crypto::generateEcIdentity("DHT Node CA")


    if (not params.id.first and params.generate_identity) {
        auto node_ca = std::make_unique<dht::crypto::Identity>(**dht::crypto::generateEcIdentity("DHT Node CA")**);

Exception raised in crypto.cpp in: void Certificate::unpack(const uint8_t* dat, size_t dat_size)

Access violation at: gnutls_free(cert_list);

It runs fine on Linux, but did someone run dhtchat with success in version V3.2.0 on Windows ?

ac169 commented 1 month ago

At present, I use Visual Studio 2022 or CLION + VCPKG + VS 2022 Toolchain under Windows. Neither can it be compiled normally. Can it provide help?

Harold-Glitch commented 1 month ago

My repo compiles fine, but I still have problem with gnutls on tools/dhtchat https://github.com/Harold-Glitch/opendht/tree/master

ac169 commented 1 month ago

My repo compiles fine, but I still have problem with gnutls on tools/dhtchat https://github.com/Harold-Glitch/opendht/tree/master

Using the version you provided, after adapting to VCPKG, it can be compiled correctly. dhtchat also encountered the same problem!

Thanks!

ac169 commented 1 month ago
set (OPENDHT_C ON)

after opening the settings, an error message appears:

\2022\Professional\VC\Tools\MSVC\14.36.32532\include\vcruntime_c11_stdatomic.h(36): error C2061: syntax error: identifier"atomic_bool"
\2022\Professional\VC\Tools\MSVC\14.36.32532\include\vcruntime_c11_stdatomic.h(36): error C2059: syntax error:";"
\2022\Professional\VC\Tools\MSVC\14.36.32532\include\vcruntime_c11_stdatomic.h(37): error C2061: syntax error: identifier"atomic_char"
\2022\Professional\VC\Tools\MSVC\14.36.32532\include\vcruntime_c11_stdatomic.h(37): error C2059: syntax error:";"
\2022\Professional\VC\Tools\MSVC\14.36.32532\include\vcruntime_c11_stdatomic.h(38): error C2061: syntax error: identifier"atomic_schar"
\2022\Professional\VC\Tools\MSVC\14.36.32532\include\vcruntime_c11_stdatomic.h(38): error C2059: syntax error:";"
\2022\Professional\VC\Tools\MSVC\14.36.32532\include\vcruntime_c11_stdatomic.h(39): error C2061: syntax error: identifier"atomic_uchar"
\2022\Professional\VC\Tools\MSVC\14.36.32532\include\vcruntime_c11_stdatomic.h(39): error C2059: syntax error:";"
...