Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could NOT find MbedTLS (missing: MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY) #528

Closed
8Observer8 opened this issue Sep 14, 2024 · 8 comments
Closed

Comments

@8Observer8
Copy link

8Observer8 commented Sep 14, 2024

IXWebSocket-11.4.5 (March 6, 2024)
Window 10 64-bit
CMake 3.27
MinGW-w64

Hello,

I try to use Mbed-TLS 3.6.1:

git clone --depth 1 --branch v3.6.1 https://github.com/Mbed-TLS/mbedtls.git

I have installed MbedTLS using CMake and MinGW-w64. I set paths to MbedTLS as on the screenshot below. But why I have this error: Could NOT find MbedTLS (missing: MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY) How to solve it?

image

@8Observer8
Copy link
Author

8Observer8 commented Sep 14, 2024

Solved. These values:

MBEDX509_LIBRARY: MBEDX509_LIBRARY-NOTFOUND
MBEDCRYPTO_LIBRARY: MBEDCRYPTO_LIBRARY-NOTFOUND

should be replaced with these ones:

MBEDX509_LIBRARY: E:/libs/mbedtls-3.6.1-prefix/lib
MBEDCRYPTO_LIBRARY: E:/libs/mbedtls-3.6.1-prefix/lib

@8Observer8
Copy link
Author

8Observer8 commented Sep 14, 2024

But now when I press "Generate" I see these warnings:

TLS configured to use mbedtls
Configuring done (0.3s)
CMake Warning at CMakeLists.txt:230 (target_link_libraries):
  Target "ixwebsocket" requests linking to directory
  "E:/libs/mbedtls-3.6.1-prefix/lib".  Targets may link only to libraries.
  CMake is dropping the item.


CMake Warning at CMakeLists.txt:230 (target_link_libraries):
  Target "ixwebsocket" requests linking to directory
  "E:/libs/mbedtls-3.6.1-prefix/lib".  Targets may link only to libraries.
  CMake is dropping the item.


CMake Warning at CMakeLists.txt:230 (target_link_libraries):
  Target "ixwebsocket" requests linking to directory
  "E:/libs/mbedtls-3.6.1-prefix/lib".  Targets may link only to libraries.
  CMake is dropping the item.


Generating done (0.1s)

@8Observer8
Copy link
Author

I try to ignore the warnings above and build IXWebSocket:

cmake --build build -j4

But the following error occurs at the end of building:

