Error Building with CMake 3.15.4, Ninja 1.9 and Intel Compiler 19 on Windows 10 - Choosing 32 Bit Libraries in 64 Bit System
Hello,
I have a project which is successfully built with cmake -G"Visual Studio 15 2017 Win64" -T"Intel C++ Compiler 19.0" ..
.
Yet I want to build it with Ninja as I want to make it work on non Windows as well.
The problem is it seems something really basic is not working in the above configuration. It fails even before going into working on the project itself.
This is the output of CMakeError.log
:
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/bin/intel64/icl.exe
Build flags:
Id flags:
The output was:
1120
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.0.5.281 Build 20190815
Copyright (C) 1985-2019 Intel Corporation. All rights reserved.
CMakeCCompilerId.c
Microsoft (R) Incremental Linker Version 14.16.27034.0
Copyright (C) Microsoft Corporation. All rights reserved.
-out:CMakeCCompilerId.exe
CMakeCCompilerId.obj
LINK : error LNK2001: unresolved external symbol mainCRTStartup
libirc.lib(new_proc_init.obj) : error LNK2019: unresolved external symbol __security_cookie referenced in function __intel_new_feature_proc_init
libirc.lib(irc_msg_support.obj) : error LNK2001: unresolved external symbol __security_cookie
libirc.lib(proc_init_utils.obj) : error LNK2001: unresolved external symbol __security_cookie
libirc.lib(intel_lib_vs_wrappers_init.obj) : error LNK2001: unresolved external symbol __security_cookie
libirc.lib(new_proc_init.obj) : error LNK2019: unresolved external symbol strlen referenced in function __intel_new_feature_proc_init
libirc.lib(irc_msg_support.obj) : error LNK2001: unresolved external symbol strlen
libirc.lib(new_proc_init.obj) : error LNK2019: unresolved external symbol strncat referenced in function __intel_new_feature_proc_init
libirc.lib(new_proc_init.obj) : error LNK2019: unresolved external symbol exit referenced in function __intel_new_feature_proc_init
libirc.lib(new_proc_init.obj) : error LNK2019: unresolved external symbol __security_check_cookie referenced in function __intel_new_feature_proc_init
libirc.lib(irc_msg_support.obj) : error LNK2001: unresolved external symbol __security_check_cookie
libirc.lib(proc_init_utils.obj) : error LNK2001: unresolved external symbol __security_check_cookie
libirc.lib(intel_lib_vs_wrappers_init.obj) : error LNK2001: unresolved external symbol __security_check_cookie
libirc.lib(new_proc_init.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck
libirc.lib(irc_msg_support.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck
libirc.lib(proc_init_utils.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck
libirc.lib(intel_lib_vs_wrappers_init.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck
libirc.lib(irc_msg_support.obj) : error LNK2019: unresolved external symbol __imp_FormatMessageA referenced in function __libirc_get_msg
libirc.lib(irc_msg_support.obj) : error LNK2019: unresolved external symbol __imp_LoadLibraryA referenced in function __libirc_get_msg
libirc.lib(irc_msg_support.obj) : error LNK2019: unresolved external symbol __imp_GetThreadLocale referenced in function __libirc_get_msg
libirc.lib(irc_msg_support.obj) : error LNK2019: unresolved external symbol strncpy referenced in function __libirc_get_msg
libirc.lib(proc_init_utils.obj) : error LNK2019: unresolved external symbol memset referenced in function __intel_proc_init_ftzdazule
libirc.lib(intel_lib_vs_wrappers_init.obj) : error LNK2019: unresolved external symbol __imp_InitializeCriticalSection referenced in function __intel_lib_wrappers_init
libirc.lib(intel_lib_vs_wrappers_init.obj) : error LNK2019: unresolved external symbol __imp_LoadLibraryExA referenced in function __intel_lib_wrappers_init
libirc.lib(intel_lib_vs_wrappers_init.obj) : error LNK2019: unresolved external symbol __imp_LeaveCriticalSection referenced in function __intel_lib_wrappers_init
libirc.lib(intel_lib_vs_wrappers_init.obj) : error LNK2019: unresolved external symbol __imp_GetProcAddress referenced in function __intel_lib_wrappers_init
libirc.lib(intel_lib_vs_wrappers_init.obj) : error LNK2019: unresolved external symbol __imp_GetModuleHandleExA referenced in function __intel_lib_wrappers_init
libirc.lib(intel_lib_vs_wrappers_init.obj) : error LNK2019: unresolved external symbol __imp_GetEnvironmentVariableA referenced in function __intel_lib_wrappers_init
libirc.lib(intel_lib_vs_wrappers_init.obj) : error LNK2019: unresolved external symbol __imp_EnterCriticalSection referenced in function __intel_lib_wrappers_init
libirc.lib(intel_lib_vs_wrappers_init.obj) : error LNK2019: unresolved external symbol strcat_s referenced in function __intel_lib_wrappers_init
libirc.lib(intel_lib_vs_wrappers_init.obj) : error LNK2019: unresolved external symbol _errno referenced in function error__errno
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\lib\x86\LIBCMT.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x86\uuid.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x86\kernel32.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
CMakeCCompilerId.exe : fatal error LNK1120: 21 unresolved externals
It seems for some reason it tries to link to 32 Bit system.
Yet in CMakeCache.txt
it looks fine:
########################
# EXTERNAL cache entries
########################
//Choose the type of build, options are: None Debug Release RelWithDebInfo
// MinSizeRel ...
CMAKE_BUILD_TYPE:STRING=Release
//No help, variable specified on the command line.
CMAKE_CXX_COMPILER:UNINITIALIZED=icl
//C compiler
CMAKE_C_COMPILER:STRING=C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/bin/intel64/icl.exe
//Flags used by the C compiler during all build types.
CMAKE_C_FLAGS:STRING=/DWIN32 /D_WINDOWS /W3
//Flags used by the C compiler during DEBUG builds.
CMAKE_C_FLAGS_DEBUG:STRING=/MDd /Zi /Ob0 /Od /RTC1
//Flags used by the C compiler during MINSIZEREL builds.
CMAKE_C_FLAGS_MINSIZEREL:STRING=-DNDEBUG /MD /O1 /Ob1 /DNDEBUG
//Flags used by the C compiler during RELEASE builds.
CMAKE_C_FLAGS_RELEASE:STRING=-DNDEBUG /MD /O2 /Ob2 /DNDEBUG
//Flags used by the C compiler during RELWITHDEBINFO builds.
CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-DNDEBUG /MD /Zi /O2 /Ob1 /DNDEBUG
//Libraries linked by default with all C applications.
CMAKE_C_STANDARD_LIBRARIES:STRING=kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib
//Flags used by the linker during all build types.
CMAKE_EXE_LINKER_FLAGS:STRING=/machine:x64
//Flags used by the linker during DEBUG builds.
CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING=/debug /INCREMENTAL
//Flags used by the linker during MINSIZEREL builds.
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING=/INCREMENTAL:NO
//Flags used by the linker during RELEASE builds.
CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING=/INCREMENTAL:NO
//Flags used by the linker during RELWITHDEBINFO builds.
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING=/debug /INCREMENTAL
//Enable/Disable output of compile commands during generation.
CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=OFF
//Install path prefix, prepended onto install directories.
CMAKE_INSTALL_PREFIX:PATH=C:/Program Files (x86)/FixScannedDrawingAux
//Path to a program.
CMAKE_LINKER:FILEPATH=C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/link.exe
//Program used to build from build.ninja files.
CMAKE_MAKE_PROGRAM:FILEPATH=C:/Applications/BuildEnv/Ninja/ninja.exe
//Flags used by the linker during the creation of modules during
// all build types.
CMAKE_MODULE_LINKER_FLAGS:STRING=/machine:x64
//Flags used by the linker during the creation of modules during
// DEBUG builds.
CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING=/debug /INCREMENTAL
//Flags used by the linker during the creation of modules during
// MINSIZEREL builds.
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING=/INCREMENTAL:NO
//Flags used by the linker during the creation of modules during
// RELEASE builds.
CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING=/INCREMENTAL:NO
//Flags used by the linker during the creation of modules during
// RELWITHDEBINFO builds.
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING=/debug /INCREMENTAL
//Path to a program.
CMAKE_MT:FILEPATH=C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/mt.exe
//Value Computed by CMake
CMAKE_PROJECT_DESCRIPTION:STATIC=
//Value Computed by CMake
CMAKE_PROJECT_HOMEPAGE_URL:STATIC=
//Value Computed by CMake
CMAKE_PROJECT_NAME:STATIC=FixScannedDrawingAux
//RC compiler
CMAKE_RC_COMPILER:FILEPATH=C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/rc.exe
//Flags for Windows Resource Compiler during all build types.
CMAKE_RC_FLAGS:STRING=-DWIN32
//Flags for Windows Resource Compiler during DEBUG builds.
CMAKE_RC_FLAGS_DEBUG:STRING=-D_DEBUG
//Flags for Windows Resource Compiler during MINSIZEREL builds.
CMAKE_RC_FLAGS_MINSIZEREL:STRING=
//Flags for Windows Resource Compiler during RELEASE builds.
CMAKE_RC_FLAGS_RELEASE:STRING=
//Flags for Windows Resource Compiler during RELWITHDEBINFO builds.
CMAKE_RC_FLAGS_RELWITHDEBINFO:STRING=
//Flags used by the linker during the creation of shared libraries
// during all build types.
CMAKE_SHARED_LINKER_FLAGS:STRING=/machine:x64
//Flags used by the linker during the creation of shared libraries
// during DEBUG builds.
CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING=/debug /INCREMENTAL
//Flags used by the linker during the creation of shared libraries
// during MINSIZEREL builds.
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING=/INCREMENTAL:NO
//Flags used by the linker during the creation of shared libraries
// during RELEASE builds.
CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING=/INCREMENTAL:NO
//Flags used by the linker during the creation of shared libraries
// during RELWITHDEBINFO builds.
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING=/debug /INCREMENTAL
//If set, runtime paths are not added when installing shared libraries,
// but are added when building.
CMAKE_SKIP_INSTALL_RPATH:BOOL=NO
//If set, runtime paths are not added when using shared libraries.
CMAKE_SKIP_RPATH:BOOL=NO
//Flags used by the linker during the creation of static libraries
// during all build types.
CMAKE_STATIC_LINKER_FLAGS:STRING=/machine:x64
//Flags used by the linker during the creation of static libraries
// during DEBUG builds.
CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING=
//Flags used by the linker during the creation of static libraries
// during MINSIZEREL builds.
CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING=
//Flags used by the linker during the creation of static libraries
// during RELEASE builds.
CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING=
//Flags used by the linker during the creation of static libraries
// during RELWITHDEBINFO builds.
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING=
//ON
CMAKE_VERBOSE_MAKEFILE:BOOL=ON
//Choose C Standard
C_STANDARD:STRING=99
By the way, Is there an elegant way to tell CMake to use Static VC Run Time Libraries on Windows?
Remark
Of course I ran Intel Compiler environment file before - ipsxe-comp-vars.bat
.
Edited by Royi