I have built Quantlib on Windows using Visual Studio 2017 and want to build Quantlib-SWIG for Python.
However, I have LNK1104: error. Namely, after launching Command Prompt from C:\QuantLib-SWIG-1.12\Python directory I receive this error:
fatal error LNK1104: cannot open file 'QuantLib-vc90-x64-mt.lib'
I saw a similar question with advise from Luigi Ballabio and KingJohnno to verify if QuantLib-vc90-x64-mt.lib file is in place & add to the path variable C:\QuantLib-SWIG-1.12.
I did the last suggestion, but I have the problem with that I have in C:\QuantLib\QuantLib-1.12\lib a QuantLib-vc141-x64-mt.lib library, i.e. not the file QuantLib-vc90-x64-mt.lib. I have created separate directory with vc141 file renamed to vc90. This did not help.
I have also read online that the problem might be with the Python specifically builded using different VS version. I have downloaded Python 2.7 builded using VS 2010 (not VS2008) and did not succeed as well.
Please see the whole terminal message here:
C:\QuantLib-SWIG-1.12\Python>cd C:\QuantLib-SWIG-1.12\Python
C:\QuantLib-SWIG-1.12\Python>set QL_DIR=C:\QuantLib\QuantLib-1.12
C:\QuantLib-SWIG-1.12\Python>set INCLUDE=C:\Boost\boost_1_66_0
C:\QuantLib-SWIG-1.12\Python>
C:\QuantLib-SWIG-1.12\Python>python setup.py build
running build
running build_py
running build_ext
building 'QuantLib._QuantLib' extension
C:\Users\user1\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -D__WIN32__ -DWIN32 -DNDEBUG -D_WINDOWS -DNOMINMAX -IC:\Python27vc08\include -IC:\Python27vc08\PC -IC:\QuantLib\QuantLib-1.12 -IC:\Boost\boost_1_66_0 /TpQuantLib/quantlib_wrap.cpp /Fobuild\temp.win-amd64-2.7\Release\QuantLib/quantlib_wrap.obj /GR /FD /Zm250 /EHsc /bigobj /MD
quantlib_wrap.cpp
C:\Users\user1\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Include\xutility(2472) : warning C4267: '=' : conversion from 'size_t' to 'unsigned int', possible loss of data
C:\Users\user1\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Include\xutility(2485) : see reference to function template instantiation '_OutIt std::_Copy_opt<_InIt,unsigned int*,std::forward_iterator_tag>(_InIt,_InIt,_OutIt,_InOutItCat,std::_Nonscalar_ptr_iterator_tag,std::_Range_checked_iterator_tag)' being compiled
with
[
_OutIt=unsigned int *,
_InIt=const unsigned __int64 *,
_InOutItCat=std::forward_iterator_tag
]
C:\Users\user1\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Include\xutility(2563) : see reference to function template instantiation '_OutIt std::_Copy_opt<const unsigned __int64*,_OutIt>(_InIt,_InIt,_OutIt,std::random_access_iterator_tag,std::_Nonscalar_ptr_iterator_tag,std::_Range_checked_iterator_tag)' being compiled
with
[
_OutIt=std::_Vector_iterator<std::_Vbase,std::allocator<std::_Vbase>>,
_InIt=const unsigned __int64 *
]
QuantLib/quantlib_wrap.cpp(16340) : see reference to function template instantiation 'std::_Vector_iterator<_Ty,_Alloc> std::copy<std::_Vector_const_iterator<unsigned __int64,std::allocator<unsigned __int64>>,std::_Vector_iterator<_Ty,_Alloc>>(_InIt,_InIt,_OutIt)' being compiled
with
[
_Ty=std::_Vbase,
_Alloc=std::allocator<std::_Vbase>,
_InIt=std::_Vector_const_iterator<size_t,std::allocator<size_t>>,
_OutIt=std::_Vector_iterator<std::_Vbase,std::allocator<std::_Vbase>>
]
C:\Users\user1\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\Python27vc08\libs /LIBPATH:C:\Python27vc08\PCbuild\amd64 /LIBPATH:C:\Python27vc08\PC\VS9.0\amd64 /LIBPATH:C:\QuantLib\QuantLib-1.12\lib /EXPORT:init_QuantLib build\temp.win-amd64-2.7\Release\QuantLib/quantlib_wrap.obj /OUT:build\lib.win-amd64-2.7\QuantLib\_QuantLib.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\QuantLib\_QuantLib.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\QuantLib\_QuantLib.pyd.manifest /subsystem:windows /machine:x64
LINK : fatal error LNK1104: cannot open file 'QuantLib-vc90-x64-mt.lib'
error: command 'C:\\Users\\user1\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\link.exe' failed with exit status 1104
C:\QuantLib-SWIG-1.12\Python>
python setup.py build worked under Python 3.6.5.
Related
Morning,
I am currently moving my whole dev environment from VS2019 to CLion and can't get the Enterprise Windows Driver Kit (WDK) build environment working. After setting up the toolchain I get the following error message:
-- The C compiler identification is MSVC 19.28.29913.0
-- The CXX compiler identification is MSVC 19.28.29913.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: E:/Program Files/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: E:/Program Files/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe - broken
CMake Error at C:/Program Files/JetBrains/CLion 2021.3.2/bin/cmake/win/share/cmake-3.21/Modules/CMakeTestCCompiler.cmake:69 (message):
The C compiler
"E:/Program Files/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: A:/Git/School/Driver/cmake-build-debug/CMakeFiles/CMakeTmp
Run Build Command(s):C:/Program Files/JetBrains/CLion 2021.3.2/bin/ninja/win/ninja.exe cmTC_02d23 && [1/2] Building C object CMakeFiles\cmTC_02d23.dir\testCCompiler.c.obj
[2/2] Linking C executable cmTC_02d23.exe
FAILED: cmTC_02d23.exe
cmd.exe /C "cd . && "C:\Program Files\JetBrains\CLion 2021.3.2\bin\cmake\win\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_02d23.dir --rc="E:\PROG#OLC\WIND#B-J\10\bin\1002#1AM.0\x86\rc.exe" --mt="E:\PROG#OLC\WIND#B-J\10\bin\1002#1AM.0\x86\mt.exe" --manifests -- "E:\PROG#OLC\MICR#M1~\2019\BUIL#ZPH\VC\Tools\MSVC\1428#Y8D.299\bin\Hostx64\x64\link.exe" /nologo CMakeFiles\cmTC_02d23.dir\testCCompiler.c.obj /out:cmTC_02d23.exe /implib:cmTC_02d23.lib /pdb:cmTC_02d23.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cmd.exe /C "cd /D A:\Git\School\Driver\cmake-build-debug\CMakeFiles\CMakeTmp && C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noprofile -executionpolicy Bypass -file A:/Git/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary A:/Git/School/Driver/cmake-build-debug/CMakeFiles/CMakeTmp/cmTC_02d23.exe -installedDir A:/Git/vcpkg/installed/x64-windows-static/debug/bin -OutVariable out""
LINK Pass 1: command "E:\PROG#OLC\MICR#M1~\2019\BUIL#ZPH\VC\Tools\MSVC\1428#Y8D.299\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_02d23.dir\testCCompiler.c.obj /out:cmTC_02d23.exe /implib:cmTC_02d23.lib /pdb:cmTC_02d23.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\cmTC_02d23.dir/intermediate.manifest CMakeFiles\cmTC_02d23.dir/manifest.res" failed (exit code 1104) with the following output:
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:8 (project)
So my guess would be that CLion isn't able to find the correct Windows Kit that includes the missing static linked libs.
When working with VS2019 this issues is not existing as LaunchBuildEnv.cmd will take care of setting all paths.
Basically you just start LaunchBuildEnv.cmd then type SetupVSEnv and start VS2019 from the cmd and all paths etc. are fixed automatically.
Unfortunately this doesn't work for CLion. When pointing CLion to the Build Tools folder it is able to detect everything correctly but seems to no be able to get the Windows Kits from E:\Program Files\Windows Kits\10.
I already tried to supply CLion with SetupBuildEnv.cmd as the Environment File without any success.
So I wanted to ask if somebody know how I need to supply this path to CLion so it is correctly forwarded to cl.exe.
Regards Artur
I have an existing project that I didn't know how to create a vs solution from it. So I decided to use KDevelop which can parse the directory and use the CMakeLists.txt.
The thing is that cmake can't find some lib files for the linking. The directory that these files are stored is in PATH. At first I thought that I might be compiling for another ARCH but I don't know where to go from here.
C:/Users/Petros/projects/QtDice/build> "C:/Program Files/CMake/bin/cmake.exe" "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON" "-DCMAKE_INSTALL_PREFIX=C:/Program Files (x86)/QtDice" "-DCMAKE_BUILD_TYPE=Debug" C:/Users/Petros/projects/QtDice
-- The CXX compiler identification is MSVC 19.15.26730.0
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx64/x64/cl.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.12/Modules/CMakeTestCXXCompiler.cmake:45 (message):
The C++ compiler
"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx64/x64/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/Petros/projects/QtDice/build/CMakeFiles/CMakeTmp
Run Build Command:"nmake" "/nologo" "cmTC_c2fa6\fast"
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\bin\HostX64\x64\nmake.exe" -f CMakeFiles\cmTC_c2fa6.dir\build.make /nologo -L CMakeFiles\cmTC_c2fa6.dir\build
Building CXX object CMakeFiles/cmTC_c2fa6.dir/testCXXCompiler.cxx.obj
C:\PROGRA~2\MICROS~3\2017\COMMUN~1\VC\Tools\MSVC\1415~1.267\bin\Hostx64\x64\cl.exe #C:\Users\Petros\AppData\Local\Temp\nm8F3F.tmp
testCXXCompiler.cxx
Linking CXX executable cmTC_c2fa6.exe
"C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_c2fa6.dir --manifests -- C:\PROGRA~2\MICROS~3\2017\COMMUN~1\VC\Tools\MSVC\1415~1.267\bin\Hostx64\x64\link.exe /nologo #CMakeFiles\cmTC_c2fa6.dir\objects1.rsp #C:\Users\Petros\AppData\Local\Temp\nm9088.tmp
LINK Pass 1: command "C:\PROGRA~2\MICROS~3\2017\COMMUN~1\VC\Tools\MSVC\1415~1.267\bin\Hostx64\x64\link.exe /nologo #CMakeFiles\cmTC_c2fa6.dir\objects1.rsp /out:cmTC_c2fa6.exe /implib:cmTC_c2fa6.lib /pdb:C:\Users\Petros\projects\QtDice\build\CMakeFiles\CMakeTmp\cmTC_c2fa6.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\cmTC_c2fa6.dir/intermediate.manifest CMakeFiles\cmTC_c2fa6.dir/manifest.res" failed (exit code 1104) with the following output:
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
NMAKE : fatal error U1077: '"C:\Program Files\CMake\bin\cmake.exe"' : return code '0xffffffff'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
See also "C:/Users/Petros/projects/QtDice/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Petros/projects/QtDice/build/CMakeFiles/CMakeError.log".
*** Failure: Exit code 1 ***
```
Are there any ideas on what could be wrong?
EDIT : SOLVED
At last I found a rather hackish workaround. The batch file for KDevelop in VS enviroment, doesn't work for VS-2017 (which defined the VS150COMNTOOLS variable) but it supports up to VS-2015 (VS140COMNTOOLS).
VS2017 changed the layout of it's folders so the old SET script="!base!\..\..\VC\vcvarsall.bat" really becomes SET script="%base%..\..\VC\Auxiliary\Build\vcvarsall.bat" x64.
Of course this new script should be run inside Developer Command Prompt console and not by just clicking the batch file.
setlocal EnableDelayedExpansion
setlocal enableextensions
if DEFINED VS150COMNTOOLS (
SET "base=%VS150COMNTOOLS%"
) else ( IF DEFINED VS120COMNTOOLS (
SET "base=%VS120COMNTOOLS%"
) else ( IF DEFINED VS110COMNTOOLS (
SET "base=%VS110COMNTOOLS%"
) else ( IF DEFINED VS100COMNTOOLS (
SET "base=%VS100COMNTOOLS%"
) else (
START CMD /C "The Microsoft Visual C++ compiler was not found on your system, you might not be able to compile programs. && PAUSE"
) )))
SET script="%base%..\..\VC\Auxiliary\Build\vcvarsall.bat" x64
CALL %script%
FOR /F "usebackq tokens=3*" %%A IN (`REG QUERY "HKEY_LOCAL_MACHINE\Software\KDE\KDevelop" /v Install_Dir`) DO (
set appdir=%%A %%B
)
if NOT DEFINED appdir (
FOR /F "usebackq tokens=3*" %%A IN (`REG QUERY "HKEY_LOCAL_MACHINE\Software\Wow6432Node\KDE\KDevelop" /v Install_Dir`) DO (
set appdir=%%A %%B
)
)
START "" "%appdir%\bin\kdevelop.exe"
So I am on:
Windows 10
MS Visual Studio 2017 (2017 build tools)
trying to build:
qt5.10.1 with QtWebEngine
using jom.exe -j4
and during the QtWebEngine build process, this happened:
[51/12427] CC obj/third_party/webrtc/common_audio/common_audio_c/sqrt_of_one_minus_x_squared.obj
[52/12427] CC obj/third_party/webrtc/common_audio/common_audio_c/complex_fft.obj
[53/12427] CXX obj/third_party/webrtc/call/call/call.obj
FAILED: obj/third_party/webrtc/call/call/call.obj
ninja -t msvc -e environment.x64 -- "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX64\x64/cl.exe" /nologo /showIncludes #obj/third_party/webrtc/call/call/call.obj.rsp /c ../../3rdparty/chromium/third_party/webrtc/call/call.cc /Foobj/third_party/webrtc/call/call/call.obj /Fd"obj/third_party/webrtc/call/call_cc.pdb"
C:\Qt\qt-everywhere-src-5.10.1\qtwebengine\src\3rdparty\chromium\third_party\webrtc/modules/video_coding/sequence_number_util.h(101): fatal error C1001: An internal error has occurred in the compiler.
(compiler file 'f:\dd\vctools\compiler\cxxfe\sl\p1\c\outdname.c', line 5310)
To work around this problem, try simplifying or changing the program near the locations listed above.
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\include\xutility(301): note: see reference to class template instantiation 'webrtc::DescendingSeqNumComp<uint16_t,0>' being compiled
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\include\xutility(301): note: see reference to variable template 'const bool is_empty_v<webrtc::DescendingSeqNumComp<unsigned short,0> >' being compiled
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\include\xtree(1078): note: see reference to class template instantiation 'std::_Tree_comp_alloc<_Traits>' being compiled
with
[
_Traits=std::_Tmap_traits<uint16_t,webrtc::NackModule::NackInfo,webrtc::DescendingSeqNumComp<uint16_t,0>,std::allocator<std::pair<const uint16_t,webrtc::NackModule::NackInfo>>,false>
]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\include\map(82): note: see reference to class template instantiation 'std::_Tree<std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,false>>' being compiled
with
[
_Kty=uint16_t,
_Ty=webrtc::NackModule::NackInfo,
_Pr=webrtc::DescendingSeqNumComp<uint16_t,0>,
_Alloc=std::allocator<std::pair<const uint16_t,webrtc::NackModule::NackInfo>>
]
C:\Qt\qt-everywhere-src-5.10.1\qtwebengine\src\3rdparty\chromium\third_party\webrtc/modules/video_coding/nack_module.h(88): note: see reference to class template instantiation 'std::map<uint16_t,webrtc::NackModule::NackInfo,webrtc::DescendingSeqNumComp<uint16_t,0>,std::allocator<std::pair<const _Kty,_Ty>>>' being compiled
with
[
_Kty=uint16_t,
_Ty=webrtc::NackModule::NackInfo
]
[54/12427] CC obj/third_party/webrtc/common_audio/common_audio_c/refl_coef_to_lpc.obj
[55/12427] CC obj/third_party/webrtc/common_audio/common_audio_c/vector_scaling_operations.obj
[56/12427] CC obj/third_party/webrtc/common_audio/common_audio_c/spl_sqrt_floor.obj
[57/12427] CC obj/third_party/webrtc/common_audio/common_audio_c/resample_by_2.obj
[58/12427] CC obj/third_party/webrtc/common_audio/common_audio_c/webrtc_vad.obj
[59/12427] CC obj/third_party/webrtc/common_audio/common_audio_c/spl_init.obj
[60/12427] CXX obj/third_party/webrtc/common_audio/common_audio/sparse_fir_filter.obj
[61/12427] CXX obj/third_party/webrtc/common_audio/common_audio/real_fourier_ooura.obj
[62/12427] CXX obj/third_party/webrtc/common_audio/common_audio_cc/dot_product_with_scale.obj
ninja: build stopped: subcommand failed.
jom: C:\Qt\qt-everywhere-src-5.10.1\qtwebengine\src\core\Makefile.gn_run.Debug [run_ninja] Error 1
jom: C:\Qt\qt-everywhere-src-5.10.1\qtwebengine\src\core\Makefile.gn_run [debug-all] Error 2
jom: C:\Qt\qt-everywhere-src-5.10.1\qtwebengine\src\core\Makefile [sub-gn_run-pro-make_first] Error 2
jom: C:\Qt\qt-everywhere-src-5.10.1\qtwebengine\src\Makefile [sub-core-make_first] Error 2
jom: C:\Qt\qt-everywhere-src-5.10.1\qtwebengine\Makefile [sub-src-make_first] Error 2
jom: C:\Qt\qt-everywhere-src-5.10.1\Makefile [module-qtwebengine-make_first] Error 2
C:\Qt\qt-everywhere-src-5.10.1>
I found this forum with a slightly active/recent question asking about this same issue here:
Internal compiler error in outdname.c in VS15.7p3 when building Firefox webrtc code
Is there anything I can do from this point to fix this?
Downgrading my version of VS to 2015 allowed me to bypass this compiler error and compile QT successfully.
I am trying to build OpenSSL from source (branch OpenSSL_1_0_1-stable) using Visual C++ (Visual Studio 2015 is installed) by following the instructions here.
When I run nmake -f ms\ntdll.mak I get the following output:
Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation. All rights reserved.
Building OpenSSL
perl util/copy.pl ".\crypto\buildinf.h" "tmp32dll\buildinf.h"
Copying: ./crypto/buildinf.h to tmp32dll/buildinf.h
perl util/copy.pl ".\crypto\opensslconf.h" "inc32\openssl\opensslconf.h"
Copying: ./crypto/opensslconf.h to inc32/openssl/opensslconf.h
cl /Fotmp32dll\uplink.obj -Iinc32 -Itmp32dll /MD /Ox /O2 /Ob2 -DOPENSSL_THREADS -DDSO_WIN32 -W3 -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -DOPENSSL_USE_APPLINK -I. -DOPENSSL_NO_RC5 -DOPENSSL_NO_MD2 -DOPENSSL_NO_SSL2 -DOPENSSL_NO_KRB5 -DOPENSSL_NO_JPAKE -DOPENSSL_NO_WEAK_SSL_CIPHERS -DOPENSSL_NO_STATIC_ENGINE /Zi /Fdtmp32dll/lib -D_WINDLL -c ms\uplink.c
uplink.c
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\corecrt.h(205): fatal error C1189: #error: Compiling Desktop applications for the ARM platform is not supported.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64_arm\cl.EXE"' : return code '0x2'
Stop.
My ms/ntdll.mak file content:
# This makefile has been automatically generated from the OpenSSL distribution.
# This single makefile will build the complete OpenSSL distribution and
# by default leave the 'interesting' output files in .\out and the stuff
# that needs deleting in .\tmp.
# The file was generated by running 'make makefile.one', which
# does a 'make files', which writes all the environment variables from all
# the makefiles to the file call MINFO. This file is used by
# util\mk1mf.pl to generate makefile.one.
# The 'makefile per directory' system suites me when developing this
# library and also so I can 'distribute' indervidual library sections.
# The one monster makefile better suits building in non-unix
# environments.
INSTALLTOP=D:\TelegramDesktop\Libraries\openssl\Release
OPENSSLDIR=D:\TelegramDesktop\Libraries\openssl\Release\ssl
# Set your compiler options
PLATFORM=VC-WIN32
CC=cl
CFLAG= /MD /Ox /O2 /Ob2 -DOPENSSL_THREADS -DDSO_WIN32 -W3 -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -DOPENSSL_USE_APPLINK -I. -DOPENSSL_NO_RC5 -DOPENSSL_NO_MD2 -DOPENSSL_NO_SSL2 -DOPENSSL_NO_KRB5 -DOPENSSL_NO_JPAKE -DOPENSSL_NO_WEAK_SSL_CIPHERS -DOPENSSL_NO_STATIC_ENGINE
APP_CFLAG= /Zi /Fd$(TMP_D)/app
LIB_CFLAG= /Zi /Fd$(TMP_D)/lib -D_WINDLL
SHLIB_CFLAG=
APP_EX_OBJ=setargv.obj $(OBJ_D)\applink.obj /implib:$(TMP_D)\junk.lib
SHLIB_EX_OBJ=
# add extra libraries to this define, for solaris -lsocket -lnsl would
# be added
EX_LIBS=ws2_32.lib gdi32.lib advapi32.lib crypt32.lib user32.lib
# The OpenSSL directory
SRC_D=.
LINK_CMD=link
LFLAGS=/nologo /subsystem:console /opt:ref /debug
RSC=rc
# The output directory for everything intersting
OUT_D=out32dll
# The output directory for all the temporary muck
TMP_D=tmp32dll
# The output directory for the header files
INC_D=inc32
INCO_D=inc32\openssl
PERL=perl
CP=$(PERL) util/copy.pl
RM=del /Q
RANLIB=
MKDIR=$(PERL) util/mkdir-p.pl
MKLIB=lib /nologo
MLFLAGS= /nologo /subsystem:console /opt:ref /debug /dll
ASM=ml /nologo /Cp /coff /c /Cx /Zi
# FIPS validated module and support file locations
FIPSDIR=\usr\local\ssl\fips-2.0
BASEADDR=0xFB00000
FIPSLIB_D=$(FIPSDIR)\lib
FIPS_PREMAIN_SRC=$(FIPSLIB_D)\fips_premain.c
O_FIPSCANISTER=$(FIPSLIB_D)\fipscanister.lib
FIPS_SHA1_EXE=$(FIPSDIR)\bin\fips_standalone_sha1.exe
E_PREMAIN_DSO=fips_premain_dso
PREMAIN_DSO_EXE=$(BIN_D)\fips_premain_dso.exe
FIPSLINK=$(PERL) $(FIPSDIR)\bin\fipslink.pl
Running nmake -f ms\nt.mak produces the same error.
I am not sure why building for platform VC-WIN32 leads to an error about ARM platform. Also, I haven't find any question about this error on VS2015, only VS2013 and below, in which compiling for ARM platform is really not supported.
Any suggestions?
I've found out what was wrong:
I have run the commands in VS2015 x64 ARM Cross Tools Command Prompt instead of in VS2015 x86 Native Cross Tools Command Prompt.
Running in VS2015 x86 Native Cross Tools Command Prompt solved the issue.
I get the linker error fatal error C1107: could not find assembly 'platform.winmd': please specify the assembly search path using /AI or by setting the LIBPATH environment variable when I try to compile a C++/CX program on the command line.
The error is the same after I followed the instructions on this page: https://msdn.microsoft.com/en-us/library/dn769142.aspx (to summarize: run cl /ZW /EHsc source.cpp from the Developer Command Prompt for VS2015)
I also tried running vcvarsall.bat x86 store from the Developer Command Prompt for VS2015 but I still get the same error (the same error also happens when running vcvarsall.bat x86 store from a plain command prompt).
UPDATE: Apparently this bug has been fixed in VS2015 Update 1, I have not been able to test myself yet though.
As it turns out some command line parameters are missing from the documentation mentioned in the question, here is the full command line required to compile a small program:
cl /ZW
/ZW:nostdlib
/D WINAPI_FAMILY=WINAPI_FAMILY_APP
/D __WRL_NO_DEFAULT_LIB__
/Gm-
/EHsc
/MDd
/FU"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\store\references\platform.winmd"
/FU"C:\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.FoundationContract\1.0.0.0\Windows.Foundation.FoundationContract.winmd"
/FU"C:\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.UniversalApiContract\1.0.0.0\Windows.Foundation.UniversalApiContract.winmd"
smurf.cpp
/link /SUBSYSTEM:CONSOLE
Where smurf.cpp contains:
using namespace Platform;
int main(Platform::Array<Platform::String^>^ args)
{
Platform::Details::Console::WriteLine("This is a C++/CX program.");
}
Will successfully print:
C:\Users\Mikael>smurf.exe
This is a C++/CX program.