I'm trying to build Boost 1.49.0 using MSVC2010 and it fails with the following error:
file bin.v2\libs\math\build\msvc-10.0\release\link-static\runtime-link-static\threading-multi\assoc_laguerre.obj.rsp
"libs\math\build\..\src\tr1\assoc_laguerre.cpp"
-Fo"bin.v2\libs\math\build\msvc-10.0\release\link-static\runtime-link-static\threading-multi\assoc_laguerre.obj"
-Yu"pch.hpp"
-Fp"bin.v2\libs\math\build\msvc-10.0\release\link-static\runtime-link-static\threading-multi\pch.pch"
-TP
/O2
/Ob2
/W3
/GR
/MT
/Zc:forScope
/Zc:wchar_t
/wd4675
/EHs
-c
-DBOOST_ALL_NO_LIB=1
-DBOOST_BUILD_PCH_ENABLED
-DNDEBUG
"-I."
"-Ilibs\math\src\tr1"
compile-c-c++ bin.v2\libs\math\build\msvc-10.0\release\link-static\runtime-link-static\threading-multi\assoc_laguerre.obj
call "C:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86 >nul
cl /Zm800 -nologo #"bin.v2\libs\math\build\msvc-10.0\release\link-static\runtime-link-static\threading-multi\assoc_laguerre.obj.rsp"
assoc_laguerre.cpp
c1xx : fatal error C1027: Inconsistent values for /Ym between creation and use of precompiled header
That is the first instance of that error, my log file has 995 instances of the same error before the build aborts.
The contents of project-config.jam are:
import option ;
using msvc ;
option.set keep-going : false ;
using python : 3.2 : C:\\Tools\\Python\\3.2.2 ;
And the build command I used is:
b2 --toolset=msvc-10.0 --build-type=complete stage -q -d+2 -sICU_PATH="C:\Tools\ICU\4.8.1.1"
Any idea what's causing this?
Here is an explanation of the error, and here is someone who had this problem when building something else and his solution.
He modified his /Zm parameter from /Zm1000 to /Zm500 (you have /Zm800). I don't know if changing it to the same value will help you, but you can try playing with it (this compiler's flag explanation can be found here).
You can use the cxxflags command line argument to modify the compiler flags (taken from here).
Related
I have built libtorrent with boost with this commands in the boost root folder :
bootstrap.bat
b2 --hash cxxstd=14 release
and after I have added BOOST_ROOT and BOOST_BUILD_PATH to PATH variable.
I also have downloaded OpenSSL and build it then have copied to Visual studio 15 2017 compiler include and libs folder repectively.
Next in the libtorrent root folder I have run this commands:
b2 variant=release link=shared
b2 install --prefix=build
The build was successful and libtorrent c++ library has created.
and after that I have run these commands :
py setup.py build
py setup.py install
They executed with no errors and libtorrent installed in my python
libs/site-packages folder. But when I import it this error shows:
Python Import Error
[]
What build steps might I have done wrong?
Os : Windows 10 x64
Python : 3.9.5 x64
Libtorrent : 2.0.5
Boost : 1.78.0
I have followed from the libtorrent docs :
https://libtorrent.org/building.html
and
https://www.libtorrent.org/python_binding.html
What did I do ?
Basically following: https://github.com/arvidn/libtorrent/blob/master/docs/building.rst#downloading-and-building
Unzipping boost_1_78_0.zip into D:\boost_1_78_0, and running:
set BOOST_ROOT=D:\boost_1_78_0
set BOOST_BUILD_PATH=%BOOST_ROOT%\tools\build
(cd %BOOST_ROOT% && .\bootstrap.bat)
echo using msvc ; >>%HOMEDRIVE%%HOMEPATH%\user-config.jam
%BOOST_ROOT%\b2.exe --hash release
After this i got:
The Boost C++ Libraries were successfully built!
The following directory should be added to compiler include paths:
D:\boost_1_78_0
The following directory should be added to linker library paths:
D:\boost_1_78_0\stage\lib
I think this is where i started to fail, I did not read this the first time, and now I am asking meself where/how should the "compiler include paths" and "linker library paths" be set .?
When trying to compile libtorrent, using the command-line you provided (b2 msvc-14.2 variant=release link=static runtime-link=static debug-symbols=on), i got:
CXXFLAGS =
LDFLAGS =
OS = NT
building boost from source directory: D:/boost_1_78_0
Performing configuration checks
- default address-model : 64-bit (cached) [1]
- default architecture : x86 (cached) [1]
[1] msvc-14.2
...patience...
...patience...
...patience...
...found 3888 targets...
...updating 78 targets...
compile-c-c++ bin\msvc-14.2\release\cxxstd-14-iso\debug-symbols-on\link-static\runtime-link-static\threading-multi\src\hasher.obj
hasher.cpp
D:\TEMP\libtorrent\libtorrent\include\libtorrent/hasher.hpp(66): fatal error C1083: Cannot open include file: 'openssl/sha.h': No such file or directory
call "bin\standalone\msvc\msvc-14.2\msvc-setup.bat" >nul
cl /Zm800 -nologo "src\hasher.cpp" -c -Fo"bin\msvc-14.2\release\cxxstd-14-iso\debug-symbols-on\link-static\runtime-link-static\threading-multi\src\hasher.obj" -TP /bigobj /wd4251 /wd4268 /wd4275 /wd4373 /wd4503 /wd4675 /EHs /std:c++14 /GR /Zc:throwingNew /O2 /Z7 /Ob2 /W4 /MT /Zc:forScope /Zc:wchar_t /Zc:inline /Gw /favor:blend -DBOOST_ALL_NO_LIB -DBOOST_ASIO_ENABLE_CANCELIO -DBOOST_ASIO_HAS_STD_CHRONO -DBOOST_ASIO_NO_DEPRECATED -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_NO_DEPRECATED -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_SYSTEM_STATIC_LINK=1 -DNDEBUG -DOPENSSL_NO_SSL2 -DTORRENT_BUILDING_LIBRARY -DTORRENT_SSL_PEERS -DTORRENT_USE_I2P=1 -DTORRENT_USE_LIBCRYPTO -DTORRENT_USE_OPENSSL -DWIN32 -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE -D_FILE_OFFSET_BITS=64 -D_SCL_SECURE_NO_DEPRECATE -D_WIN32 -D_WIN32_WINNT=0x0600 -D__USE_W32_SOCKETS "-ID:\boost_1_78_0" "-Ideps\try_signal" "-Iinclude" "-Iinclude\libtorrent"
...failed compile-c-c++ bin\msvc-14.2\release\cxxstd-14-iso\debug-symbols-on\link-static\runtime-link-static\threading-multi\src\hasher.obj...
compile-c-c++ bin\msvc-14.2\release\cxxstd-14-iso\debug-symbols-on\link-static\runtime-link-static\threading-multi\src\merkle.obj
merkle.cpp
D:\TEMP\libtorrent\libtorrent\include\libtorrent/hasher.hpp(66): fatal error C1083: Cannot open include file: 'openssl/sha.h': No such file or directory
..... (rest of logging removed)
I found the answer.
While building libtorrent python binding 2 factors are important:
1- openSSL version
2- linking type
python comes with openssl v.1.1 (or similar based on python version) , if building python binding with openssl v.1.1 (which is the latest version while I am writing) one dependency solved otherwise, if using openssl v.3 for building 2 dependency must add to python which they are:
// 32 or 64 bits library based on openssl build
libssl-3-x64.dll
libcrypto-3-x64.dll
2 ) in the time of building python binding 2 commands can be use:
a ) simple with default parameters :
py setup.py build
py setup.py install
In this case in default libtorrent and boost-python linking static.
b ) complex one with more control (I think) :
py setup.py build_ext --b2-args="VARS" install
In the VARS place we can write boost build options but these are the one we want:
libtorrent-link=TYPE boost-link= TYPE
TYPE can be static or shared but anyone that sets shared , it becomes dependency. two files which is in need are :
// 32 and 64 bits file may have different name
// files can have different names but they are similar to below
torrent-rastarbar.dll
boost_python(PYTHON-VERSION)(SOME-INFO).dll
boost python can be find in the boost root directory in the stage/lib .
pleae note that you must build boost and libtorrent SHARED for this solution.
Conclusion :
as mentioned above these dependency must add to based on the build setting you did:
1 - OpenSSL libraries
2 - Boost python
3 - libtorrent libraries
There is an optional file that mentioned in some forums and discussion msvcr90.dll which does not effect on my project but good to point.
Put those files to a directory which can be find by python interpreter or put in project your folder and add this piece of code before imporing libtorrent :
import os
current_path = os.path.abspath(".")
# do not pass relative path like ".", pass full path
os.add_dll_directory(current_path)
Sorry for any poor english. :)
After updating my windows 10 to 1903, executing the following cmake command using CreateProcess:
command: cmd /C "cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_TOOLCHAIN_FILE="D:/vcpkg/scripts/buildsystems/vcpkg.cmake"" ..
code: CreateProcess("C:\\Windows\\System32\\cmd.exe", command, NULL, NULL, FALSE, NULL, 0, workingDir, &si, &pi))
fails to find the compiler:
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.18362.
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Configuring incomplete, errors occurred!
but succeeds (finds the correct MSVC compiler) when the exact same command is executed directly from the command prompt.
After digging through the trace, I found out that CMakeDetermineCompilerId.cmake fails when compiling CompilerIdC.vcxproj with the following:
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\CL.exe /c /I"D:\vcpkg\installed\x64-windows\include" /nologo /W0 /WX- /diagnostics:classic /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\\" /Fd"Debug\vc141.pdb" /Gd /TC /FC /errorReport:queue CMakeCCompilerId.c
FileTracker : error FTK0001: could not attach tracking. The storage
control block address is invalid.
[D:\[path redacted]\CMakeFiles\3.12.2\CompilerIdC\CompilerIdC.vcxproj]
this is the only error, all trace output before this, including versions and paths, are exactly the same as when successfully compiled from the command line.
How do I fix this error, or is this a problem with CreateProcess?
(This code works with no problems on Windows 10 1803 with the exact same compilers)
I found the answer: the Child Process Debugging extension produces this problem after the update. Disabling this extension fixes the problem.
I'm trying to build flutter desktop embedding example project
(https://github.com/google/flutter-desktop-embedding)
I stuck on fail to create some obj files
I tried to include folder (flutter_desktop_embedding\library\include)
and other "include" folders. but still keep failing.
here are the log
1>Run the embedder library's GN build
1>Done. Made 14 targets from 12 files in 16ms
1>ninja: Entering directory `E:\flutter_desktop\flutter_desktop_embedding\example\windows_fde\scripts\..\..\..\out'
1>[1/41] CXX obj/library/common/client_wrapper/src/client_wrapper.engine_method_result.obj
1>FAILED: obj/library/common/client_wrapper/src/client_wrapper.engine_method_result.obj
1>vcvars64.bat 1> nul && cl /nologo /showIncludes /MDd /FC -DUSE_FDE_TREE_PATHS -I../library/include -I.. -I../library/common/client_wrapper/include -I../third_party/jsoncpp/src/include /EHsc /W3 /Od /c ../library/common/client_wrapper/src/engine_method_result.cc /Foobj/library/common/client_wrapper/src/client_wrapper.engine_method_result.obj /Fdobj/library/common/client_wrapper/client_wrapper_c.pdb
1>CreateProcess failed: The system cannot find the file specified.
1>[2/41] CXX obj/library/common/client_wrapper/src/client_wrapper_internal.json_message_codec.obj
1>FAILED: obj/library/common/client_wrapper/src/client_wrapper_internal.json_message_codec.obj
1>vcvars64.bat 1> nul && cl /nologo /showIncludes /MDd /FC -DUSE_FDE_TREE_PATHS -DFLUTTER_DESKTOP_EMBEDDING_IMPL -I../library/include -I.. -I../library/common/client_wrapper/include -I../third_party/jsoncpp/src/include /EHsc /W3 /Od /c ../library/common/client_wrapper/src/json_message_codec.cc /Foobj/library/common/client_wrapper/src/client_wrapper_internal.json_message_codec.obj /Fdobj/library/common/client_wrapper/client_wrapper_internal_c.pdb
1>CreateProcess failed: The system cannot find the file specified.
This isn't an include path problem; the system cannot find the file specified error is while trying to launch the process.
Either you don't have vcvars64.bat in your path as described in the setup instructions, or you don't have cl.exe installed.
To figure out which problem you have, run tools/run_dart_tool doctor. It will tell you whether vcvars64.bat is in your path.
I need to build a Visual Studio 2012 project unchanged using Visual Studio 2015 and am finding that Visual Studio 2015 seems to have changed rules and now a Windows API function is deemed deprecated. I have found I can change compile options via the command line using SET CL but this command line options is being overridden.
I need to find a way to force the command line option to be used.
Here is the source code:
/*
1>e:\code\compile_cmd_line\main.cpp(15): warning C4996: 'GetVersionExA': was declared deprecated
1> c:\program files (x86)\windows kits\8.1\include\um\sysinfoapi.h(433): note: see declaration of 'GetVersionExA'
*/
// with below line uncommented, builds in Visual Studio 2015 IDE ok
// #pragma warning(disable: 4996) // error C4996: 'GetVersionExA': was declared deprecated
#include <windows.h>
int main() {
OSVERSIONINFOA vi = { };
BOOL ret = GetVersionExA(&vi);
}
The compiler options in the project file are:
/GS /GL /analyze- /W3 /Gy /Zc:wchar_t /Zi /Gm- /O2 /sdl /Fd"Release\vc140.pdb" /Zc:inline /fp:precise /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /Gd /Oy- /Oi /MD /Fa"Release\" /EHsc /nologo /Fo"Release\" /Fp"Release\compile_cmd_line.pch"
The problem settings are SDL checks /sdl and Security check /GS
Here is how I try to compile using VS2015:
E:\code\compile_cmd_line>set CL=/sdl- /GS-
E:\code\compile_cmd_line>devenv /useenv /build "Release|x86" compile_cmd_line.sln
Microsoft Visual Studio 2015 Version 14.0.25420.1.
Copyright (C) Microsoft Corp. All rights reserved.
The license for Visual Studio expires in 20 days.
1>------ Build started: Project: compile_cmd_line, Configuration: Release Win32
------
1>cl : Command line warning D9025: overriding '/sdl-' with '/GS-'
1>cl : Command line warning D9025: overriding '/GS-' with '/sdl'
1> main.cpp
1>main.cpp(20): error C4996: 'GetVersionExA': was declared deprecated
1> C:\Program Files (x86)\Windows Kits\8.1\include\um\sysinfoapi.h(433): note:
see declaration of 'GetVersionExA'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
E:\code\compile_cmd_line>
The problem lines:
1>cl : Command line warning D9025: overriding '/sdl-' with '/GS-'
1>cl : Command line warning D9025: overriding '/GS-' with '/sdl'
For completeness, I have a setup script to setup the env vars for the MS build tools:
call "%VS140COMNTOOLS%vsvars32.bat"
set INCLUDE=C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt;%INCLUDE%
set LIB=C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\um\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x86;%LIB%
Is there a better way to do this?
Can I force the override using SET CL?
I tried building SHTTPD on Windows using the following command:
nmake msvc Makefile
All i get is a bunch of errors. What am I doing wrong?
Microsoft (R) Program Maintenance Utility Version 10.00.30319.01 Copyright (C) Microsoft Corporation. All rights reserved. cl /MD /TC /nologo /DNDEBUG /Os standalone.c /link /out:shttpd.exe ws2_32.lib user32.lib advapi32.lib shell32.lib shttpd.lib standalone.c c:\users\samira\desktop\network\shttpd-1.42\src\compat_win32.h(46) : warning C4005: 'EWOULDBLOCK' : macro redefinition C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\errno.h(132) : see previous definition of 'EWOULDBLOCK' –
According to the site you link, you have to use the command
nmake win
to build on windows.
Edit From the site you linked:
Download the source package. Extract
it, go to src directory. Run "make
unix" there ("nmake win" on Windows,
requires MSVC). That buillds a
library.
Have you invoked the command from the src directory?