WebAssembly / wabt

The WebAssembly Binary Toolkit
Apache License 2.0
6.9k stars 702 forks source link

Fix OpenSSL dependency in CMake (#2446) #2447

Closed steven-johnson closed 3 months ago

keithw commented 4 months ago

See comments on #2446 -- is there a CI configuration that would replicate this configuration and show the problem you're talking about?

alexreinking commented 4 months ago

@keithw -- is it impossible to merge this without a CI test?

If it helps, here are some concrete steps to reproduce:

$ git clone --recursive https://github.com/WebAssembly/wabt
$ cmake -G Ninja -S wabt -B out -DCMAKE_BUILD_TYPE=Release
$ cmake --build out
$ cmake --install out --prefix local
$ mkdir example
$ vim example/CMakeLists.txt

Now, enter the following:

cmake_minimum_required(VERSION 3.16)
project(example)

enable_testing()

find_package(wabt REQUIRED)

add_executable(hello main.cpp)
target_link_libraries(hello PRIVATE wabt::wabt)

add_test(NAME hello COMMAND hello)
set_tests_properties(hello PROPERTIES PASS_REGULAR_EXPRESSION "Hello, world\\.")

At this point, you could also create an example program that uses wabt to print Hello, world. (perhaps by using the IR in test/wasm2c/hello.txt?), but we can still demonstrate the problem with an empty file:

$ touch example/main.cpp
$ ctest --build-and-test example out-example --build-generator Ninja --build-options -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$PWD/local --test-command ctest

At this point, I receive the same OpenSSL::Crypto issue as in #2446

I can also confirm that the proposed patch works.

alexreinking commented 3 months ago

@sbc100 - gentle review ping for this PR.