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

Windows support #843

Draft
wants to merge 22 commits into
base: master
Choose a base branch
from
Draft

Windows support #843

wants to merge 22 commits into from

Conversation

axic
Copy link
Member

@axic axic commented Jan 5, 2023

Closes #544.

@@ -25,7 +25,7 @@ if(NOT CMAKE_CONFIGURATION_TYPES)
endif()

HunterGate(
URL https://github.com/cpp-pm/hunter/archive/v0.23.294.tar.gz
SHA1 0dd1ee8723d54a15822519c17a877c1f281fce39
URL https://github.com/cpp-pm/hunter/archive/v0.24.13.tar.gz
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to update to 0.23.371 at least in order to support MSVC 2022.

HUNTER_INSTALL_LICENSE_FILES=LICENSE
gtest_force_shared_crt=TRUE
)
#hunter_config(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The newer Hunter contains this.

@@ -31,22 +31,22 @@ template <typename T>
inline T read(const uint8_t*& input) noexcept
{
T ret;
__builtin_memcpy(&ret, input, sizeof(ret));
memcpy(&ret, input, sizeof(ret));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be fixed.

@@ -455,8 +456,8 @@ inline parser_result<Data> parse(const uint8_t* pos, const uint8_t* end)

std::unique_ptr<const Module> parse(bytes_view input)
{
if (input.substr(0, wasm_prefix.size()) != wasm_prefix)
throw parser_error{"invalid wasm module prefix"};
// if (input.substr(0, wasm_prefix.size()) != wasm_prefix)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be fixed.

@@ -12,6 +12,14 @@ set(include_dir ${source_dir}/include)
set(uvwasi_library ${binary_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}uvwasi_a${CMAKE_STATIC_LIBRARY_SUFFIX})
set(uv_library ${binary_dir}/_deps/libuv-build/${CMAKE_STATIC_LIBRARY_PREFIX}uv_a${CMAKE_STATIC_LIBRARY_SUFFIX})

# This is hack. Should fix proper uvwasi.cmake integration.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theses are imported in https://github.com/nodejs/uvwasi/blob/master/cmake/FindLibUV.cmake, but we do a botched job at cmake-integrating uvwasi.

@@ -8,6 +8,8 @@
#include "instantiate.hpp"
#include "parser.hpp"
#include <fizzy/fizzy.h>
#include <algorithm>
#include <iterator>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For back_inserter and some other case I forgot.

@@ -16,7 +16,7 @@ namespace
template <typename T>
inline void store(uint8_t* dst, T value) noexcept
{
__builtin_memcpy(dst, &value, sizeof(value));
memcpy(dst, &value, sizeof(value));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CWE 805 advisory: suspicious sizeof in strncpy, strncat or memcpy


ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

@@ -16,7 +16,7 @@ namespace fizzy::test
class WabtEngine final : public WasmEngine
{
// mutable because getting RefPtr from Ref requires non-const Store
mutable wabt::interp::Store m_store{([]() constexpr noexcept {
mutable wabt::interp::Store m_store{([]() noexcept {
wabt::Features features;
features.disable_multi_value();
Copy link
Member Author

@axic axic Jan 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found by MSVC:

[48/103] Building CXX object test\utils\CMakeFiles\test-utils.dir\wabt_engine.cpp.obj
FAILED: test/utils/CMakeFiles/test-utils.dir/wabt_engine.cpp.obj 
C:\PROGRA~1\MICROS~4\2022\COMMUN~1\VC\Tools\MSVC\1433~1.316\bin\Hostx64\x64\cl.exe  /nologo /TP  -IC:\Users\circleci.PACKER-633B1A5A\project -IC:\Users\circleci.PACKER-633B1A5A\project\lib\fizzy -IC:\Users\circleci.PACKER-633B1A5A\project\include -external:IC:\Users\circleci.PACKER-633B1A5A\build\_deps\src\wabt -external:IC:\Users\circleci.PACKER-633B1A5A\build\_deps\src\wabt-build -external:IC:\Users\circleci.PACKER-633B1A5A\build\_deps\src\wasm3 -external:IC:\Users\circleci.PACKER-633B1A5A\.hunter\_Base\2bc7384\4753fe5\c0cf92b\Install\include -external:W0 /DWIN32 /D_WINDOWS /GR /EHsc /O2 /Ob2 /DNDEBUG -MD /W4 /WX /wd4068 -std:c++20 /showIncludes /Fotest\utils\CMakeFiles\test-utils.dir\wabt_engine.cpp.obj /Fdtest\utils\CMakeFiles\test-utils.dir\test-utils.pdb /FS -c C:\Users\circleci.PACKER-633B1A5A\project\test\utils\wabt_engine.cpp
C:\Users\circleci.PACKER-633B1A5A\project\test\utils\wabt_engine.cpp(19): error C3615: constexpr function 'fizzy::test::WabtEngine::<lambda_1>::operator ()' cannot result in a constant expression
C:\Users\circleci.PACKER-633B1A5A\project\test\utils\wabt_engine.cpp(21): note: failure was caused by call of undefined function or one not declared 'constexpr'
C:\Users\circleci.PACKER-633B1A5A\project\test\utils\wabt_engine.cpp(21): note: see usage of 'wabt::Features::disable_multi_value'
C:\Users\circleci.PACKER-633B1A5A\project\test\utils\wabt_engine.cpp(22): note: failure was caused by call of undefined function or one not declared 'constexpr'
C:\Users\circleci.PACKER-633B1A5A\project\test\utils\wabt_engine.cpp(22): note: see usage of 'wabt::Features::disable_sat_float_to_int'
C:\Users\circleci.PACKER-633B1A5A\project\test\utils\wabt_engine.cpp(23): note: failure was caused by call of undefined function or one not declared 'constexpr'
C:\Users\circleci.PACKER-633B1A5A\project\test\utils\wabt_engine.cpp(23): note: see usage of 'wabt::Features::disable_sign_extension'
[49/103] Building CXX object test\utils\CMakeFiles\test-utils.dir\asserts.cpp.obj
``

@axic
Copy link
Member Author

axic commented Jan 6, 2023

Last piece waiting is fixing the patch system for wasm3 or fixing+merging #739.

$ErrorActionPreference = "Stop"
& 'C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\Launch-VsDevShell.ps1' -Arch amd64
which cmake
cmake -S . -B ~/build -G Ninja -DCMAKE_INSTALL_PREFIX=C:\install -DCMAKE_CXX_STANDARD=20 -DFIZZY_TESTING=ON
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C++20 is forced here.

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

Successfully merging this pull request may close these issues.

Support compilation with MSVC
1 participant