emscripten-core / emscripten

Emscripten: An LLVM-to-WebAssembly Compiler
Other
25.75k stars 3.3k forks source link

OPENSSL_ROOT_DIR not found when using emcmake #17551

Open mcfriend99 opened 2 years ago

mcfriend99 commented 2 years ago

When generating make files using emcmake, CMake can't find OPENSSL_ROOT_DIR. This only happens when using emcmake. Problem is that I can't use the normal cmake command as it generates native object files instead of was objects.

Version of emscripten/emsdk:

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.17 (fbc532773d84d2bd7da876275671970e792ad1cd)
clang version 15.0.0 (https://github.com/llvm/llvm-project 17e4c217b66305e60657a48f10fe3c428c2fe4d2)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /Users/user/PS/emsdk/upstream/bin

Failing command line in full:

-- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR) 
CMake Error at packages/ssl/CMakeLists.txt:25 (message):
  OpenSSL not found!

-- Configuring incomplete, errors occurred!
See also "/Users/mcfriendsy/c/blade/blade-copy/build/CMakeFiles/CMakeOutput.log".
emcmake: error: 'cmake .. -DOPENSSL_ROOT_DIR=/opt/homebrew/opt/openssl -DDISABLE_CLIB=ON -DCMAKE_TOOLCHAIN_FILE=/Users/user/PS/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_CROSSCOMPILING_EMULATOR=/Users/user/PS/emsdk/node/14.18.2_64bit/bin/node;--experimental-wasm-threads' failed (returned 1)
mcfriend99 commented 2 years ago

No feedback

sbc100 commented 2 years ago

You need to set OPENSSL_ROOT_DIR to a location where you have previously build openssl using the emscripten compiler. The /opt/homebrew/opt/openssl I imagine does not contain libraries that are usable by emscripten.

Also, have a look at /Users/mcfriendsy/c/blade/blade-copy/build/CMakeFiles/CMakeOutput.log to see the actual error message .