Describe the issue
Basically I do not want to use .dll files, only the .lib files.
I am attempting to build the sdk statically by using the flags -DBUILD_SHARED_LIBS=OFF, -DFORCE_SHARED_CRT=OFF, and, if it is relevant, -DBUILD_ONLY="cognito-idp".
This however results in a lot of errors. After doing a fail amount of digging online, seems these errors occur when trying to build statically something meant to use built as a dll.
So, is it possible to use the library purely statically, or is using the .dll files necessary.
Steps to Reproduce
Build the sdk with the flags -DBUILD_SHARED_LIBS=OFF, -DFORCE_SHARED_CRT=OFF, and, if it is relevant, -DBUILD_ONLY="cognito-idp".
Current behavior
The project is built using the following command:
cmake "C:\AWS\aws-sdk-cpp" -G "Visual Studio 17" -A x64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="C:/AWS/Install" -DBUILD_SHARED_LIBS=OFF -DFORCE_SHARED_CRT=OFF -DBUILD_ONLY="cognito-idp"
This is successful.
Then I execute the following command:
"C:\Program Files\Microsoft Visual Studio\2022\Professional\Msbuild\Current\Bin\MSBuild.exe" ALL_BUILD.vcxproj /p:Configuration=Release
I receive the following errors and warnings:
"C:\AWS\build\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj" (default target) (16) ->
(Link target) ->
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library [C:\AWS\build
\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4286: symbol '__acrt_iob_func' defined in 'libucrt.lib(_file.obj)' is imported by 'aws-c-common.lib
(system_info.obj)' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4286: symbol '__acrt_iob_func' defined in 'libucrt.lib(_file.obj)' is imported by 'aws-c-common.lib
(log_writer.obj)' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4217: symbol '__acrt_iob_func' defined in 'libucrt.lib(_file.obj)' is imported by 'aws-c-common.lib
(assert.obj)' in function 'aws_fatal_assert' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4286: symbol '__acrt_iob_func' defined in 'libucrt.lib(_file.obj)' is imported by 'aws-c-common.lib
(error.obj)' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4286: symbol '__acrt_iob_func' defined in 'libucrt.lib(_file.obj)' is imported by 'aws-c-common.lib
(logging.obj)' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4286: symbol '__acrt_iob_func' defined in 'libucrt.lib(_file.obj)' is imported by 'aws-c-common.lib
(common.obj)' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4286: symbol '__stdio_common_vfprintf' defined in 'libucrt.lib(output.obj)' is imported by 'aws-c-c
ommon.lib(system_info.obj)' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4217: symbol '__stdio_common_vfprintf' defined in 'libucrt.lib(output.obj)' is imported by 'aws-c-c
ommon.lib(assert.obj)' in function 'fprintf' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4286: symbol '__stdio_common_vfprintf' defined in 'libucrt.lib(output.obj)' is imported by 'aws-c-c
ommon.lib(error.obj)' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4286: symbol '__stdio_common_vfprintf' defined in 'libucrt.lib(output.obj)' is imported by 'aws-c-c
ommon.lib(logging.obj)' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4286: symbol '__stdio_common_vfprintf' defined in 'libucrt.lib(output.obj)' is imported by 'aws-c-c
ommon.lib(common.obj)' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4217: symbol 'abort' defined in 'libucrt.lib(abort.obj)' is imported by 'aws-c-common.lib(assert.ob
j)' in function 'aws_fatal_assert' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4286: symbol 'abort' defined in 'libucrt.lib(abort.obj)' is imported by 'aws-c-common.lib(logging.o
bj)' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4286: symbol 'abort' defined in 'libucrt.lib(abort.obj)' is imported by 'aws-c-common.lib(priority_
queue.obj)' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4286: symbol 'abort' defined in 'libucrt.lib(abort.obj)' is imported by 'aws-c-common.lib(device_ra
ndom.c.obj)' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4217: symbol 'fclose' defined in 'libucrt.lib(fclose.obj)' is imported by 'aws-c-common.lib(logging
.obj)' in function 's_noalloc_stderr_logger_clean_up' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxpr
oj]
LINK : warning LNK4286: symbol 'fclose' defined in 'libucrt.lib(fclose.obj)' is imported by 'aws-c-common.lib(log_wri
ter.obj)' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4217: symbol 'fwrite' defined in 'libucrt.lib(fwrite.obj)' is imported by 'aws-c-common.lib(logging
.obj)' in function 's_noalloc_stderr_logger_log' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4286: symbol 'fwrite' defined in 'libucrt.lib(fwrite.obj)' is imported by 'aws-c-common.lib(log_wri
ter.obj)' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4217: symbol '__stdio_common_vsprintf' defined in 'libucrt.lib(output.obj)' is imported by 'aws-c-c
ommon.lib(logging.obj)' in function 'snprintf' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4286: symbol '__stdio_common_vsprintf' defined in 'libucrt.lib(output.obj)' is imported by 'aws-c-c
ommon.lib(system_info.obj)' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4286: symbol '__stdio_common_vsprintf' defined in 'libucrt.lib(output.obj)' is imported by 'aws-c-c
ommon.lib(uuid.obj)' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4217: symbol '__stdio_common_vsprintf' defined in 'libucrt.lib(output.obj)' is imported by 'aws-c-c
ommon.lib(log_formatter.obj)' in function 'aws_format_standard_log_line' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-s
dk-core-tests.vcxproj]
LINK : warning LNK4217: symbol '_errno' defined in 'libucrt.lib(errno.obj)' is imported by 'aws-c-common.lib(logging.
obj)' in function 's_noalloc_stderr_logger_log' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4286: symbol '_errno' defined in 'libucrt.lib(errno.obj)' is imported by 'aws-c-common.lib(file.obj
)' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4286: symbol '_errno' defined in 'libucrt.lib(errno.obj)' is imported by 'aws-c-common.lib(log_writ
er.obj)' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4217: symbol 'strtol' defined in 'libucrt.lib(strtox.obj)' is imported by 'aws-c-common.lib(date_ti
me.obj)' in function 'aws_date_time_init_from_str_cursor' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.v
cxproj]
LINK : warning LNK4217: symbol '_mktime64' defined in 'libucrt.lib(mktime.obj)' is imported by 'aws-c-common.lib(date
_time.obj)' in function 'aws_date_time_init_from_str_cursor' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-test
s.vcxproj]
LINK : warning LNK4217: symbol 'strftime' defined in 'libucrt.lib(strftime.obj)' is imported by 'aws-c-common.lib(dat
e_time.obj)' in function 'aws_date_time_to_local_time_short_str' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-
tests.vcxproj]
LINK : warning LNK4217: symbol 'tolower' defined in 'libucrt.lib(tolower_toupper.obj)' is imported by 'aws-c-common.l
ib(date_time.obj)' in function 's_check_init_str_to_int' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vc
xproj]
LINK : warning LNK4217: symbol 'atoi' defined in 'libucrt.lib(atox.obj)' is imported by 'aws-c-common.lib(cpuid.c.obj
)' in function 'aws_common_private_has_avx2' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4217: symbol 'getenv' defined in 'libucrt.lib(getenv.obj)' is imported by 'aws-c-common.lib(cpuid.c
.obj)' in function 'aws_common_private_has_avx2' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4286: symbol 'getenv' defined in 'libucrt.lib(getenv.obj)' is imported by 'aws-c-common.lib(environ
ment.obj)' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4217: symbol '_putenv_s' defined in 'libucrt.lib(putenv.obj)' is imported by 'aws-c-common.lib(envi
ronment.obj)' in function 'aws_set_environment_value' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxpr
oj]
LINK : warning LNK4217: symbol 'fflush' defined in 'libucrt.lib(fflush.obj)' is imported by 'aws-c-common.lib(system_
info.obj)' in function 'aws_backtrace_print' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4217: symbol '_wfopen_s' defined in 'libucrt.lib(fopen.obj)' is imported by 'aws-c-common.lib(file.
obj)' in function 'aws_fopen' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4217: symbol '__stdio_common_vsscanf' defined in 'libucrt.lib(input.obj)' is imported by 'aws-c-com
mon.lib(uuid.obj)' in function 'sscanf' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4217: symbol '__stdio_common_vsnprintf_s' defined in 'libucrt.lib(output.obj)' is imported by 'aws-
c-common.lib(log_formatter.obj)' in function 'aws_format_standard_log_line' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cp
p-sdk-core-tests.vcxproj]
LINK : warning LNK4217: symbol '_gmtime64_s' defined in 'libucrt.lib(gmtime.obj)' is imported by 'aws-c-common.lib(ti
me.obj)' in function 'aws_gmtime' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4217: symbol '_localtime64_s' defined in 'libucrt.lib(localtime.obj)' is imported by 'aws-c-common.
lib(time.obj)' in function 'aws_localtime' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
LINK : warning LNK4217: symbol '_mkgmtime64' defined in 'libucrt.lib(mktime.obj)' is imported by 'aws-c-common.lib(ti
me.obj)' in function 'aws_timegm' [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
"C:\AWS\build\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj" (default target) (16) ->
(Link target) ->
aws-c-common.lib(allocator.obj) : error LNK2019: unresolved external symbol __imp__aligned_free referenced in functio
n s_default_free [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
aws-c-common.lib(allocator.obj) : error LNK2019: unresolved external symbol __imp__aligned_malloc referenced in funct
ion s_default_malloc [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
aws-c-common.lib(allocator.obj) : error LNK2019: unresolved external symbol __imp__aligned_realloc referenced in func
tion s_default_realloc [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
aws-c-common.lib(date_time.obj) : error LNK2019: unresolved external symbol __imp_modf referenced in function aws_dat
e_time_init_epoch_secs [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
aws-c-common.lib(date_time.obj) : error LNK2019: unresolved external symbol __imp_round referenced in function aws_da
te_time_init_epoch_secs [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
aws-c-common.lib(process.obj) : error LNK2019: unresolved external symbol __imp__getpid referenced in function aws_ge
t_pid [C:\AWS\build\aws-cpp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
C:\AWS\build\bin\Release\aws-cpp-sdk-core-tests.exe : fatal error LNK1120: 6 unresolved externals [C:\AWS\build\aws-c
pp-sdk-core-tests\aws-cpp-sdk-core-tests.vcxproj]
AWS CPP SDK version used
latest (main branch)
compiler and version used
Visual Studio 2022 and msbuild
Operating System and version
Windows 11 x64 (Same issue with 10 x64)
Describe the issue
Basically I do not want to use .dll files, only the .lib files.
I am attempting to build the sdk statically by using the flags -DBUILD_SHARED_LIBS=OFF, -DFORCE_SHARED_CRT=OFF, and, if it is relevant, -DBUILD_ONLY="cognito-idp".
This however results in a lot of errors. After doing a fail amount of digging online, seems these errors occur when trying to build statically something meant to use built as a dll.
So, is it possible to use the library purely statically, or is using the .dll files necessary.
Steps to Reproduce
Build the sdk with the flags -DBUILD_SHARED_LIBS=OFF, -DFORCE_SHARED_CRT=OFF, and, if it is relevant, -DBUILD_ONLY="cognito-idp".
Current behavior
The project is built using the following command:
This is successful.
Then I execute the following command:
I receive the following errors and warnings:
AWS CPP SDK version used
latest (main branch)
compiler and version used
Visual Studio 2022 and msbuild
Operating System and version
Windows 11 x64 (Same issue with 10 x64)