awsdocs / aws-doc-sdk-examples

Welcome to the AWS Code Examples Repository. This repo contains code examples used in the AWS documentation, AWS SDK Developer Guides, and more. For more information, see the Readme.md file below.
Apache License 2.0
9.61k stars 5.64k forks source link

error: building aws-c-cal:x64-windows-static-md failed with: BUILD_FAILED[Bug] #6290

Closed VikingExplorer closed 7 months ago

VikingExplorer commented 7 months ago

Expected behavior

I really need to use the appsync functionality, but it's not in the version I've got. I haven't used vcpkg in a year or two. Does anyone have an idea what's going wrong?

I'm using VS2022 17.9.4, v143

C:\Dev\Couloir\3pLibs\vcpkg>.\vcpkg install aws-sdk-cpp[apigateway,apigatewayv2,appsync,autoscaling,autoscaling-plans,budgets,core,dynamodb,ec2,email,glacier,iam,imagebuilder,lambda,lex,lex-models,location,logs,managedblockchain,pricing,rds,rds-data,s3,secretsmanager,sms,sns,sqs,translate,wellarchitected,xray]:x64-windows-static-md --recurse

warning: vcpkg appears to be in a Visual Studio prompt targeting x86 but installing for x64-windows-static-md. Consider using --triplet x86-windows or --triplet x86-uwp.

CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:134 (message): Command failed: C:/Dev/Couloir/3pLibs/vcpkg/downloads/tools/cmake-3.29.0-windows/cmake-3.29.0-windows-i386/bin/cmake.exe --build . --config Debug --target install -- -v -j17 Working Directory: C:/Dev/Couloir/3pLibs/vcpkg/buildtrees/aws-c-cal/x64-windows-static-md-dbg See logs for more information: C:\Dev\Couloir\3pLibs\vcpkg\buildtrees\aws-c-cal\install-x64-windows-static-md-dbg-out.log

Call Stack (most recent call first): installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_build.cmake:102 (vcpkg_execute_build_process) installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_install.cmake:41 (vcpkg_cmake_build) ports/aws-c-cal/portfile.cmake:17 (vcpkg_cmake_install) scripts/ports.cmake:175 (include)

error: building aws-c-cal:x64-windows-static-md failed with: BUILD_FAILED

Actual behavior

install-x64-windows-static-md-dbg-out.log

C:\PROGRA1\MIB0551\2022\COMMUN1\VC\Tools\MSVC\14391.335\bin\Hostx64\x64\cl.exe -DDEBUG_BUILD -IC:\Dev\Couloir\3pLibs\vcpkg\buildtrees\aws-c-cal\src\v0.6.10-73dc1009ad.clean\include -external:IC:\Dev\Couloir\3pLibs\vcpkg\installed\x64-windows-static-md\include -external:W0 /nologo /DWIN32 /D_WINDOWS /utf-8 /MP /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 /W4 /WX /MP /volatile:iso /showIncludes /FoCMakeFiles\aws-c-cal.dir\source\cal.c.obj /FdCMakeFiles\aws-c-cal.dir\aws-c-cal.pdb /FS -c C:\Dev\Couloir\3pLibs\vcpkg\buildtrees\aws-c-cal\src\v0.6.10-73dc1009ad.clean\source\cal.c C:\Dev\Couloir\3pLibs\vcpkg\buildtrees\aws-c-cal\src\v0.6.10-73dc1009ad.clean\include\aws/cal/cal.h(15): error C2220: the following warning is treated as an error C:\Dev\Couloir\3pLibs\vcpkg\buildtrees\aws-c-cal\src\v0.6.10-73dc1009ad.clean\include\aws/cal/cal.h(15): warning C4431: missing type specifier - int assumed. Note: C no longer supports default-int C:\Dev\Couloir\3pLibs\vcpkg\buildtrees\aws-c-cal\src\v0.6.10-73dc1009ad.clean\include\aws/cal/cal.h(15): error C2054: expected '(' to follow 'AWS_PUSH_SANE_WARNING_LEVEL' C:\Dev\Couloir\3pLibs\vcpkg\buildtrees\aws-c-cal\src\v0.6.10-73dc1009ad.clean\include\aws/cal/cal.h(20): error C2296: '<<': not valid as left operand has type 'char [3]' C:\Dev\Couloir\3pLibs\vcpkg\buildtrees\aws-c-cal\src\v0.6.10-73dc1009ad.clean\include\aws/cal/cal.h(20): error C2297: '<<': not valid as right operand has type 'char [3]' C:\Dev\Couloir\3pLibs\vcpkg\buildtrees\aws-c-cal\src\v0.6.10-73dc1009ad.clean\include\aws/cal/cal.h(20): error C2056: illegal expression

Steps to reproduce

1. git pull
2. ./vcpkg install
3.

Logs / stacktrace (if applicable)

No response

Which SDK were you using?

C++

Which OS were you using?

Windows

SDK version

1.11.285 from 1.8.126

OS version

Windows 10

VikingExplorer commented 7 months ago

I tried building using the instructions at https://github.com/aws/aws-sdk-cpp

C:\Dev\Couloir\3pLibs\aws_win\build> cmake ../aws-sdk-cpp -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../install -DBUILD_ONLY="s3"

There is no error, but it doesn't seem to produce the file: aws-cpp-sdk-s3.lib

VikingExplorer commented 7 months ago

Ok, forgot this requires another command to actually build. Was expecting a one cmd to do the whole build.

So, I got a lot of DLLs. How do I get what's implied by x64-windows-static-md

set(VCPKG_TARGET_ARCHITECTURE x64) set(VCPKG_CRT_LINKAGE dynamic) set(VCPKG_LIBRARY_LINKAGE static)

VikingExplorer commented 7 months ago

cmake ../aws-sdk-cpp -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF -DBUILD_ONLY="s3" cmake --build . --config=Debug cmake --install . --prefix ../install

But the .lib file doesn't show up in the install directory.

How can I get all the .h files into one include folder and all the .lib files into one lib folder?

VikingExplorer commented 7 months ago

Following these instructions: https://docs.aws.amazon.com/sdk-for-cpp/v1/developer-guide/setup-windows.html

Getting this error. The folder "C:\Dev\Couloir\3pLibs\aws_win\build\CMakeFiles\CMakeScratch" is empty. WTF?

PS C:\Dev\Couloir\3pLibs\aws_win\build> cmake "..\aws-sdk-cpp" -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF -DBUILD_ONLY="s3" -DCMAKE_PREFIX_PATH="C:\Dev\Couloir\3pLibs\aws_win\install" -- Building for: Visual Studio 17 2022 CMake Warning at CMakeLists.txt:9 (message): In 1.11 releases, we are releasing experimental alternative building mode.By setting -DLEGACY_MODE=OFF you can test our advances in modern CMake building and provide early feedback. The legacy support is set by default in 1.11, when you complete build updating scripts please update the build flags as mentioned in README.md and set -DLEGACY_BUILD=OFF. The legacy support will be removed at 1.12.0 release.

CMake Deprecation Warning at CMakeLists.txt:17 (cmake_policy): The OLD behavior for policy CMP0077 will be removed from a future version of CMake.

The cmake-policies(7) manual explains that the OLD behaviors of all policies are deprecated and that a policy should be set to OLD only under specific short-term circumstances. Projects should be ported to the NEW behavior and not rely on setting a policy to OLD.

-- TARGET_ARCH not specified; inferring host OS to be platform compilation target -- Building AWS libraries as static objects -- Generating windows build config -- Building project version: 1.11.295 -- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045. -- The CXX compiler identification is MSVC 19.39.33523.0 -- Detecting CXX compiler ABI info CMake Error at C:/Dev/Couloir/3pLibs/aws_win/build/CMakeFiles/CMakeScratch/TryCompile-xwzhcd/CMakeLists.txt:2 (set): Syntax error in cmake code at

C:/Dev/Couloir/3pLibs/aws_win/build/CMakeFiles/CMakeScratch/TryCompile-xwzhcd/CMakeLists.txt:2

when parsing string

C:/Dev/Couloir/3pLibs/aws_win/aws-sdk-cpp/cmake;C:\Dev\Couloir\3pLibs\aws_win\install//cmake

Invalid character escape '\D'.

VikingExplorer commented 7 months ago

The problem appeared to be the 3 aws packages:

PS C:\Dev\Couloir\3pLibs\vcpkg> ./vcpkg remove vcpkg-cmake-config:x64-windows --recurse The following packages will be removed: vcpkg-cmake-config:x64-windows Removing 1/1 vcpkg-cmake-config:x64-windows PS C:\Dev\Couloir\3pLibs\vcpkg> ./vcpkg update Using local portfile versions. To update the local portfiles, use git pull. The following packages differ from their port versions: aws-c-common:x64-windows-static-md 0.4.56 -> 0.9.14 aws-c-event-stream:x64-windows-static-md 0.1.6 -> 0.4.2 aws-checksums:x64-windows-static-md 0.1.9 -> 0.1.18

VikingExplorer commented 7 months ago

Lesson is that packages with Features can't be upgraded. Also, make sure to remove all related packages before attempting to install again.

Won't work: PS C:\Dev\Couloir\3pLibs\vcpkg> ./vcpkg upgrade aws-sdk-cpp[apigateway,apigatewayv2,appsync,autoscaling,autoscaling-plans,budgets,core,dynamodb,ec2,email,glacier,iam,imagebuilder,lambda,lex,lex-models,location,logs,managedblockchain,pricing,rds,rds-data,s3,secretsmanager,sms,sns,sqs,translate,wellarchitected,xray]:x64-windows-static-md error: List of features is not allowed in this context

My updated procedure: UPDATE

  1. Open Windows Powershell
  2. cd C:\Dev\Couloir\3pLibs\vcpkg
  3. ./bootstrap-vcpkg.bat
  4. git pull
  5. ./vcpkg update (to see what is out of date)
  6. install or upgrade from PACKAGE LIST (or all at once: ./vcpkg upgrade --no-dry-run)

    FIRST TIME

  7. install 64 bit git (https://git-scm.com/download/win)
  8. Open Windows Powershell
  9. cd C:\Dev\Couloir\3pLibs
  10. git clone https://github.com/Microsoft/vcpkg