socketsupply / socket

A cross-platform runtime for Web developers to build desktop & mobile apps for any OS using any frontend library.
https://socketsupply.co/guides
Other
1.61k stars 76 forks source link

Verify minimal requirements for build #88

Closed trevnorris closed 1 year ago

trevnorris commented 1 year ago

Verify the minimal possible requirements for performing a build in Windows. Will start with a clean system and create a checklist of what's necessary so it can be documented online.

mribbons commented 1 year ago

@trevnorris have tested from fresh install while developing changes here #92

Requirements:

Pre #92, everything below (bin folders) needs to be in PATH. Everything will need to be in PATH for ssc build post install.ps1.

92 installs everything and informs re paths.

Manual details are as follows:

LLVM

(If not using VS Build / Clang) https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.6/LLVM-15.0.6-win64.exe

VS Build Tools:

https://aka.ms/vs/17/release/vs_buildtools.exe nmake / Windows SDK only:

# .vsconfig file:
{
    "version": "1.0",
    "components": [
        "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
        "Microsoft.VisualStudio.Component.Windows10SDK.20348"
    ]
}

clang / cmake / Windows SDK (No LLVM or external CMake)

# .vsconfig file:
{
    "version": "1.0",
    "components": [
        "Microsoft.Component.MSBuild",
        "Microsoft.VisualStudio.Workload.VCTools",
        "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
        "Microsoft.VisualStudio.Component.VC.CMake.Project",
        "Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset",
        "Microsoft.VisualStudio.Component.VC.Llvm.Clang",
        "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Llvm.Clang",
        "Microsoft.VisualStudio.Component.Windows10SDK.20348"
    ]
}

vs_buildtools.exe --passive --config .vsconfig

Git:

https://github.com/git-for-windows/git/releases/download/v2.39.0.windows.2/Git-2.39.0.2-64-bit.exe via powershell: winget install --id Git.Git -e --source winget LFS support not required, but is installed by default using choco from installer.ps1.

CMake:

https://github.com/Kitware/CMake/releases/download/v3.25.1/cmake-3.25.1-windows-x86_64.msi

choco is only required by the installer.

trevnorris commented 1 year ago

Great info. Is this also everything necessary to build an application (not ssc)?

mribbons commented 1 year ago

building a windows app only requires clang++ if ssc and uv_a.lib have already been built.

Update: vc_redist is also required for app only build. https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist?view=msvc-170

Without this, there are errors about vcruntime140.dll, msvrct140.dll

Just came across this with LLVM by itself: clang++: warning: unable to find a Visual Studio installation; try running Clang from a developer command prompt Looks like LLVM isn't going to do much for us for now.

heapwolf commented 1 year ago

building a windows app only requires clang++ if ssc and uv_a.lib have already been built.

nice, so if we put the prebuilts from CI into npm deps we're almost there. Probably a next step is to ask what is the minimal version requirements are on the compiler.

trevnorris commented 1 year ago

My current steps to get working on Windows: Install these two manually (make sure to select the option to have them added to the PATH):

LLVM (anything >= v14 works) - https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.6/LLVM-14.0.6-win64.exe CMake - https://github.com/Kitware/CMake/releases/download/v3.25.1/cmake-3.25.1-windows-x86_64.msi Node.js (Windows installer, usually npm for building apps) - https://nodejs.org/en/download/ git (Windows installer) - https://git-scm.com/download/win

I install these using the usual installer because choco installs unnecessary extras, and doesn't change the PATH for you. I've remove choco from my system and it works fine.

Then use the Visual Studio Installer to install one of the following:

  1. Visual Studio 2022 Community - useful if you want to use VS to debug your code as it's running. Select the Desktop development with C++ and Node.js development options.
  2. Visual Studio 2019 Build Tools - smaller, and only necessary if you need to build apps. Select the components listed in the .vsconfig file in https://github.com/socketsupply/socket/issues/88#issuecomment-1376472809 from @mribbons.

Basically following what @mribbons did above. Did verify that Build Tools 2019 aren't necessary if you've installed VS 2022 Community. Also we should update the build script to not require choco.

I wasn't able to get it working without LLVM for now. In the future we should be able to change building ssc to use cmake and cl on Windows like libuv does so we don't need to install cmake and LLVM.