aws / aws-iot-device-sdk-cpp-v2

Next generation AWS IoT Client SDK for C++ using the AWS Common Runtime
Apache License 2.0
185 stars 110 forks source link

Can't cmake configure the project v1.4.3 (or older) with Visual Studio 2017/2019 #86

Closed EeroKurimo closed 4 years ago

EeroKurimo commented 4 years ago

I cannot run cmake configure as instructed in README.md for aws-iot-device-sdk-cpp-v2 with the tag v1.4.3 (or older) using Visual Studio 2019 and Cmake 3.15.2 with the command cmake -DCMAKE_INSTALL_PREFIX="c:/data/aws-iot-device-sdk-cpp-v2-install" -DBUILD_DEPS=ON c:/data/aws-iot-device-sdk-cpp-v2, because the cmake configure step fails while building aws-crt-cpp with a number of errors like:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.24.28218\include\vector(1262,1): 
warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc 
[C:\Data\aws-iot-device-sdk-cpp-v2-build\deps\build\src\AwsCrtCpp-build\aws-crt-cpp.vcxproj] 
[C:\Data\aws-iot-device-sdk-cpp-v2-build\deps\AwsCrtCpp.vcxproj]

However, if manually clone and cmake configure aws-crt-cpp independently, it works fine!

Comparing the build directories of the manually configured aws-crt-cpp and the failing aws-crt-cpp automatically configured by the sdk v2 depencency chain, in their CMakeCache.txt files I can see that the manually configured aws-crt-cpp has the env variable CMAKE_CXX_FLAGS:STRING=/DWIN32 /D_WINDOWS /W3 /GR /EHsc, but in the dependency chain configured CMakeCache.txt the variable instead is an empty string CMAKE_CXX_FLAGS:STRING=.

Unless I'm doing something horribly wrong, I suspect the problem is that aws-iot-device-sdk-cpp-v2/CMakeLists.txt on line 71 (just before mixing tabs and spaces for indentation!) uses execute_process() to run cmake configure for aws-crt-cpp with the option -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}, which sets the value of CMAKE_CXX_FLAGS of aws-crt-cpp to be an empty string instead undefined, and apparently if it's undefined it eventually gets replaced with the cmake default values.

Removing the option -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} from the aws-iot-device-sdk-cpp-v2/CMakeLists.txt fixes the cmake configure step errors, at least for me.

As for a good solution, I'm not sure what would be a good way pass cmake env variables but only when defined. One option might be the the new FetchContent() (https://cmake.org/cmake/help/latest/module/FetchContent.html) cmake command, which might be a good way to pass all env variables automatically instead of manually passing command line strings with execute_process().

P.S. I believe that when @kankri in https://github.com/awslabs/aws-c-mqtt/pull/116 mentioned that his build of sdk-cpp-v2 fails on windows, he referred to this issue, as he was also having this same build issue before the christmas holidays.

JonathanHenson commented 4 years ago

Okay, so I've been wanting to ditch EXTERNAL_PROJECT_ADD for a while and this finally convinced me to actually do it.

So the idea is,

each aws-c- lib will be able to build in source (this takes work and I'm doing it now), or via traditional find_package. then the aws-crt-cpp package will use git submodules to each aws-c- lib it needs with the new flag IN_SOURCE_BUILD=ON

the crt will just use add_subdirectory.

We'll do the same thing for the iot sdk at that point as well. This way the cmake build problems with caching, needing a network during build, and the numerous flag passing bugs just go away.

This does mean however, users migrating from the current version to the next version will need to remember to do git clone --recursive to build. I think this is a fair tradeoff though.

Thoughts on this approach?

EeroKurimo commented 4 years ago

Personally I might still try out the FetchContent-function introduced in cmake 3.11, as it had some nifty features like overriding a submodule with a different copy directory using the FETCHCONTENT_SOURCE_DIR_<name> variable.

However, I don't see any major problems with the git submodule approach, which sounds like a working solution for the current cmake recursion woes. That would also allow you to run the cmake configuration step without Internet, which might even be preferable to some organizations over FetchContent, as you could also fully separate the checkout step from the build step.

JonathanHenson commented 4 years ago

As far as being friendly to org build systems... we accommodate amazon, for example, by loading up CMAKE_PREFIX_PATH to the package manager and turning off BUILD_DEPS. The c libs are built as separate packages. This allows the java, python, c# etc... crts to all use the same artifacts.

We’re guessing that other companies either have something similar to either Amazon (distributed package management) or google (Bazel). By allowing either in-source or package managed scenarios, I think? we’re covered. If we miss something we’ll have to deal with it as it arises. But yeah our build system (Amazons) doesn’t allow network calls during build step.

My concern with FETCH_CONTENT is the same reason we’re not just using modern c++ under the hood for the c libraries... we’ve found, painfully over the years, that “live at HEAD” is just not a viable strategy for customers whose environments we don’t control, and have different needs etc.... so we baseline on something that’s guaranteed to be present in all current LTS unix distros. For now, that’s CMake 3.0 and GCC 4.4 or later.

For c++, we’re keeping C++11 And GCC 4.9.x for the same reason.

JonathanHenson commented 4 years ago

https://github.com/awslabs/aws-crt-cpp/pull/91

EeroKurimo commented 4 years ago

Unfortunately this still does not appear to compile for Visual Studio, though now for different reasons. When I do this with a fresh checkout of the current master de204d4:

git clone --recursive https://github.com/awslabs/aws-iot-device-sdk-cpp-v2.git
mkdir aws-iot-device-sdk-cpp-v2-build
mkdir aws-iot-device-sdk-cpp-v2-install
cd aws-iot-device-sdk-cpp-v2-build
cmake -G "Visual Studio 15 2017" -DCMAKE_INSTALL_PREFIX="C:/Data/aws-iot-device-sdk-cpp-v2-install"  -DBUILD_DEPS=ON ../aws-iot-device-sdk-cpp-v2
cmake --build . --target install --verbose

I get this error during cmake --build . --target install --verbose:

C:\Data\aws-iot-device-sdk-cpp-v2-build>cmake --build . --target install --verbose 
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 13.1.2020 11:28:48.
Project "C:\Data\aws-iot-device-sdk-cpp-v2-build\install.vcxproj" on node 1 (default targets).
Project "C:\Data\aws-iot-device-sdk-cpp-v2-build\install.vcxproj" (1) is building "C:\Data\aws-iot-device-sdk-cpp-v2-build\ZERO_CHECK.vcxproj" (2) on node 1 (default targets).
PrepareForBuild:
  Creating directory "Win32\Debug\ZERO_CHECK\".
  Creating directory "C:\Data\aws-iot-device-sdk-cpp-v2-build\Debug\".
  Creating directory "Win32\Debug\ZERO_CHECK\ZERO_CHECK.tlog\".
InitializeBuildStatus:
  Creating "Win32\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
CustomBuild:
  Checking Build System
FinalizeBuildStatus:
  Deleting file "Win32\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild".
  Touching "Win32\Debug\ZERO_CHECK\ZERO_CHECK.tlog\ZERO_CHECK.lastbuildstate".
Done Building Project "C:\Data\aws-iot-device-sdk-cpp-v2-build\ZERO_CHECK.vcxproj" (default targets).
Project "C:\Data\aws-iot-device-sdk-cpp-v2-build\install.vcxproj" (1) is building "C:\Data\aws-iot-device-sdk-cpp-v2-build\ALL_BUILD.vcxproj" (3) on node 1 (default targets).
Project "C:\Data\aws-iot-device-sdk-cpp-v2-build\ALL_BUILD.vcxproj" (3) is building "C:\Data\aws-iot-device-sdk-cpp-v2-build\discovery\Discovery-cpp.vcxproj" (4) on node 1 (default targets).
Project "C:\Data\aws-iot-device-sdk-cpp-v2-build\discovery\Discovery-cpp.vcxproj" (4) is building "C:\Data\aws-iot-device-sdk-cpp-v2-build\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-auth\aws-c-auth.vcxproj" (5) on node 1 (default targets).
Project "C:\Data\aws-iot-device-sdk-cpp-v2-build\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-auth\aws-c-auth.vcxproj" (5) is building "C:\Data\aws-iot-device-sdk-cpp-v2-build\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-cal\aws-c-cal.vcxproj" (6) on node 1 (default targets).
Project "C:\Data\aws-iot-device-sdk-cpp-v2-build\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-cal\aws-c-cal.vcxproj" (6) is building "C:\Data\aws-iot-device-sdk-cpp-v2-build\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\aws-c-common.vcxproj" (7) on node 1 (default targets).
PrepareForBuild:
  Creating directory "aws-c-common.dir\Debug\".
  Creating directory "C:\Data\aws-iot-device-sdk-cpp-v2-build\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\Debug\".
  Creating directory "aws-c-common.dir\Debug\aws-c-common.tlog\".
InitializeBuildStatus:
  Creating "aws-c-common.dir\Debug\aws-c-common.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
CustomBuild:
  Building Custom Rule C:/Data/aws-iot-device-sdk-cpp-v2/aws-common-runtime/aws-crt-cpp/aws-common-runtime/aws-c-common/CMakeLists.txt
MakeDirsForCl:
  Creating directory "C:\Data\aws-iot-device-sdk-cpp-v2-build\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\aws-c-common.dir\Debug\source".
  Creating directory "C:\Data\aws-iot-device-sdk-cpp-v2-build\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\aws-c-common.dir\Debug\source\windows".
ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\CL.exe /c /I"C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\include" /I"C:\Data\aws-iot-device-sdk-cpp-v2-build\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\generated\include" /Zi /nologo /W4 /WX /diagnostics:classic /MP /O2 /Ob1 /Oy- /D WIN32 /D _WINDOWS /D NDEBUG /D WINDOWS_KERNEL_LIB=Kernel32 /D HAVE_AVX2_INTRINSICS /D HAVE_MSVC_CPUIDEX /D USE_SIMD_ENCODING /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MD /GS /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"aws-c-common.dir\Debug\\" /Fd"aws-c-common.dir\Debug\aws-c-common.pdb" /Gd /TC /analyze- /errorReport:queue  /volatile:iso "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\allocator.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\array_list.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\assert.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\byte_buf.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\codegen.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\command_line_parser.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\common.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\date_time.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\encoding.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\error.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\hash_table.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\log_channel.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\log_formatter.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\log_writer.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\logging.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\lru_cache.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\math.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\memtrace.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\priority_queue.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\ring_buffer.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\string.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\task_scheduler.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\uuid.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\windows\clock.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\windows\environment.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\windows\mutex.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\windows\process.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\windows\rw_lock.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\windows\system_info.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\windows\thread.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\windows\time.c" "C:\Data\aws-iot-device-sdk-cpp-v2\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\source\arch\cpuid.c"
cl : Command line error D8016: '/O2' and '/RTC1' command-line options are incompatible [C:\Data\aws-iot-device-sdk-cpp-v2-build\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\aws-c-common.vcxproj]
Done Building Project "C:\Data\aws-iot-device-sdk-cpp-v2-build\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\aws-c-common.vcxproj" (default targets) -- FAILED.
Done Building Project "C:\Data\aws-iot-device-sdk-cpp-v2-build\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-cal\aws-c-cal.vcxproj" (default targets) -- FAILED.
Done Building Project "C:\Data\aws-iot-device-sdk-cpp-v2-build\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-auth\aws-c-auth.vcxproj" (default targets) -- FAILED.
Done Building Project "C:\Data\aws-iot-device-sdk-cpp-v2-build\discovery\Discovery-cpp.vcxproj" (default targets) -- FAILED.
Done Building Project "C:\Data\aws-iot-device-sdk-cpp-v2-build\ALL_BUILD.vcxproj" (default targets) -- FAILED.
Done Building Project "C:\Data\aws-iot-device-sdk-cpp-v2-build\install.vcxproj" (default targets) -- FAILED.

Build FAILED.

"C:\Data\aws-iot-device-sdk-cpp-v2-build\install.vcxproj" (default target) (1) ->
"C:\Data\aws-iot-device-sdk-cpp-v2-build\ALL_BUILD.vcxproj" (default target) (3) ->
"C:\Data\aws-iot-device-sdk-cpp-v2-build\discovery\Discovery-cpp.vcxproj" (default target) (4) ->
"C:\Data\aws-iot-device-sdk-cpp-v2-build\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-auth\aws-c-auth.vcxproj" (default target) (5) ->
"C:\Data\aws-iot-device-sdk-cpp-v2-build\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-cal\aws-c-cal.vcxproj" (default target) (6) ->
"C:\Data\aws-iot-device-sdk-cpp-v2-build\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\aws-c-common.vcxproj" (default target) (7) ->
(ClCompile target) -> 
  cl : Command line error D8016: '/O2' and '/RTC1' command-line options are incompatible [C:\Data\aws-iot-device-sdk-cpp-v2-build\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\aws-c-common.vcxproj]

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:01.70
JonathanHenson commented 4 years ago

I'm having a hard time replicating this: https://github.com/aws/aws-iot-device-sdk-cpp-v2/blob/master/codebuild/common-windows.bat#L13

we run this on every push and it passes fine for us. Could you check this and see if it works for you?

EeroKurimo commented 4 years ago

The error unfortunately still reproduces with this set of batch commands:

set TEMP=C:\Data\temp
set CODEBUILD_SRC_DIR=%TEMP%\aws-iot-device-sdk-cpp-v2
git clone https://github.com/aws/aws-iot-device-sdk-cpp-v2.git %CODEBUILD_SRC_DIR%
cd %CODEBUILD_SRC_DIR%
call codebuild\common-windows.bat

Here's the specific error, but I've also attached the full error output here.

C:\Data\temp\builds\aws-iot-device-sdk-cpp-v2-build>cmake --build .   || goto error 
Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(467,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Data\temp\builds\aws-iot-device-sdk-cpp-v2-build\ZERO_CHECK.vcxproj]
  Checking Build System
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(467,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Data\temp\builds\aws-iot-device-sdk-cpp-v2-build\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\aws-c-common.vcxproj]
  Building Custom Rule C:/Data/temp/aws-iot-device-sdk-cpp-v2/aws-common-runtime/aws-crt-cpp/aws-common-runtime/aws-c-common/CMakeLists.txt
cl : command line error D8016: '/O2' and '/RTC1' command-line options are incompatible [C:\Data\temp\builds\aws-iot-device-sdk-cpp-v2-build\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\aws-c-common.vcxproj]
massi-ang commented 4 years ago

I am getting the same error when trying to compile using Visual Studio Community 2019 build engine version 16.3.1 cl.exe version 19.23.28106.4 cmake 3.16.3

massi-ang commented 4 years ago

I manage to go past the compile flags errors by using cmake --build . --target install --verbose --config RELEASE

but now getting a new error:

"C:\Users\Massimiliano\projects\aws-iot-device-sdk-cpp-v2-build\install.vcxproj" (default target) (1) ->
"C:\Users\Massimiliano\projects\aws-iot-device-sdk-cpp-v2-build\ALL_BUILD.vcxproj" (default target) (3) ->                                                  
"C:\Users\Massimiliano\projects\aws-iot-device-sdk-cpp-v2-build\aws-common-runtime\aws-crt-cpp\tests\aws-iot-device-sdk-cpp-v2-tests.vcxproj" (default targ et) (15) ->

(ClCompile target) ->                                                                                                                                         
cl : command line error D8036: '/Foaws-iot-device-sdk-cpp-v2-tests.dir\Release\/test_runner.cpp.obj' not allowed with multiple source files [C:\Users\Mas similiano\projects\aws-iot-device-sdk-cpp-v2-build\aws-common-runtime\aws-crt-cpp\tests\aws-iot-device-sdk-cpp-v2-tests.vcxproj]                                                                                                                                                                                            
1 Warning(s)                                                                                                                                                
1 Error(s)                                                                                                                                                                                                                                                                                                          
Time Elapsed 00:01:14.09   
massi-ang commented 4 years ago

Fixed also this second issue. At line 368 in the file aws-iot-device-sdk-cpp-v2-build\aws-common-runtime\aws-crt-cpp\tests\aws-iot-device-sdk-cpp-v2-tests.vcxproj that was generated by cmake, I made the following change:

From:

 <ObjectFileName>$(IntDir)/test_runner.cpp.obj</ObjectFileName>

To:

 <ObjectFileName>$(IntDir)test_runner.cpp.obj</ObjectFileName>

The cause of this error seems to be related to a target or file specified multiple times as it is also reported in the Warning message below.

The project builds with a Waring for Release, Minsizerel and RelWithDebInfo configs but throws the error about incompatible compile flags for Debug config.

The warning is the following:

Done Building Project "C:\Users\Massimiliano\projects\aws-iot-device-sdk-cpp-v2-build\install.vcxproj" (default targets).    

Build succeeded.

"C:\Users\Massimiliano\projects\aws-iot-device-sdk-cpp-v2-build\install.vcxproj" (default target) (1) ->
"C:\Users\Massimiliano\projects\aws-iot-device-sdk-cpp-v2-build\ALL_BUILD.vcxproj" (default target) (3) ->
"C:\Users\Massimiliano\projects\aws-iot-device-sdk-cpp-v2-build\aws-common-runtime\aws-crt-cpp\tests\aws-iot-device-sdk-cpp-
v2-tests.vcxproj" (default target) (15) ->
(Link target) ->
  aws-iot-device-sdk-cpp-v2-tests.dir\RelWithDebInfo\\test_runner.cpp.obj : warning LNK4042: object specified more than once 
; extras ignored [C:\Users\Massimiliano\projects\aws-iot-device-sdk-cpp-v2-build\aws-common-runtime\aws-crt-cpp\tests\aws-io 
t-device-sdk-cpp-v2-tests.vcxproj]

    1 Warning(s)
    0 Error(s)

Time Elapsed 00:01:39.07
JonathanHenson commented 4 years ago

It shouldn’t be building Aws-crt-cpp tests at all. Which version are you building? Are the submodules updated?

massi-ang commented 4 years ago

I have done a fresh install yesterday using the instructions provided in the Readme

JonathanHenson commented 4 years ago

https://github.com/aws/aws-iot-device-sdk-cpp-v2/pull/89

could you try the branch here and let me know how it goes?

massi-ang commented 4 years ago

Build is successful and without warning using the latest commit when specifying a --config flag different than Debug Still getting the same compiler error about incompatible flags when building for Debug.

PS C:\Users\Massimiliano\projects\aws-iot-device-sdk-cpp-v2-build> cmake --build . --target install          
Microsoft (R) Build Engine version 16.3.1+1def00d3d for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

cl : command line error D8016: '/O2' and '/RTC1' command-line options are incompatible [C:\Users\Massimiliano\projects\aws-i
ot-device-sdk-cpp-v2-build\aws-common-runtime\aws-crt-cpp\aws-common-runtime\aws-c-common\aws-c-common.vcxproj]
PS C:\Users\Massimiliano\projects\aws-iot-device-sdk-cpp-v2-build>
JonathanHenson commented 4 years ago

okay, it looks like this is only an issue in C++. And the fix is stupid and ridiculuous, but it's just a matter of NOT setting CMAKE_BUILD_TYPE by default on windows.

JonathanHenson commented 4 years ago

okay, I've updated the branch, if you can give it a go and it works, I'll merge it over

massi-ang commented 4 years ago

Tested the new branch and worked like a charm.

JonathanHenson commented 4 years ago

closing, feel free to reopen if you have any further issues.

EeroKurimo commented 4 years ago

Works for me too, thanks for the fix!