You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to compile the library, using CMake and MSVC, but I am getting a linker error:
example/mqttclient/mqttclient.exe
cmd.exe /C "cd . && "C:\Program Files\JetBrains\CLion 2021.3.3\bin\cmake\win\x64\bin\cmake.exe" -E vs_link_exe --intdir=example\mqttclient\CMakeFiles\mqttclient.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100203~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100203~1.0\x64\mt.exe --manifests -- C:\PROGRA~1\LLVM\bin\lld-link.exe /nologo @CMakeFiles\mqttclient.rsp /out:example\mqttclient\mqttclient.exe /implib:example\mqttclient\mqttclient.lib /pdb:example\mqttclient\mqttclient.pdb /version:0.0 /machine:X86 /debug /INCREMENTAL /subsystem:console && cd ."
LINK Pass 1: command "C:\PROGRA~1\LLVM\bin\lld-link.exe /nologo @CMakeFiles\mqttclient.rsp /out:example\mqttclient\mqttclient.exe /implib:example\mqttclient\mqttclient.lib /pdb:example\mqttclient\mqttclient.pdb /version:0.0 /machine:X86 /debug /INCREMENTAL /subsystem:console /MANIFEST /MANIFESTFILE:example\mqttclient\CMakeFiles\mqttclient.dir/intermediate.manifest example\mqttclient\CMakeFiles\mqttclient.dir/manifest.res" failed (exit code 1) with the following output:
lld-link: warning: aws-c-common.lib(allocator.c.obj): locally defined symbol imported: ___acrt_iob_func (defined in libucrtd.lib(_file.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(allocator.c.obj): locally defined symbol imported: _abort (defined in libucrtd.lib(abort.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(allocator.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(allocator.c.obj): locally defined symbol imported: ___stdio_common_vfprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(error.c.obj): locally defined symbol imported: ___acrt_iob_func (defined in libucrtd.lib(_file.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(error.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(error.c.obj): locally defined symbol imported: ___stdio_common_vfprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(thread_shared.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(logging.c.obj): locally defined symbol imported: ___acrt_iob_func (defined in libucrtd.lib(_file.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(logging.c.obj): locally defined symbol imported: _abort (defined in libucrtd.lib(abort.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(logging.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(logging.c.obj): locally defined symbol imported: ___stdio_common_vfprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(logging.c.obj): locally defined symbol imported: _fwrite (defined in libucrtd.lib(fwrite.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(logging.c.obj): locally defined symbol imported: __errno (defined in libucrtd.lib(errno.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(logging.c.obj): locally defined symbol imported: _fclose (defined in libucrtd.lib(fclose.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(byte_buf.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(encoding.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(assert.c.obj): locally defined symbol imported: ___acrt_iob_func (defined in libucrtd.lib(_file.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(assert.c.obj): locally defined symbol imported: _abort (defined in libucrtd.lib(abort.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(assert.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(assert.c.obj): locally defined symbol imported: ___stdio_common_vfprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(array_list.c.obj): locally defined symbol imported: _qsort (defined in libucrtd.lib(qsort.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(array_list.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(hash_table.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(common.c.obj): locally defined symbol imported: ___acrt_iob_func (defined in libucrtd.lib(_file.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(common.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(common.c.obj): locally defined symbol imported: ___stdio_common_vfprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(json.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(mutex.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(condition_variable.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(clock.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(condition_variable.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(thread.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(string.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(log_writer.c.obj): locally defined symbol imported: ___acrt_iob_func (defined in libucrtd.lib(_file.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(log_writer.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(log_writer.c.obj): locally defined symbol imported: _fwrite (defined in libucrtd.lib(fwrite.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(log_writer.c.obj): locally defined symbol imported: __errno (defined in libucrtd.lib(errno.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(log_writer.c.obj): locally defined symbol imported: _fclose (defined in libucrtd.lib(fclose.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(log_formatter.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(log_formatter.c.obj): locally defined symbol imported: ___stdio_common_vsnprintf_s (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(log_channel.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(file.c.obj): locally defined symbol imported: _fseek (defined in libucrtd.lib(fseek.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(file.c.obj): locally defined symbol imported: __errno (defined in libucrtd.lib(errno.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(file.c.obj): locally defined symbol imported: _fclose (defined in libucrtd.lib(fclose.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(file.c.obj): locally defined symbol imported: _ftell (defined in libucrtd.lib(ftell.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(file.c.obj): locally defined symbol imported: _fread (defined in libucrtd.lib(fread.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(file.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(cpuid.c.obj): locally defined symbol imported: _getenv (defined in libucrtd.lib(getenv.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(cpuid.c.obj): locally defined symbol imported: _atoi (defined in libucrtd.lib(atox.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(cpuid.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(encoding_avx2.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(system_info.c.obj): locally defined symbol imported: _fflush (defined in libucrtd.lib(fflush.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(system_info.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(system_info.c.obj): locally defined symbol imported: ___acrt_iob_func (defined in libucrtd.lib(_file.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(system_info.c.obj): locally defined symbol imported: ___stdio_common_vfprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(ref_count.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(ref_count.c.obj): locally defined symbol imported: _abort (defined in libucrtd.lib(abort.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(task_scheduler.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(cJSON.c.obj): locally defined symbol imported: _malloc (defined in libucrtd.lib(malloc.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(cJSON.c.obj): locally defined symbol imported: _free (defined in libucrtd.lib(free.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(cJSON.c.obj): locally defined symbol imported: _realloc (defined in libucrtd.lib(realloc.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(cJSON.c.obj): locally defined symbol imported: _strncmp (defined in libucrtd.lib(strncmp.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(cJSON.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(cJSON.c.obj): locally defined symbol imported: _strtod (defined in libucrtd.lib(strtod.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(cJSON.c.obj): locally defined symbol imported: __dclass (defined in libucrtd.lib(nan.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(cJSON.c.obj): locally defined symbol imported: ___stdio_common_vsscanf (defined in libucrtd.lib(input.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(cJSON.c.obj): locally defined symbol imported: _tolower (defined in libucrtd.lib(tolower_toupper.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(date_time.c.obj): locally defined symbol imported: _strtol (defined in libucrtd.lib(strtox.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(date_time.c.obj): locally defined symbol imported: _strftime (defined in libucrtd.lib(strftime.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(date_time.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(date_time.c.obj): locally defined symbol imported: _tolower (defined in libucrtd.lib(tolower_toupper.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(file.c.obj): locally defined symbol imported: __wfopen_s (defined in libucrtd.lib(fopen.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(file.c.obj): locally defined symbol imported: _wcsnlen (defined in libucrtd.lib(strnlen.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(file.c.obj): locally defined symbol imported: __fseeki64 (defined in libucrtd.lib(fseek.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(file.c.obj): locally defined symbol imported: __errno (defined in libucrtd.lib(errno.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(file.c.obj): locally defined symbol imported: __fileno (defined in libucrtd.lib(fileno.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(file.c.obj): locally defined symbol imported: __get_osfhandle (defined in libucrtd.lib(osfinfo.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(file.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(device_random.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(lru_cache.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(cache.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(cpuid.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(device_random.c.obj): locally defined symbol imported: _abort (defined in libucrtd.lib(abort.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(device_random.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(statistics.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(priority_queue.c.obj): locally defined symbol imported: _abort (defined in libucrtd.lib(abort.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(priority_queue.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(uri.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(uri.c.obj): locally defined symbol imported: _atoi (defined in libucrtd.lib(atox.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(environment.c.obj): locally defined symbol imported: _getenv (defined in libucrtd.lib(getenv.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(environment.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(time.c.obj): locally defined symbol imported: __localtime64_s (defined in libucrtd.lib(localtime.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(time.c.obj): locally defined symbol imported: __gmtime64_s (defined in libucrtd.lib(gmtime.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(time.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(uuid.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(uuid.c.obj): locally defined symbol imported: ___stdio_common_vsscanf (defined in libucrtd.lib(input.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(linked_hash_table.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(rw_lock.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: warning: aws-c-common.lib(fifo_cache.c.obj): locally defined symbol imported: ___stdio_common_vsprintf (defined in libucrtd.lib(output.obj)) [LNK4217]
lld-link: error: undefined symbol: __declspec(dllimport) __aligned_malloc
>>> referenced by C:\Users\andrio01\Documents\git\drivers\build\_deps\aws-crt-cpp-src\crt\aws-c-common\source\allocator.c:59
>>> aws-c-common.lib(allocator.c.obj):(_s_default_malloc)
lld-link: error: undefined symbol: __declspec(dllimport) __aligned_free
>>> referenced by C:\Users\andrio01\Documents\git\drivers\build\_deps\aws-crt-cpp-src\crt\aws-c-common\source\allocator.c:70
>>> aws-c-common.lib(allocator.c.obj):(_s_default_free)
lld-link: error: undefined symbol: __declspec(dllimport) __aligned_realloc
>>> referenced by C:\Users\andrio01\Documents\git\drivers\build\_deps\aws-crt-cpp-src\crt\aws-c-common\source\allocator.c:96
>>> aws-c-common.lib(allocator.c.obj):(_s_default_realloc)
lld-link: error: undefined symbol: __except_handler4_common
>>> referenced by d:\a01\_work\38\s\src\vctools\crt\vcstartup\src\eh\i386\chandler4gs.c:94
>>> msvcrtd.lib(chandler4gs.obj):(__except_handler4)
lld-link: error: undefined symbol: __declspec(dllimport) _modf
>>> referenced by C:\Users\andrio01\Documents\git\drivers\build\_deps\aws-crt-cpp-src\crt\aws-c-common\source\date_time.c:191
>>> aws-c-common.lib(date_time.c.obj):(_aws_date_time_init_epoch_secs)
lld-link: error: undefined symbol: __declspec(dllimport) __mktime64
>>> referenced by C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\ucrt\time.h:515
>>> aws-c-common.lib(date_time.c.obj):(_mktime)
lld-link: error: undefined symbol: __declspec(dllimport) __putenv_s
>>> referenced by C:\Users\andrio01\Documents\git\drivers\build\_deps\aws-crt-cpp-src\crt\aws-c-common\source\windows\environment.c:41
>>> aws-c-common.lib(environment.c.obj):(_aws_set_environment_value)
>>> referenced by C:\Users\andrio01\Documents\git\drivers\build\_deps\aws-crt-cpp-src\crt\aws-c-common\source\windows\environment.c:51
>>> aws-c-common.lib(environment.c.obj):(_aws_unset_environment_value)
lld-link: error: undefined symbol: __declspec(dllimport) __mkgmtime64
>>> referenced by C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\ucrt\time.h:507
>>> aws-c-common.lib(time.c.obj):(__mkgmtime)
ninja: build stopped: subcommand failed.
I set the variables:
set(BUILD_SHARED_LIBS OFF)
set(AWS_STATIC_MSVC_RUNTIME_LIBRARY ON)
set(AWS_WARNINGS_ARE_ERRORS OFF)
And my executable is also has the compiler option /MTd
I am not sure how to proceed. Can anyone give any pointers?
Expected Behavior
To compile
Current Behavior
Linker error described above
Reproduction Steps
Build the project with CMake
Possible Solution
No response
Additional Information/Context
No response
aws-crt-cpp version used
0.23.1
Compiler and version used
clang-cl 13.0.1
Operating System and version
Windows 10 x64
The text was updated successfully, but these errors were encountered:
Got it! The problem I was setting the AWS_STATIC_MSVC_RUNTIME_LIBRARY with a "set" and apparently in the aws-c-common uses the option and therefore sets it in the cache.
So, by setting set(AWS_STATIC_MSVC_RUNTIME_LIBRARY ON CACHE BOOL "Build with MSVC Static Runtime Library") solves the problem
Describe the bug
I am trying to compile the library, using CMake and MSVC, but I am getting a linker error:
I set the variables:
set(BUILD_SHARED_LIBS OFF)
set(AWS_STATIC_MSVC_RUNTIME_LIBRARY ON)
set(AWS_WARNINGS_ARE_ERRORS OFF)
And my executable is also has the compiler option /MTd
I am not sure how to proceed. Can anyone give any pointers?
Expected Behavior
To compile
Current Behavior
Linker error described above
Reproduction Steps
Build the project with CMake
Possible Solution
No response
Additional Information/Context
No response
aws-crt-cpp version used
0.23.1
Compiler and version used
clang-cl 13.0.1
Operating System and version
Windows 10 x64
The text was updated successfully, but these errors were encountered: