0

We are a C++ library. We are struggling with AppVeyor and Visual Studio build images with x64 builds. Visual Studio build images for Win32 suffer the same problem, but for some [unknown] reason, they complete successfully.

We are attempting to use the Visual Studio 2015 build image (among others):

enter image description here

When we inspect the command line, it appears we are using the Visual Studio 2010 compiler (Visual Studio 10.0 is VS2010):

enter image description here

Our AppVeyor configuration file is located at Noloader GitHub | .appveyor.yml. It is also shown below.

Everything is driven through .appveyor.yml. There are no hidden settings that are affecting things (or we don't believe so). We want everything in .appveyor.yml so people can clone it and things "just work" for them.

The project files are located in GitHub at cryptest.vcxproj and cryptlib.vcxproj. The *.vcxproj files use a hard-coded $(DefaultPlatformToolset) as suggested by @stinj. (EDIT: DefaultPlatformToolset - not anymore. We completely removed DefaultPlatformToolset and PlatformToolset).

The build results for the project are located at Noloader AppVeyor | cryptopp. Its the source of the screen captures.

Why are the wrong build tools being used, and how do we fix it?


When I avoid $(DefaultPlatformToolset) and hard code the the value of the platform toolset, it causes yet another error. For example, below is for the Visual Studio 2015 build image. It dies when the toolset version is set to v140, which is the VS2015 version value. It is befuddling.

(Commit ac513c06f8c8 was eventually reverted because it broke things worse than before).

enter image description here


When we completely remove all traces of PlatformToolset and DefaultPlatformToolset in our VCXPROJ files, it results in the same error. Below is from a Visual Studio 2017 build image.

enter image description here


version: 1.0.{build}
clone_depth: 3

configuration:

- Debug
- Release

platform:

- Win32
- x64

image:

- Visual Studio 2017
- Visual Studio 2015
- Visual Studio 2013

build: off   

test_script:

- cmd: >-   

    msbuild /t:Build /p:platform=%platform%;configuration=%configuration% cryptlib.vcxproj

    msbuild /t:Build /p:platform=%platform%;configuration=%configuration% cryptest.vcxproj

    msbuild /t:CopyCryptestToRoot cryptest.vcxproj

    cryptest.exe v

    cryptest.exe tv all

matrix:

  exclude:
#    - platform: x64
#      configuration: Debug
#    - platform: x64
#      configuration: Release
    - image: Visual Studio 2010
    - image: Visual Studio 2017

notifications:
    - provider: Email
      to:
        - cryptopp-build@googlegroups.com
      on_build_success: true
      on_build_failure: true
jww
  • 97,681
  • 90
  • 411
  • 885
  • Do you remove the rdrand.asm, x64dll.asm and x64masm.asm files from TestScripts folder? I get this build error messages (https://1drv.ms/i/s!AkHKK8SV6besg2XcFCHqXvM3xGcX). Please share a complete project to let me reproduce your problem. – Weiwei Aug 03 '17 at 07:00
  • Still get the same error. How do you assign the .appveyor.yml in AppVeyor Build settings? – Weiwei Aug 03 '17 at 07:43
  • Possible duplicate of [Can't perform 64-bit testing under AppVeyor?](https://stackoverflow.com/questions/43423761/cant-perform-64-bit-testing-under-appveyor) *edit* sorry meant https://stackoverflow.com/questions/45452145/how-to-set-platformtoolset-property-from-msbuild – stijn Aug 03 '17 at 08:17
  • $(DefaultPlatformToolset) must come *after* the \Microsoft.Cpp.Default.props else it is not defined. And I cannot reproduce the problem with v140 not being found in the VS2015 image. – stijn Aug 03 '17 at 08:18
  • @Thanks stinj. *"And I cannot reproduce the problem with v140 not being found in the VS2015 image...'* - yeah, I'd like to find out what the hell is going on. This has wasted far too much of everyone's time. – jww Aug 03 '17 at 08:30
  • @stijn - This is classic... The *"Import Properties"* group was moved above the *"Global Properties"* group at [Commit 1702c93b308](https://github.com/weidai11/cryptopp/commit/1702c93b308e4f9) to facilitate setting `PlatformToolset`. Now, MSbuild tries to build an executable instead of a static library even though `StaticLibrary` is unchanged. It errors with *`LINK : fatal error LNK1561: entry point must be defined`*. – jww Aug 03 '17 at 09:14
  • @stijn - I had to back out the 1702c9 commit. It looks like we have two choices: either let MSbuild be broken, or let AppVeyor be broken. We can't let the project files break like that, so AppVeyor will be sacraficed. I must be in some sort or programmers purgatory, with MSbuild and AppVeyor being used as torture devices... – jww Aug 03 '17 at 09:28
  • Maybe take a step back and check e.g. https://github.com/stinos/cryptopp/commit/f814a984eb71c5aec4cc7c487fcebe06e96208ca which works ok without any breakage, just like the other 2 branches, because it's different from what you are trying: it has both changes in appveyor.yml and the project files. Anyway since I did that already anyway, you just want a PR maybe? – stijn Aug 03 '17 at 10:02
  • @Stinj - By the way, here's the best documentation I can find on [VCXPROJ files on MSDN](https://msdn.microsoft.com/en-us/library/2208a1f2.aspx). It clearly shows Global Properties before Import Properties. I guess that explains the break at [Commit 1702c93b308](https://github.com/weidai11/cryptopp/commit/1702c93b308e4f9). Microsoft should be embarrassed with this fragile, broken shit and lack of decent documentation. – jww Aug 03 '17 at 23:36

1 Answers1

2

Here is how I made it work:

  • Set ToolsVersion="$(ToolsVersion)" and <PlatformToolset>$(TOOLSET)</PlatformToolset> in both .vcxproj files

  • Add Environment variables TOOLSET with value v140 and ToolsVersion with value 14.0

To achieve all combinations you need with different variables you can use build matrix and avoid combinations you do not need with exclude configuration from the matrix.

UPDATE: Matrix sample

image:
- Visual Studio 2015
- Visual Studio 2013
platform:
- x64
- x86
environment:
  matrix:
  - TOOLSET: v140
    ToolsVersion: 14.0
  - TOOLSET: v100
    ToolsVersion: 4.0
matrix:
  exclude:
    - image: Visual Studio 2015
      TOOLSET: v100
      ToolsVersion: 4.0
    - image: Visual Studio 2013
      TOOLSET: v140
      ToolsVersion: 14.0
Ilya Finkelsheyn
  • 2,851
  • 11
  • 20