Issue 1: Missing <chrono> Header Causes Compilation Failure
File: include/mcut/internal/frontend.h
Line: 410
Severity: Build failure with modern compilers
Description
The frontend.h header uses std::chrono::system_clock::now() but doesn't include <chrono>. This causes compilation failures with clang-cl and other compilers when C++20 is enabled or when include order doesn't bring in chrono transitively.
Current code (line 410):
return std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
Error:
error: no member named 'system_clock' in namespace 'std::chrono'
Fix
Add #include <chrono> to include/mcut/internal/frontend.h after line 54:
#include "mcut/mcut.h"
#include <future>
#include <chrono> // <-- ADD THIS LINE
#include <map>
#include <memory>
#include <string>
Root Cause
The header relies on transitive inclusion of <chrono> from other headers (like timer.h), but this is fragile and breaks depending on include order and compiler settings.
Issue 2: Incomplete CMake Install for Shared Libraries on Windows
File: CMakeLists.txt
Lines: 258-276
Severity: Packaging/distribution issue
Description
The CMake install commands for shared libraries are incomplete on Windows. The current code only installs the LIBRARY component, which works for .so files on Unix but doesn't install .dll (RUNTIME) or .lib import libraries (ARCHIVE) on Windows.
Current code (lines 263-266):
install(TARGETS ${mpn_shared_lib_name}
LIBRARY
DESTINATION lib/shared
COMPONENT dynamic_libraries)
Problem
- The current install command only specifies
LIBRARY, which is meant for Unix .so files
- This results in the DLL and import lib not being installed, breaking downstream usage
Recommended Fix
Replace lines 258-276 with standard CMake install pattern:
if(MCUT_BUILD_AS_SHARED_LIB)
install(TARGETS ${mpn_shared_lib_name}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
COMPONENT dynamic_libraries)
else()
install(TARGETS ${mpn_static_lib_name}
ARCHIVE DESTINATION lib
COMPONENT static_libraries)
endif()
Suggestion: Simplify Install Destinations
The current install uses non-standard subdirectories (lib/shared, lib/static). Consider using standard CMake conventions:
- Runtime (DLLs):
bin/
- Libraries (import libs, static libs, .so files):
lib/
- Headers:
include/
This aligns with CMake's GNUInstallDirs module and packaging tools like CPack, Conan, and vcpkg.
Test Configuration
- Compiler: Clang 21.1.0 (clang-cl on Windows)
- CMake: 3.20+
- C++ Standard: C++20
- Build Type: Both Debug and Release affected
Issue 1: Missing
<chrono>Header Causes Compilation FailureFile:
include/mcut/internal/frontend.hLine: 410
Severity: Build failure with modern compilers
Description
The
frontend.hheader usesstd::chrono::system_clock::now()but doesn't include<chrono>. This causes compilation failures with clang-cl and other compilers when C++20 is enabled or when include order doesn't bring in chrono transitively.Current code (line 410):
return std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::system_clock::now().time_since_epoch()).count();Error:
Fix
Add
#include <chrono>toinclude/mcut/internal/frontend.hafter line 54:Root Cause
The header relies on transitive inclusion of
<chrono>from other headers (liketimer.h), but this is fragile and breaks depending on include order and compiler settings.Issue 2: Incomplete CMake Install for Shared Libraries on Windows
File:
CMakeLists.txtLines: 258-276
Severity: Packaging/distribution issue
Description
The CMake install commands for shared libraries are incomplete on Windows. The current code only installs the
LIBRARYcomponent, which works for.sofiles on Unix but doesn't install.dll(RUNTIME) or.libimport libraries (ARCHIVE) on Windows.Current code (lines 263-266):
Problem
LIBRARY, which is meant for Unix.sofilesRecommended Fix
Replace lines 258-276 with standard CMake install pattern:
Suggestion: Simplify Install Destinations
The current install uses non-standard subdirectories (
lib/shared,lib/static). Consider using standard CMake conventions:bin/lib/include/This aligns with CMake's
GNUInstallDirsmodule and packaging tools like CPack, Conan, and vcpkg.Test Configuration