Title
vix run fails on macOS after clean install — OpenSSL resolution + stale .vix-scripts cache
Description
After a clean clone, build, and install on macOS (Apple Silicon, Homebrew), vix run server.cpp fails with CMake errors. Two separate issues compound to make debugging difficult.
Environment
- macOS (Apple Silicon / M1)
- Homebrew dependencies: cmake 4.x, openssl@3, spdlog, fmt, nlohmann-json, brotli
- Vix v2.2.0 (built from source, installed to
~/.local)
Steps to reproduce
# 1. Clone and build
git clone --recurse-submodules https://github.com/vixcpp/vix.git
cd vix
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j
cmake --install build --prefix "$HOME/.local"
# 2. Try running an example
mkdir ~/vix-examples && cd ~/vix-examples
cat > server.cpp << 'EOF'
#include <vix/core.h>
int main() {
vix::App app;
app.get("/", [](auto& req, auto& res) { res.send("Hello"); });
app.listen(8080);
}
EOF
vix run server.cpp
Bug 1: VixConfig.cmake exports OpenSSL as REQUIRED even though it's optional
When OpenSSL is found during the build, VIX_WITH_OPENSSL is set to ON, and the installed VixConfig.cmake ends up with:
# Line 34 in installed VixConfig.cmake
if (ON)
find_dependency(OpenSSL REQUIRED)
endif()
On macOS, Homebrew's openssl@3 is keg-only — it's not on the default system search paths. So when a consumer project runs find_dependency(OpenSSL REQUIRED), it fails unless the user manually sets OPENSSL_ROOT_DIR or CMAKE_PREFIX_PATH.
Additionally, the exported VixTargets.cmake hardcodes OpenSSL::SSL and OpenSSL::Crypto in the link interface of vix::core and vix::crypto, so even if find_dependency is removed, the generate step still fails.
Expected behavior: Either:
VixConfig.cmake should include a Homebrew hint (e.g., check brew --prefix openssl@3) so consumers can find it automatically, or
- OpenSSL should be off by default for the install/export path on macOS, or
- The config should gracefully handle the case where OpenSSL was available at build time but not resolvable by consumers
Bug 2: vix run reuses stale .vix-scripts/ cache after SDK reinstall
vix run creates a .vix-scripts/ directory with a CMake build cache. After rebuilding and reinstalling Vix (e.g., with -DVIX_CORE_WITH_OPENSSL=OFF), the stale cache in .vix-scripts/ still references the old installed VixTargets.cmake. This causes the same error to persist even after the fix has been installed.
The user must manually rm -rf .vix-scripts to pick up the new installation, which is not obvious.
Expected behavior: vix run should detect when the installed Vix SDK has changed (e.g., by checking a version hash or timestamp of the installed cmake files) and invalidate the cache automatically.
Workaround
# Rebuild without OpenSSL and MySQL
rm -rf build
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \
-DVIX_DB_USE_MYSQL=OFF \
-DVIX_CORE_WITH_OPENSSL=OFF
cmake --build build -j
cmake --install build --prefix "$HOME/.local"
# Clear stale consumer cache
rm -rf ~/vix-examples/.vix-scripts
# Now it works
cd ~/vix-examples
vix run server.cpp
Related
A similar issue exists with VIX_DB_USE_MYSQL which defaults to ON — the installed config requires MySQLCppConn even if the user doesn't need MySQL support. This was fixed by passing -DVIX_DB_USE_MYSQL=OFF at build time.
Title
vix runfails on macOS after clean install — OpenSSL resolution + stale.vix-scriptscacheDescription
After a clean clone, build, and install on macOS (Apple Silicon, Homebrew),
vix run server.cppfails with CMake errors. Two separate issues compound to make debugging difficult.Environment
~/.local)Steps to reproduce
Bug 1:
VixConfig.cmakeexports OpenSSL asREQUIREDeven though it's optionalWhen OpenSSL is found during the build,
VIX_WITH_OPENSSLis set toON, and the installedVixConfig.cmakeends up with:On macOS, Homebrew's
openssl@3is keg-only — it's not on the default system search paths. So when a consumer project runsfind_dependency(OpenSSL REQUIRED), it fails unless the user manually setsOPENSSL_ROOT_DIRorCMAKE_PREFIX_PATH.Additionally, the exported
VixTargets.cmakehardcodesOpenSSL::SSLandOpenSSL::Cryptoin the link interface ofvix::coreandvix::crypto, so even iffind_dependencyis removed, the generate step still fails.Expected behavior: Either:
VixConfig.cmakeshould include a Homebrew hint (e.g., checkbrew --prefix openssl@3) so consumers can find it automatically, orBug 2:
vix runreuses stale.vix-scripts/cache after SDK reinstallvix runcreates a.vix-scripts/directory with a CMake build cache. After rebuilding and reinstalling Vix (e.g., with-DVIX_CORE_WITH_OPENSSL=OFF), the stale cache in.vix-scripts/still references the old installedVixTargets.cmake. This causes the same error to persist even after the fix has been installed.The user must manually
rm -rf .vix-scriptsto pick up the new installation, which is not obvious.Expected behavior:
vix runshould detect when the installed Vix SDK has changed (e.g., by checking a version hash or timestamp of the installed cmake files) and invalidate the cache automatically.Workaround
Related
A similar issue exists with
VIX_DB_USE_MYSQLwhich defaults toON— the installed config requiresMySQLCppConneven if the user doesn't need MySQL support. This was fixed by passing-DVIX_DB_USE_MYSQL=OFFat build time.