[ 89%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketProxyServer.cpp.obj
[ 92%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketServer.cpp.obj
[ 94%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketTransport.cpp.obj
[ 97%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSocketMbedTLS.cpp.obj
E:\libs\IXWebSocket-11.4.5\ixwebsocket\IXSocketMbedTLS.cpp: In member function 'bool ix::SocketMbedTLS::init(const string&, bool, std::string&)':
E:\libs\IXWebSocket-11.4.5\ixwebsocket\IXSocketMbedTLS.cpp:139:41: error: too few arguments to function 'int mbedtls_pk_parse_keyfile(mbedtls_pk_context*, const char*, const char*, int (*)(void*, unsigned char*, size_t), void*)'
  139 |             if (mbedtls_pk_parse_keyfile(&_pkey, _tlsOptions.keyFile.c_str(), "") < 0)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from E:/libs/mbedtls-3.6.1-prefix/include/mbedtls/ssl_ciphersuites.h:16,
                 from E:/libs/mbedtls-3.6.1-prefix/include/mbedtls/ssl.h:20,
                 from E:/libs/mbedtls-3.6.1-prefix/include/mbedtls/debug.h:15,
                 from E:\libs\IXWebSocket-11.4.5\ixwebsocket\IXSocketMbedTLS.h:13,
                 from E:\libs\IXWebSocket-11.4.5\ixwebsocket\IXSocketMbedTLS.cpp:12:
E:/libs/mbedtls-3.6.1-prefix/include/mbedtls/pk.h:1174:5: note: declared here
 1174 | int mbedtls_pk_parse_keyfile(mbedtls_pk_context *ctx,
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
mingw32-make.exe[2]: *** [CMakeFiles\ixwebsocket.dir\build.make:616: CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSocketMbedTLS.cpp.obj] Error 1
mingw32-make.exe[2]: *** Waiting for unfinished jobs....
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:82: CMakeFiles/ixwebsocket.dir/all] Error 2
mingw32-make.exe: *** [Makefile:135: all] Error 2

@8Observer8 8Observer8 reopened this Sep 14, 2024
@8Observer8
Copy link
Author

8Observer8 commented Sep 14, 2024

I try to build from the console line. How to solve Could NOT find MbedTLS (missing: MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY)?

cmake -G "MinGW Makefiles" --fresh -S . -B build -DCMAKE_INSTALL_PREFIX=E:/libs/IXWebSocket-11.4.5-prefix -DZLIB_LIBRARY=E:/lib/zlib-1.3.1-prefix/lib/libzlibstatic.a -DZLIB_INCLUDE_DIR=E:/libs/zlib-1.3.1-prefix/include -DUSE_TLS=ON -DUSE_WS=ON

-- The C compiler identification is GNU 11.2.0
-- The CXX compiler identification is GNU 11.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Qt/Tools/mingw1120_64/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Qt/Tools/mingw1120_64/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- TLS configured to use mbedtls
CMake Error at C:/Qt/Tools/CMake_64/share/cmake-3.27/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find MbedTLS (missing: MBEDTLS_INCLUDE_DIRS MBEDTLS_LIBRARY
  MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY)
Call Stack (most recent call first):
  C:/Qt/Tools/CMake_64/share/cmake-3.27/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  CMake/FindMbedTLS.cmake:13 (find_package_handle_standard_args)
  CMakeLists.txt:222 (find_package)


-- Configuring incomplete, errors occurred!

@8Observer8
Copy link
Author

Solved:

cmake -G "MinGW Makefiles" --fresh -S . -B build -DCMAKE_INSTALL_PREFIX=E:/libs/IXWebSocket-11.4.5-prefix -DZLIB_LIBRARY=E:/lib/zlib-1.3.1-prefix/lib/libzlibstatic.a -DZLIB_INCLUDE_DIR=E:/libs/zlib-1.3.1-prefix/include -DMBEDTLS_LIBRARY=E:/libs/mbedtls-3.6.1-prefix/lib/libmbedtls.a -DMBEDTLS_INCLUDE_DIRS=E:/libs/mbedtls-3.6.1-prefix/include -DMBEDX509_LIBRARY=E:/libs/mbedtls-3.6.1-prefix/lib/libmbedx509.a -DMBEDCRYPTO_LIBRARY=E:/libs/mbedtls-3.6.1-prefix/lib/libmbedcrypto.a -DUSE_TLS=ON -DUSE_WS=ON

-- The C compiler identification is GNU 11.2.0
-- The CXX compiler identification is GNU 11.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Qt/Tools/mingw1120_64/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Qt/Tools/mingw1120_64/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- TLS configured to use mbedtls
-- Found MbedTLS: E:/libs/mbedtls-3.6.1-prefix/include
-- Found ZLIB: E:/lib/zlib-1.3.1-prefix/lib/libzlibstatic.a (found version "1.3.1")
-- Build spdlog: 1.8.0
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Build type: Release
-- Configuring done (13.9s)
-- Generating done (0.5s)
-- Build files have been written to: E:/libs/IXWebSocket-11.4.5/build

@8Observer8
Copy link
Author

I try to compile:

cmake --build build -j4

Why I have this error?

[ 88%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketTransport.cpp.obj
[ 90%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSocketMbedTLS.cpp.obj
E:\libs\IXWebSocket-11.4.5\ixwebsocket\IXSocketMbedTLS.cpp: In member function 'bool ix::SocketMbedTLS::init(const string&, bool, std::string&)':
E:\libs\IXWebSocket-11.4.5\ixwebsocket\IXSocketMbedTLS.cpp:139:41: error: too few arguments to function 'int mbedtls_pk_parse_keyfile(mbedtls_pk_context*, const char*, const char*, int (*)(void*, unsigned char*, size_t), void*)'
  139 |             if (mbedtls_pk_parse_keyfile(&_pkey, _tlsOptions.keyFile.c_str(), "") < 0)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from E:/libs/mbedtls-3.6.1-prefix/include/mbedtls/ssl_ciphersuites.h:16,
                 from E:/libs/mbedtls-3.6.1-prefix/include/mbedtls/ssl.h:20,
                 from E:/libs/mbedtls-3.6.1-prefix/include/mbedtls/debug.h:15,
                 from E:\libs\IXWebSocket-11.4.5\ixwebsocket\IXSocketMbedTLS.h:13,
                 from E:\libs\IXWebSocket-11.4.5\ixwebsocket\IXSocketMbedTLS.cpp:12:
E:/libs/mbedtls-3.6.1-prefix/include/mbedtls/pk.h:1174:5: note: declared here
 1174 | int mbedtls_pk_parse_keyfile(mbedtls_pk_context *ctx,
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
mingw32-make.exe[2]: *** [CMakeFiles\ixwebsocket.dir\build.make:616: CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSocketMbedTLS.cpp.obj] Error 1
mingw32-make.exe[2]: *** Waiting for unfinished jobs....
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:117: CMakeFiles/ixwebsocket.dir/all] Error 2
mingw32-make.exe: *** [Makefile:135: all] Error 2

@8Observer8 8Observer8 reopened this Sep 14, 2024
@8Observer8
Copy link
Author

I have tried to compile IXWebSocket-11.4.5 (March 6, 2024) above but building IXWebSocket-master has the same result as above.

Full log:

cmake -G "MinGW Makefiles" --fresh -S . -B build -DCMAKE_INSTALL_PREFIX=E:/libs/IXWebSocket-11.4.5-prefix -DZLIB_LIBRARY=E:/lib/zlib-1.3.1-prefix/lib/libzlibstatic.a -DZLIB_INCLUDE_DIR=E:/libs/zlib-1.3.1-prefix/include -DMBEDTLS_LIBRARY=E:/libs/mbedtls-3.6.1-prefix/lib/libmbedtls.a -DMBEDTLS_INCLUDE_DIRS=E:/libs/mbedtls-3.6.1-prefix/include -DMBEDX509_LIBRARY=E:/libs/mbedtls-3.6.1-prefix/lib/libmbedx509.a -DMBEDCRYPTO_LIBRARY=E:/libs/mbedtls-3.6.1-prefix/lib/libmbedcrypto.a -DUSE_TLS=ON -DUSE_WS=ON

-- The C compiler identification is GNU 11.2.0
-- The CXX compiler identification is GNU 11.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Qt/Tools/mingw1120_64/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Qt/Tools/mingw1120_64/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- TLS configured to use mbedtls
-- Found MbedTLS: E:/libs/mbedtls-3.6.1-prefix/include
-- Found ZLIB: E:/lib/zlib-1.3.1-prefix/lib/libzlibstatic.a (found version "1.3.1")
-- Build spdlog: 1.8.0
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Build type: Release
-- Configuring done (12.6s)
-- Generating done (0.1s)
-- Build files have been written to: E:/libs/IXWebSocket-master/build

cmake --build build -j4

[  2%] Building CXX object _deps/spdlog-build/CMakeFiles/spdlog.dir/src/spdlog.cpp.obj
[  4%] Building CXX object _deps/spdlog-build/CMakeFiles/spdlog.dir/src/stdout_sinks.cpp.obj
[  8%] [  8%] Building CXX object _deps/spdlog-build/CMakeFiles/spdlog.dir/src/color_sinks.cpp.obj
Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXBench.cpp.obj
[ 10%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXCancellationRequest.cpp.obj
[ 12%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXConnectionState.cpp.obj
[ 14%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXDNSLookup.cpp.obj
[ 16%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXExponentialBackoff.cpp.obj
[ 18%] Building CXX object _deps/spdlog-build/CMakeFiles/spdlog.dir/src/file_sinks.cpp.obj
[ 20%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXGetFreePort.cpp.obj
[ 22%] Building CXX object _deps/spdlog-build/CMakeFiles/spdlog.dir/src/async.cpp.obj
[ 24%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXGzipCodec.cpp.obj
[ 26%] Building CXX object _deps/spdlog-build/CMakeFiles/spdlog.dir/src/cfg.cpp.obj
[ 28%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXHttp.cpp.obj
[ 30%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXHttpClient.cpp.obj
[ 32%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXHttpServer.cpp.obj
[ 34%] Building CXX object _deps/spdlog-build/CMakeFiles/spdlog.dir/src/fmt.cpp.obj
[ 36%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXNetSystem.cpp.obj
[ 38%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSelectInterrupt.cpp.obj
[ 40%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSelectInterruptFactory.cpp.obj
[ 42%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSelectInterruptPipe.cpp.obj
[ 44%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSelectInterruptEvent.cpp.obj
[ 46%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSetThreadName.cpp.obj
[ 48%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSocket.cpp.obj
[ 50%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSocketConnect.cpp.obj
[ 52%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSocketFactory.cpp.obj
[ 54%] Linking CXX static library libspdlog.a
[ 56%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSocketServer.cpp.obj
[ 58%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSocketTLSOptions.cpp.obj
[ 58%] Built target spdlog
[ 60%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXStrCaseCompare.cpp.obj
[ 62%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXUdpSocket.cpp.obj
[ 64%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXUrlParser.cpp.obj
[ 66%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXUuid.cpp.obj
[ 68%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXUserAgent.cpp.obj
[ 70%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocket.cpp.obj
[ 72%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketCloseConstants.cpp.obj
[ 74%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketHandshake.cpp.obj
[ 76%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketHttpHeaders.cpp.obj
[ 78%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketPerMessageDeflate.cpp.obj
[ 80%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketPerMessageDeflateCodec.cpp.obj
[ 82%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketPerMessageDeflateOptions.cpp.obj
[ 84%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketProxyServer.cpp.obj
[ 86%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketServer.cpp.obj
[ 88%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketTransport.cpp.obj
[ 90%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSocketMbedTLS.cpp.obj
E:\libs\IXWebSocket-master\ixwebsocket\IXSocketMbedTLS.cpp: In member function 'bool ix::SocketMbedTLS::init(const string&, bool, std::string&)':
E:\libs\IXWebSocket-master\ixwebsocket\IXSocketMbedTLS.cpp:146:41: error: too few arguments to function 'int mbedtls_pk_parse_keyfile(mbedtls_pk_context*, const char*, const char*, int (*)(void*, unsigned char*, size_t), void*)'
  146 |             if (mbedtls_pk_parse_keyfile(&_pkey, _tlsOptions.keyFile.c_str(), "") < 0)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from E:/libs/mbedtls-3.6.1-prefix/include/mbedtls/ssl_ciphersuites.h:16,
                 from E:/libs/mbedtls-3.6.1-prefix/include/mbedtls/ssl.h:20,
                 from E:/libs/mbedtls-3.6.1-prefix/include/mbedtls/debug.h:15,
                 from E:\libs\IXWebSocket-master\ixwebsocket\IXSocketMbedTLS.h:13,
                 from E:\libs\IXWebSocket-master\ixwebsocket\IXSocketMbedTLS.cpp:12:
E:/libs/mbedtls-3.6.1-prefix/include/mbedtls/pk.h:1174:5: note: declared here
 1174 | int mbedtls_pk_parse_keyfile(mbedtls_pk_context *ctx,
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
mingw32-make.exe[2]: *** [CMakeFiles\ixwebsocket.dir\build.make:616: CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSocketMbedTLS.cpp.obj] Error 1
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:117: CMakeFiles/ixwebsocket.dir/all] Error 2
mingw32-make.exe: *** [Makefile:135: all] Error 2

@8Observer8
Copy link
Author

#529

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant