-
Notifications
You must be signed in to change notification settings - Fork 1.1k
AWS::InitAPI fails on windows #1692
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
Comments
I would really appreciate any suggestions as to how to determine the cause. Compiler info: |
|
It seems to me like you got a linking issue, which can be due to a lot of things so... |
My ultimate goal is to use the encryption sdk specifically. I followed the instructions that are in the readme of the git repo (these are the same steps that are in the aws docs). This repo: https://github.com/aws/aws-encryption-sdk-c/ . I had to make one change: when cloning the repo I had to add the recurse subprojects otherwise it was missing things and the cmake didn't work. I took the defaults and built 64 bit release libraries. I created a new directory, grabbed the example string.cpp that is included with the encryption sdk, and using cmake with find exports to build it. When it didn't work (stuck in AWS:InitAPI, I made the simpler version to just isolate that and I get the same behavior. Here is the cmakelists that is building both: cmake_minimum_required (VERSION 3.8) project ("awsencrypt1") find_package(aws-encryption-sdk-cpp) add_compile_definitions(USE_IMPORT_EXPORT) add_executable (awsencrypt1 "string.cpp") add_executable (awstest1 "awsencrypt1.cpp") |
For arguments to cmake, I'm specifying the following: The prefix path has the bin, lib and include folders with the header files, cmake packages, etc. It wants the BUILD_SHARED_LIBS property otherwise the cmake exports won't find everything. |
Ok.. so the building seems fine to me, now I'm curious if it's a weird linking interaction between this sdk and the encryption-sdk (maybe some overwriting happening idk). cmake_minimum_required (VERSION 3.8)
project ("awsencrypt1" LANGUAGE CXX)
find_package(AWSSDK REQUIRED COMPONENTS kms)
add_executable (awsencrypt1 "string.cpp")
target_link_libraries(${PROJECT_NAME} ${AWSSDK_LINK_LIBRARIES})
target_compile_options(${PROJECT_NAME} PRIVATE "-Wall") Also, version 1.9 might have broken their sample, so you might also want to try using version 1.8 of this sdk when cloning, see if that works for you? |
I tried to build this with the cmakelists you specified. Cmake went OK 1> CMake generation started for configuration: 'x64-Debug'. But the build failed; it could not find the header: [1/2] Building CXX object CMakeFiles\awstest1.dir\awsencrypt1.cpp.obj |
I know I can manually specify the header location, but its supposed to get that automatically from the package, correct? |
Ok I think I know what is going on, couple of things I'd like you to try:
|
I tried doing item number 1 first, The cmake worked, same as before. The build still failed. Same error. [1/2] Building CXX object CMakeFiles\awstest1.dir\awsencrypt1.cpp.obj |
For option #2 -- If I remove these options then find_package will fail. I could physically move the sdk files to that path under program files but .. I'm not sure how cmake is going to know to translate AWSSDK into that path ... |
That is weird, I am not seeing that but it might be a problem of me already having stuff installed/defined on my computer... hopeful thinking on my part here but did you clear up your cmake cache before adding the argument? Do you mean you tried 2. and failed or are you asking how cmake understands AWSSDK as a path? Because if it's the second, AWSSDK is a variable defined when building the SDK. It should be able to find it on default cmake...
and then you should be able to link your app, granted windows makes things more complicated by requiring you to have the dlls with the executable, but yea the building should be simple enough. I'm still kind of lost on what's going on on your side.... |
OK, so decided to try one of the earlier suggestions which was to use the 1.8 version. Instead of cloning the repo and doing a full build I decided to install it via vcpkg instead. This seemed to have better results. Using CMakeLists like this: cmake_minimum_required (VERSION 3.8) project (awsencrypt2 LANGUAGES CXX) I was able to build the program and now Aws::InitAPI runs correctly. The only option I had to pass into cmake was the toolchain file for vcpkg: C:/projects/vcpkg/scripts/buildsystems/vcpkg.cmake Unfortunately this doesn't exactly tell us what went wrong with the newer version. Vcpkg doesn't have the 1.9 yet, newest is 1.8. If I am able to, I'll try to start over and rebuild the 1.9 again with debug enabled and see if I can track it down. But first I have to get the encryption sdk working, since this is what I really need. I'm going to create a post over there in the github issue list for the encryption sdk, because I now cannot get that to build using the vcpkg 1.8 version -- it complains that AwsSharedLibSetup include cannot be found even though its there. Sigh. |
yea I haven't had the time to update the vcpkg for 1.9 (mainly because 1.9 has been problematic to say the least), but yea I am hoping to get that done once all these weird issues stop happening. Thanks for trying to figure it out with me though, I'll keep looking for a way to reproduce this. |
Assuming that I want to build 1.8 version, how would I go about doing that? The github repo has submodules and I am unsure exactly how this works. If I clone the repo at the 1.8 release, and specify recurse-submodules, will it automatically get the submodules at their "equivalent" release? |
1.8 does not use submodules so there's no need for the recurse-submodules, it will automatically clone and build the dependencies as part of the cmake command. |
Greetings! It looks like this issue hasn’t been active in longer than a week. We encourage you to check if this is still an issue in the latest release. Because it has been longer than a week since the last update on this, and in the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or add an upvote to prevent automatic closure, or if the issue is already closed, please feel free to open a new one. |
Had similar issue trying to create sample project with Visual Studio on Windows from scratch with vcpkg AWS SDK. Didn't use Fixed by using debug files for debug configuration! |
I'm trying to learn to use the AWS C++ SDK, windows platform, building with CMAKE. I have simplified this down to the basic skeleton defined here: https://docs.aws.amazon.com/sdk-for-cpp/v1/developer-guide/basic-use.html
The program source:
`#include <aws/core/Aws.h>
int main()
{
Aws::SDKOptions options;
options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Trace;
Aws::InitAPI(options);
{
printf("Hello CMake.\n");
}
Aws::ShutdownAPI(options);
return 0;
}`
The result is the same even if the options configuration is commented out. When running the executable, there is no output written to std out or std error, The log file is created but is completely empty (zero bytes). The return code from the program is
-1073741819 as obtained from %errorlevel% variable. If the program is run repeatedly, it will (infrequently) produce the following error stack trace to the console:
Fatal error condition occurred in C:\Temp\build\aws-sdk-cpp\crt\aws-crt-cpp\crt\aws-c-io\source\event_loop.c:74: aws_thread_launch(&cleanup_thread, s_event_loop_destroy_async_thread_fn, el_group, &thread_options) == AWS_OP_SUCCESS
Exiting Application
at 0x7FFC390A2530: aws_backtrace_print
at 0x7FFC39093330: aws_fatal_assert
at 0x7FFC37575F10: aws_event_loop_wait_for_stop_completion
at 0x7FFC3909F630: aws_ref_count_release
at 0x7FFC37573D80: aws_server_bootstrap_set_alpn_callback
at 0x7FFC3909F630: aws_ref_count_release
at 0x7FFC37573760: aws_client_bootstrap_release
at 0x7FFC390F73E0: Aws::Crt::Io::ClientBootstrap::~ClientBootstrap
at 0x7FFC115AD5D0: Aws::Utils::Stream::SimpleStreamBuf::xsputn
at 0x7FFC57614180: execute_onexit_table
at 0x7FFC57614180: execute_onexit_table
at 0x7FFC57614180: execute_onexit_table
at 0x7FFC115AD5D0: Aws::Utils::Stream::SimpleStreamBuf::xsputn
at 0x7FFC115AD5D0: Aws::Utils::Stream::SimpleStreamBuf::xsputn
at 0x7FFC596A9900: RtlActivateActivationContextUnsafeFast
at 0x7FFC596EDA50: LdrShutdownProcess
at 0x7FFC596ED980: RtlExitUserProcess
at 0x7FFC57CBE0A0: FatalExit
at 0x7FFC04D439F0: wassert
at 0x7FFC04D439F0: wassert
at 0x7FFC04D440F0: Exit
at 0x7FFC04D3D850: abort
at 0x7FFC04D3C850: terminate
at 0x7FF7DA3C7370: __scrt_unhandled_exception_filter(d:\agent_work\4\s\src\vctools\crt\vcstartup\src\utility\utility_desktop.cpp:96)
at 0x7FFC5723B6A0: UnhandledExceptionFilter
at 0x7FFC59733EC0: memset
at 0x7FFC5971C6E0: _C_specific_handler
at 0x7FFC59732060: _chkstk
at 0x7FFC596E1020: RtlRaiseException
at 0x7FFC596E1020: RtlRaiseException
at 0x7FFC57164B20: RaiseException
at 0x7FFC38E063F0: CxxThrowException
at 0x7FFC119DAC30: std::_Xbad_function_call
at 0x7FFC11590370: Aws::Monitoring::InitMonitoring
at 0x7FFC1151CFC0: Aws::InitAPI
at 0x7FF7DA3C1B40: main(C:\projects\awsencrypt1\awsencrypt1.cpp:12)
at 0x7FF7DA3C5150: invoke_main(d:\agent_work\4\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:79)
at 0x7FF7DA3C4F00: __scrt_common_main_seh(d:\agent_work\4\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
at 0x7FF7DA3C4EE0: __scrt_common_main(d:\agent_work\4\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:331)
at 0x7FF7DA3C5210: mainCRTStartup(d:\agent_work\4\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp:17)
at 0x7FFC57CB7020: BaseThreadInitThunk
at 0x7FFC596E2630: RtlUserThreadStart
The text was updated successfully, but these errors were encountered: