aws/aws-sdk-cpp

Compiling a static library with cmake reports an error, indicating missing aws-c-common and other related DLLs

xixi911 opened this issue · 10 comments

Describe the bug

I want to compile AWS using CMake into a static library, but I found that using the compiled static library results in an error indicating that aws-c-common.dll is missing.

Expected Behavior

Use the Static Library with no error

Current Behavior

微信图片_20240110100622 show lack of aws-c-common.dll

Reproduction Steps

cd C:/Users/Lenovo/Desktop/aws/aws-sdk-cpp/build
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=C:/Users/Lenovo/Desktop/aws/install
-DBUILD_ONLY="core;s3" -DFORCE_SHARED_CRT=OFF -DBUILD_SHARED_LIBS=OFF ..
cmake --build . --config Release
cmake --install . --config Release

Possible Solution

No response

Additional Information/Context

No response

AWS CPP SDK version used

1.11.225 (Built on windows 10)

Compiler and Version used

vs2017 sdk 10.0.22621.0

Operating System and version

Windows 10 Home

sorry,AWS CPP SDK version used is 1.11.238

Can you make sure you are using the latest and most up to date submodules with:

git submodule update --init --recursive

Can you make sure you are using the latest and most up to date submodules with:

git submodule update --init --recursive

Can you make sure you are using the latest and most up to date submodules with:

git submodule update --init --recursive

I executed the command you provided, but there is still a problem with dll dependencies. I checked the compilation log and found there are linking issues. The file below is the log file
log.txt

Looking at your log it seems to building and installing correclty, can you elaborate/include an example of how you are then using the SDK?

Use the Static Library with no error

how are you using the static library?

Looking at your log it seems to building and installing correclty, can you elaborate/include an example of how you are then using the SDK?

Use the Static Library with no error

how are you using the static library?

"I have a dynamic DLL library that depends on the aws-cpp-sdk-core.lib and aws-cpp-sdk-s3.lib libraries. I found that both the static and dynamic libraries compile without any issues, and my dynamic library also uses MT for linking. However, when my program uses the dynamic library, it shows that aws-c-common.dll is missing. So, I compiled the dynamic version of aws-c-common, copied it in, and then it worked, but this is not the result I wanted."
1

Looking at your log it seems to building and installing correclty, can you elaborate/include an example of how you are then using the SDK?

Use the Static Library with no error

how are you using the static library?
Not only the common dynamic library, but also the following dynamic libraries:
aws-checksums.dll
aws-c-event-stream.dll
aws-crt-cpp.dll

I have a dynamic DLL library that depends on the aws-cpp-sdk-core.lib and aws-cpp-sdk-s3.lib libraries

How though in specific. i'm looking to see how you include them in your build. Please include the cmake files and commands you are using to create the dll and exe that uses your dll. also i will need examples of the full path that creates this issue. Im going to need reproducible samples to help you. so far i can see the dependency graph

(your exe) -- dynamic linked --> (your dll) -- static linked --> (aws sdk)

is that correct?

I have a dynamic DLL library that depends on the aws-cpp-sdk-core.lib and aws-cpp-sdk-s3.lib libraries

How though in specific. i'm looking to see how you include them in your build. Please include the cmake files and commands you are using to create the dll and exe that uses your dll. also i will need examples of the full path that creates this issue. Im going to need reproducible samples to help you. so far i can see the dependency graph

(your exe) -- dynamic linked --> (your dll) -- static linked --> (aws sdk)

is that correct?

The process is as you described,but we've already addressed this issue by changing
(your exe) -- dynamic linked --> (your dll) -- static linked --> (core.lib s3.lib)
to
(your exe) -- dynamic linked --> (your dll) -- static linked --> (core.lib s3.lib common.lib checksums.lib ........)
However, I'm still a bit puzzled why it's showing a DLL error. If it's missing a static library, shouldn't it display a linking error?