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

[viosock] Unable to build using defaults or for amd64 #1184

Closed
benyamin-codez opened this issue Nov 8, 2024 · 20 comments
Closed

[viosock] Unable to build using defaults or for amd64 #1184

benyamin-codez opened this issue Nov 8, 2024 · 20 comments
Assignees
Labels

Comments

@benyamin-codez
Copy link
Contributor

benyamin-codez commented Nov 8, 2024

Building for amd64/x64 - whether called by buildAll.bat or viosock\buildAll.bat - fails for both Win10 and Win11 targets because of missing x86 components.

Same result whether using:

  • Cobalt EWDK (10.0.22000.0/21H2, MSBuild v16.11.2+) on Server2019; OR
  • Germanium EWDK (10.0.26100.0/24H2, MSBuild v17.10.4+) on Windows 11 24H2.

Relevant log snippet for Win10 using master:

12>Virtio-Win:
        Driver.Initial.props: _NT_TARGET_VERSION=0x0A00 SUBSYSTEM_NATVER=10.00 mismatch=
    DriverBuildNotifications:
        Building 'ViosockPackage' with toolset 'WindowsKernelModeDriver10.0' and the 'Universal' target platform.
        Using KMDF 1.15.
    PrepareForBuild:
        Creating directory "x64\Win10Release\".
        Creating directory "x64\Win10Release\ViosockPackage.tlog\".
    InitializeBuildStatus:
        Creating "x64\Win10Release\ViosockPackage.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
    CopyLibFiles:
        Copy .
        Copying file from "<redacted source location>\viosock\lib\x64\Win10Release\viosocklib.pdb" to "<redacted source location>\viosock\Install\win10\amd64\viosocklib_x64.pdb".
        Copying file from "<redacted source location>\viosock\lib\x64\Win10Release\viosocklib.dll" to "<redacted source location>\viosock\Install\win10\amd64\viosocklib_x64.dll".
12><redacted source location>\viosock\ViosockPackage\ViosockPackage.vcxproj(136,5): error MSB3030: Could not copy the file "..\lib\x86\Win10Release\viosocklib.pdb" because it was not found.
12><redacted source location>\viosock\ViosockPackage\ViosockPackage.vcxproj(136,5): error MSB3030: Could not copy the file "..\lib\x86\Win10Release\viosocklib.dll" because it was not found.
12>Done Building Project "<redacted source location>\viosock\ViosockPackage\ViosockPackage.vcxproj" (default targets) -- FAILED.
11>Done Building Project "<redacted source location>\viosock\ViosockPackage\ViosockPackage.vcxproj.metaproj" (default targets) -- FAILED.
    1>Done Building Project "<redacted source location>\viosock\viosock.sln" (Build target(s)) -- FAILED.

Attempting to build for x86 or all architectures using Germanium EWDK results in 'Win32' is not a valid architecture for Kernel mode drivers or UMDF drivers.

Attempting to build Win11 for x86 or all architectures using Cobalt EWDK results in fatal error LNK1181: cannot open input file '<redacted source location>\viosock\wsk\objfre_win11_x86\i386\viosockwsk.lib'.

Attempting to build Win10 for x86 or all architectures using Cobalt EWDK succeeds...! Is this the only supported configuration?

Makes it hard to test buildAll.bat as call build\build.bat virtio-win.sln "Win10 Win11" %* fails...

Win10_SDV and Win11_SDV do complete but don't appear to produce much. I see there's no entry in viosock\buildAll.bat for Win10_SDV and Win11_SDV is limited to sys\viosock.vcxproj, wsk\wsk.vcxproj and viosock-wsk-test\viosock-wsk-test.vcxproj.

What am I missing...?

@benyamin-codez
Copy link
Contributor Author

I see this is a a duplicate of #733, but perhaps now worth fixing...?

I also note there were many, many CodeQL warnings...

@benyamin-codez
Copy link
Contributor Author

Attempting to build for x86 or all architectures using Germanium EWDK results in 'Win32' is not a valid architecture for Kernel mode drivers or UMDF drivers.

I should make it clear that this was for both Win10 and Win11.

@kostyanf14
Copy link
Member

Hi @benyamin-codez,

This is known issue.
The x86 dll is needed for WOW64 (32-bit support on 64-bit platforms). Even if you have Windows x64, you should install the x64 driver, but a client application can be x86 or x64.

Unfortunately, you cannot define dependency from another platform, just another project as a dependency.
So, you must build x86 lib before you will build the x64 package.

@kostyanf14
Copy link
Member

Attempting to build for x86 or all architectures using Germanium EWDK results in 'Win32' is not a valid architecture for Kernel mode drivers or UMDF drivers.

This is Microsoft changes. You cannot use EWDK 24H2 / 2025 to build an x86 version of KMD/UMD. This is one of the reasons we use two EWDK in parallel.

@YanVugenfirer
Copy link
Collaborator

BTW: not Win11 32bit.

@benyamin-codez
Copy link
Contributor Author

@kostyanf14 @YanVugenfirer

Thanks for the feedback.
Just coming back to virtio-win after seeing to some other commitments...

Is it fair to say that this remains an issue that you cannot simply call buildAll.bat or viosock\buildAll.bat when using the most recent EWDK? Or without first meeting cross-platform dependencies when building for Win11? This will become an increasing problem as Win11 becomes the most common target (if it isn't already). I think there's some value in getting ahead of this.

Most, if not all of this, should be fairly easy to fix with just batch.
I'll drop a PR for consideration - hopefully in the next few hours.

Yan, just to be clear, I couldn't build Win11 at all with the EWDK versions listed.
Are you saying you are able to build Win11 x86? If so, what version were you using?

Also, I couldn't run the build again without cleaning up first.
Hopefully this isn't and issue after pre-building the libraries...
I will soon find out...!

@YanVugenfirer
Copy link
Collaborator

YanVugenfirer commented Nov 10, 2024

@benyamin-codez Sorry I might be missing something:
"Is it fair to say that this remains an issue that you cannot simply call buildAll.bat or viosock\buildAll.bat when using the most recent EWDK? Or without first meeting cross-platform dependencies when building for Win11?"

As @kostyanf14 said - if you want to build everything by running buildall.bat you need two eDWKs, because 32bit binaries cannot be built with Win11 eWDK. Moreover - Win11 eWDK doesn't support first versions of Win10. So it is not a good idea to use it to build Windows 10 binaries in general, as you don't know the lowest Win10 version the user might use.

Are you saying you are able to build Win11 x86? If so, what version were you using?

There is no such thing as Windows 11 x86. Only 64bit version of Win11 exists.

@kostyanf14 I see that "buildall.bat Win11" doesn't work as intended.

Also if you play with changing compilers\kits - run clean.bat between experiments.

@benyamin-codez
Copy link
Contributor Author

@kostyanf14 @YanVugenfirer

Some observations:

Cleaning (using clean.bat) retains viosock\lib\x86 and folders (x64, x86, arm64) in viosock\wspsvc too.
Cleaning from within the viosock directory leaves these folders in most directories.
I presume this is by design.

Building on Cobalt EWDK with buildAll.bat Win11 actually does succeed (as does buildAll.bat Win11 x86).
Building the same from within the viosock directory fails.
Building for Win10 - with any arguments except amd64 - succeeds in either location.
Building for amd64 fails in either location.
Is this the expected behaviour?

Building on Germanium EWDK with buildAll.bat Win11 actually does succeed (as does buildAll.bat Win11 x86).
Building the same from within the viosock directory fails.
Building for Win10 with any arguments fails in either location.
Building for amd64 fails in either location.

Moreover - Win11 eWDK doesn't support first versions of Win10. So it is not a good idea to use it to build Windows 10 binaries in general, as you don't know the lowest Win10 version the user might use.

Are you saying we should still be using Titanium EWDK (19H1) for Win10 builds, or is Cobalt EWDK (21H2) ok?

@benyamin-codez
Copy link
Contributor Author

@kostyanf14 @YanVugenfirer

Just to me clear, building for amd64 fails regardless of whether the target is Win10 or Win11.

So I think the simplest solution to this amd64 build issue is call an x86 build of viosock first.
That's pretty easy to do in batch and I have something almost done for that.

I could do something similar for Win10 builds on Germanium EWDK (from EWDK_24H2_DIR) by calling the build under EWDK_DIR instead (if present, failing if not). My concerns with this are:

  1. How HCK could be affected (I imagine it will work either way but could potentially duplicate build processes); &
  2. Whether we should be using Titanium EWDK rather than Cobalt EWDK for Win10.

@benyamin-codez
Copy link
Contributor Author

@kostyanf14 @YanVugenfirer

Progress update:

Ok, so I've managed to get Cobalt EWDK working for all targets and architectures from the tree root and also in viosock.
Now moving on to work out the same with Germanium EWDK by calling Cobalt EWDK when necessary...
I'll try to stay minded to keep it extensible for other EWDK versions, e.g. Titanium EWDK (19H1).
Please do let me know if Win10 builds need this or an earlier version... c( O.O )ɔ

When done, I'll post all of that in a PR with some other SDV/CodeQL changes, basically updates to build\build.bat.
I think it best to consider this before updating the wiki (it will simplify any updates), per #1176 (comment).

Cleaning (using clean.bat) retains viosock\lib\x86 and folders (x64, x86, arm64) in viosock\wspsvc too.
Cleaning from within the viosock directory leaves these folders in most directories.
I presume this is by design.

I couldn't determine any reason as to why this would be the case.
Some of the leftovers were because the cleaners were bombing out.
So I've also cleaned up the cleaners throughout the tree.
I'll drop that in a separate PR.

I've also done some vioscsi specific build improvements, which I'll drop in another PR.
These might want to be considered for other parts of the tree. NetKVM comes to mind.

I'll drop PR numbers here once submitted...

@kostyanf14
Copy link
Member

@benyamin-codez

When done, I'll post all of that in a PR with some other SDV/CodeQL changes, basically updates to build\build.bat.

What do you want to do? Currently, we did not see any problem with build in upstream and in RedHat downstream builds.
Some parts can look strange, but we need to build drivers for different platforms with different SDKs according to Microsoft certification requirements.

Current build and artifacts matrix

version EWDK driver folder SDV is needed DVL folder
Win10 22000 win10 + win10
Server 2016/2019 22000 win10 + win10 + compat
Win11 21H2/22H2/23H2 26100+ win11 + win10 (need SDV)
Server 2022 22000 win10 + win10
Win11 24H2 26100+ win11 - win11
Server 2025 26100+ win11 - win11

@benyamin-codez
Copy link
Contributor Author

@kostyanf14

Thanks, Kostiantyn..! That's a very helpful matrix..! Is it published somewhere? Maybe I can add it to my wiki PR?

When done, I'll post all of that in a PR with some other SDV/CodeQL changes, basically updates to build\build.bat.

What do you want to do? Currently, we did not see any problem with build in upstream and in RedHat downstream builds. Some parts can look strange, but we need to build drivers for different platforms with different SDKs according to Microsoft certification requirements.

Basically, when I touch a part of the tree, I want to be able to build that branch for all platforms and at the very least make sure it will compile without error on as many platforms as possible before raising relevant PRs. Therefore, if I touch something in the root, or in build, I want to be able to build the whole tree.

It's worth pointing out that I raised this issue because I couldn't do any amd64 only builds against virtio-win.sln using any EWDK. That has now been resolved, per your suggestion of building the WOW64 binaries first. My solution, does so in the two scenarios where it is required, and automates this process.

I imagine your in-house tooling does something similar. If I would hazard a guess: in your case - and in that of many of the other fine folk wearing red fedoras - you build the tree in your HCK toolkit, customising builds for various platforms, as part of your normal CI/CD operations ... but for me, I just want to build it from the EWDK, and preferably straight from the optical drive rather than from the hard drive (as this aids in upgrading EWDKs on multiple dev and test boxes).

Secondly, and again to save time, I'd also prefer to build without SDV but with CodeQL instead, especially given SDV is deprecated - at least in part. The easiest way I found to do that (at least without making drastic changes) is to still use the SDV tag but add a WHCP_LEVEL argument to specify the branch.

I ended up using WHCP_LEGACY and WHCP_24H2 as the two required levels. When using CodeQL CLI v2.15.4+, these map to the microsoft/[email protected] and microsoft/[email protected] CodeQL packs respectively. I also note that WHCP_24H1, WHCP_24H2 (further noting there is no WHCP_23H2 branch, where Win11 23H2 just uses the WHCP_22H2 branch) and even Windows 10 will all happily run the WHCP_24H2 configuration too. The advantage to this is that you check for more issues (28 versus 45).

I say WHCP branches here, but I only use the repo for the suites (for which I control and check for updates based on a Git commit hash), and instead rely on the CodeQL package cache. For a variety of reasons (mostly for sanity), this requires additional steps in-flight, i.e. during build, but less steps to set up. These were the changes I wanted to add to the wiki, but thought I'd better build out the in-flight part first, raise a PR, get the buy-in of you and your colleagues, and then do another PR for necessary wiki changes based on where the chips might fall.

In my cut of build.bat I had deprecated SDV but left the orphan code intact. From your matrix, it seems that SDV is only deprecated for 24H2 versions. However, all the MS docos I have read of late seem to indicate that it is deprecated.

Does MS definitely still require SDV-based DVLs for ALL Windows 10 / pre-24H2 targets?

I noticed we produce some DVL files for Win10 which are just a copy of Win11, and (sometimes) a COMPAT version too.
Without SDV these DVLs include the line:

<AssessmentScore ScoreName="vioscsi.x64.SDV.NORUN" ScoreValue="0" ScoreUnit="" />

I presume that is a problem if SDV is indeed still needed for the WHCP. My reading was that CodeQL created DVLs were sufficient. This is based on text such as, e.g. "However, if you are certifying for Windows Server 2022 and below; CA, SDV and CodeQL can be used. Use WDK builds with the matching OS release versions."

That being said, if a particular version of the HLK is required for a particular build, and the HLK fails the DVL for lack of SDV having run, then I can see how that would be an issue. If that is the case, I can certainly add a variable along the lines of USE_CODEQL_EXCLUSIVE, or similar, and resurrect the SDV orphans I deprecated on a conditional basis. That way it would run normally, i.e. with SDV, unless the variable was set.

So then we have the oddity in the matrix of Win11 21H2/22H2/23H2 using Germanium EWDK (26100+) where SDV is most definitely deprecated. I presume here that the DVL is preferably sourced from a Cobalt EWDK (22000) build for Win10 (rather than just a copy of a Win11 DVL). This is what I am working on now, as discussed above.

I don't think anything I am working on is likely to affect your existing tooling, but will instead likely extend your build time capability, especially around CodeQL. The advantage is really for external contributors like myself, who want to more thoroughly check their code before submitting PRs.

I'll probably raise the various PRs as drafts, and from there we can discuss any issues and what you think is worth keeping.

Apologies for the long post. I hope that clears things up somewhat. Obviously the details would be in any PRs.

Best regards,
Ben

@kostyanf14
Copy link
Member

kostyanf14 commented Nov 11, 2024

@benyamin-codez

That's a very helpful matrix..! Is it published somewhere? Maybe I can add it to my wiki PR?

Only in PR that switched to EWDK 24H2.

Does MS definitely still require SDV-based DVLs for ALL Windows 10 / pre-24H2 targets?

YES!
Also, Windows Server 2016 required a COMPAT version (without checksum) but WITH SDV.

That being said, if a particular version of the HLK is required for a particular build, and the HLK fails the DVL for lack of SDV having run, then I can see how that would be an issue.

You can see the table of OS and HLK versions for it there https://learn.microsoft.com/en-us/windows-hardware/test/hlk/.
All HLK before Server 2025/Win11 24H2 required SDV results in DVL.
That's why we have line Win11 21H2/22H2/23H2 26100+ win11 + win10 (need SDV) in the build matrix.

I ended up using WHCP_LEGACY and WHCP_24H2 as the two required level

I don't see any reason for this. CodeQL results based on the WHCP_24H2 branch are good for both Win10 and Win11. We experimented with different CodeQL versions and with different WHCP* branches and see that there is no difference for HLK. This option just created a more complicated build environment in my opinion.

@kostyanf14
Copy link
Member

@benyamin-codez

Also, you can see build/dvl1903.bat that called for 3 drivers (NetKVM, vioscsi, viostor). This is created as a part of the requirements for HLK for Server 2019 / Windows 10 1903/1909. And we copy DVL.exe from EWDK only for this specific case.

@kostyanf14
Copy link
Member

@benyamin-codez @YanVugenfirer

It's worth pointing out that I raised this issue because I couldn't do any amd64 only builds against virtio-win.sln using any EWDK. That has now been resolved, per your suggestion of building the WOW64 binaries first. My solution, does so in the two scenarios where it is required, and automates this process.

Need to see your PR but I don't prefer the idea of building x86 as a dependency of AMD64 automatically.

@kostyanf14
Copy link
Member

@benyamin-codez

Just FYI. Jenkins config of build job:

git diff --name-only "origin/%ghprbTargetBranch%" > diff.txt

set VIRTIO_WIN_SDV_2022=1

set str1=%ghprbPullTitle%
if not "x%str1:NO-SDV=%"=="x%str1%" (
  powershell "./build_AllNoSdv.bat | tee build_log.txt"
) else (
  powershell "./buildAll.bat | tee build_log.txt"
)

powershell "./build/signAll.bat | tee sign_log.txt"

Files to archive the artifacts: **/Install/**/*, diff.txt, build_log.txt, sign_log.txt, .hck-ci/triggers.yml

There are no any workarounds. We always run the build from the root batch file on CI.

@benyamin-codez
Copy link
Contributor Author

@kostyanf14

Thanks for making the time to reply..!
...and confirming the status of SDV requirements.

I ended up using WHCP_LEGACY and WHCP_24H2 as the two required level...

I don't see any reason for this. CodeQL results based on the WHCP_24H2 branch are good for both Win10 and Win11. We experimented with different CodeQL versions and with different WHCP* branches and see that there is no difference for HLK. This option just created a more complicated build environment in my opinion.

That's good to know. I wasn't sure if MS would accept this as they state that you must use the @1.0.13 pack for pre-WHCP_24H2 (what I labelled WHCP_LEGACY). It's very good that they do accept @1.1.0 instead which will run the extra tests. I'm not familiar enough with what is submitted to know whether they can tell which one ran...

I did default to WHCP_24H2, so you would have to explicitly set it to WHCP_LEGACY to enable @1.0.13.
I guess the advantage of having it is when the next iteration arrives, the template is there.
This is also essentially following the wiki (in effect). You might remember this is where I started... 8^d
The relevant parts FYI (args and :runql):

if /I "%ARG%"=="WHCP_LEGACY" set WHCP_LEVEL=WHCP_LEGACY& goto :argloop
if /I "%ARG%"=="WHCP_21H2" set WHCP_LEVEL=WHCP_LEGACY& goto :argloop
if /I "%ARG%"=="WHCP_21H2" set WHCP_LEVEL=WHCP_LEGACY& goto :argloop
rem WHCP_23H2 is a non-existent repo branch. Included here for completeness.
if /I "%ARG%"=="WHCP_23H2" set WHCP_LEVEL=WHCP_LEGACY& goto :argloop
rem WHCP_24H2 is the default. Set below during SDV builds only.
if /I "%ARG%"=="WHCP_24H2" set WHCP_LEVEL=WHCP_24H2& goto :argloop

rem ....

:runql
if exist %~dp1codeql_db (
  echo "Removing previously created rules database"
  rmdir /s /q %~dp1codeql_db
)

echo call "%~dp0SetVsEnv.bat" %~1 > %~dp1codeql.build.bat
echo msbuild.exe -maxCpuCount %~dp1%BUILD_FILE% /t:rebuild /p:Configuration="%~1" /P:Platform=%2 >> %~dp1codeql.build.bat

call %CODEQL_BIN% database create -l=cpp -s=%~dp1 -c "%~dp1codeql.build.bat" %~dp1codeql_db -j 0

IF ERRORLEVEL 1 (
  set CODEQL_FAILED=1
  set BUILD_FAILED=1
)

IF "%CODEQL_FAILED%" NEQ "1" (

  rem Make sure the codeql-workspace.yml file is deleted from the repo so that CodeQL ignores the repo and relies on the cache instead
  if exist %CODEQL_DRIVER_SUITES%\..\codeql-workspace.yml (del %CODEQL_DRIVER_SUITES%\..\codeql-workspace.yml)

  rem The use of --model-packs=<name@range> is ignored and the most recent pack in the cache is always used.
  rem Therefore, we must prepare the cache depending on the WHCP_LEVEL variable.
  rem From CodeQL CLI v2.15.4 we use :
  rem   [a] microsoft/[email protected] for everything below WHCP_24H2
  rem   [b] microsoft/[email protected] for WHCP_24H2 [and potentially newer versions once released]
  rem Note: This should also work with more recent versions of CodeQL CLI [tested to v2.19.2]
  if "%WHCP_LEVEL%"=="WHCP_LEGACY" (
    echo Configuring CodeQL database analysis cache for legacy WHCP with the microsoft/[email protected] CodeQL pack
    if exist "%USERPROFILE%\.codeql\packages\microsoft\windows-drivers\1.1.0" (rmdir /s /q "%USERPROFILE%\.codeql\packages\microsoft\windows-drivers\1.1.0")
    if not exist "%USERPROFILE%\.codeql\packages\microsoft\windows-drivers\1.0.13" (call %CODEQL_BIN% pack download -v microsoft/windows-drivers@1.0.13)
  )
  if "%WHCP_LEVEL%"=="WHCP_24H2" (
    echo Configuring CodeQL database analysis cache for WHCP_24H2 with the microsoft/[email protected] CodeQL pack
    if not exist "%USERPROFILE%\.codeql\packages\microsoft\windows-drivers\1.1.0" (call %CODEQL_BIN% pack download -v microsoft/windows-drivers@1.1.0)
  )
  if "%WHCP_LEVEL%"=="WHCP_NEXT" (
    rem USE THIS AS A TEMPLATE FOR FUTURE VERSIONS
    rem NOTE: Remember to add the directory removal conditionals to all WHCP_LEVELS above [per WHCP_LEGACY example]...
    echo Configuring CodeQL database analysis cache for WHCP_NEXT with the microsoft/windows-drivers@__NEXTRANGE__ CodeQL pack
    if not exist "%USERPROFILE%\.codeql\packages\microsoft\windows-drivers\__NEXTRANGE__" (call %CODEQL_BIN% pack download -v microsoft/windows-drivers@__NEXTRANGE__)
  )

  rem Do the analysis...
  call %CODEQL_BIN% database analyze %~dp1codeql_db %CODEQL_DRIVER_SUITES%\windows_driver_recommended.qls --format=sarifv2.1.0 --output=%~dp1%BUILD_NAME%.sarif -j 0
)

IF ERRORLEVEL 1 (
  set BUILD_FAILED=1
)

goto :eof

Also, you can see build/dvl1903.bat that called for 3 drivers (NetKVM, vioscsi, viostor). This is created as a part of the requirements for HLK for Server 2019 / Windows 10 1903/1909. And we copy DVL.exe from EWDK only for this specific case.

I presume the DVL files are copied from Titanium EDWK (19H1 / 18362) per the wiki. This is what I have been doing.
Is that correct..?

Need to see your PR but I don't prefer the idea of building x86 as a dependency of AMD64 automatically.

I could add a conditional for external devs like me, but I think even if it ran, it's pretty fast.
You might have other considerations...?
Here's a somewhat trimmed snippet:

rem We have pre / post 24H2 buildtime conditions
set WHCP_LEVEL=
set VSCMD_WHCP_LEVEL=
set VIOSOCK_PREBUILD_X86_LIBS=

rem Split MSBuild version and check if pre or post 24H2...
for /f "tokens=1,2,3 usebackq delims=." %%i in (`echo %%VSCMD_VER%%`) do @set VSCMD_VER_MAJOR=%%i && set VSCMD_VER_MINOR=%%j && set VSCMD_VER_BUILD=%%k
if not %VSCMD_VER_MAJOR% LSS 17 (
  if not %VSCMD_VER_MINOR% LSS 8 (
    set VSCMD_WHCP_LEVEL=WHCP_24H2
  ) else (
    set VSCMD_WHCP_LEVEL=WHCP_LEGACY
  )
) else (
  set VSCMD_WHCP_LEVEL=WHCP_LEGACY
)

rem ... Near top
rem ...  Much in-between
rem ...   In the midst of :build_arch

rem Check for x86 viosock libraries and build them if needed...
echo Building : %BUILD_FILE%
if "%BUILD_FILE%"=="virtio-win.sln" (set VIOSOCK_PREBUILD_X86_LIBS=1)
if "%BUILD_FILE%"=="viosock.sln" (set VIOSOCK_PREBUILD_X86_LIBS=1)
if not "%VIOSOCK_PREBUILD_X86_LIBS%"=="" (
  if %BUILD_ARCH%==amd64 (
    if not exist "%BUILD_DIR%viosock\lib\x86\%TARGET%%BUILD_FLAVOR%\viosocklib.dll" (
      echo WARNING - Need to build x86 viosock libraries before building for amd64...
      if not "%VSCMD_WHCP_LEVEL%"=="WHCP_LEGACY" (
        echo MSBuild version is %VSCMD_VER% - too high to build the viosock x86 libraries. Checking EWDK_DIR version...
rem ... Work In Progress here ...
      ) else (
        echo MSBuild version is %VSCMD_VER% - already at the right level to build viosock x86 libraries.
        setlocal
        set VIRTIO_WIN_NO_ARM=1
        pushd
        if "%BUILD_FILE%"=="virtio-win.sln" (cd /d "%BUILD_DIR%viosock\lib")
        if "%BUILD_FILE%"=="viosock.sln" (cd /d "%BUILD_DIR%\lib")
        call ..\..\build\build.bat viosocklib.vcxproj %TARGET% x86
        if ERRORLEVEL 1 (
          popd
          endlocal
          set BUILD_FAILED=1
          goto :eof
        )
        popd
        endlocal
      )
    )
  )
)

Probably best to see my final cut in the PR, but would welcome any further comments.

set str1=%ghprbPullTitle%
if not "x%str1:NO-SDV=%"=="x%str1%"```

I see. The renames make more sense now..!

Thanks again, Kostiantyn.
I'm certainly becoming more familiar with this part.
Obviously I don't want any changes to clash with your work.
I'll have a bit more of a think and pick it up again in a few hours hopefully.

Best regards,
Ben

@benyamin-codez
Copy link
Contributor Author

@kostyanf14

I didn't notice before, but this part:

pushd
if "%BUILD_FILE%"=="virtio-win.sln" (cd /d "%BUILD_DIR%viosock\lib")
if "%BUILD_FILE%"=="viosock.sln" (cd /d "%BUILD_DIR%\lib")

...should be:

if "%BUILD_FILE%"=="virtio-win.sln" (pushd "%BUILD_DIR%viosock\lib")
if "%BUILD_FILE%"=="viosock.sln" (pushd "%BUILD_DIR%\lib")

Late night mangling... 8^d

@benyamin-codez
Copy link
Contributor Author

In similar vein, the following is not required:

set VIRTIO_WIN_NO_ARM=1

@benyamin-codez
Copy link
Contributor Author

Hope to drop fully tested PR in the next 24 to 48 hours.
Many competing priorities the next couple of days...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants