Vs2022 compilation error on Windows
OS=windows11 toolset=msvc-14.3 OpenSSL=OpenSSL3.0.1 boost=boost_1_78_0 libtorrent=2.05
C:\msys64\home\Administrator\libtorrent-rasterbar-2.0.5>python setup.py build_ext --b2-args="toolset=msvc-14.3 openssl-lib=D:/OpenSSL3.0/lib/x86 openssl-include=D:/OpenSSL3.0/include warnings-as-errors=on"
running build_ext
project-config.jam contents:
import feature ;
feature.feature libtorrent-python : on ;
using python : 3.8 : "D:\Python38-32\python.exe" : "D:\Python38-32\Include" "D:\Python38-32\Include" : :
b2 toolset=msvc-14.3 openssl-lib=D:/OpenSSL3.0/lib/x86 openssl-include=D:/OpenSSL3.0/include warnings-as-errors=on --abbreviate-paths boost-link=static libtorrent-link=static crypto=openssl deprecated-functions=on variant=release address-model=32 python=3.8 libtorrent-python=on python-install-path=C:\msys64\home\Administrator\libtorrent-rasterbar-2.0.5\bindings\python\build\lib.win32-3.8 install_module --project-config=C:\Users\ADMINI~1\AppData\Local\Temp\tmp02zvrvx8 CXXFLAGS = LDFLAGS = OS = NT building boost from source directory: D:\boost_1_78_0 CXXFLAGS = LDFLAGS = Performing configuration checks
- default address-model : 64-bit (cached) [1]
- default architecture : x86 (cached) [1]
[1] msvc-14.3 ...patience... ...patience... ...patience... ...patience... ...found 9203 targets... ...updating 6 targets... compile-c-c++ bin\msvc-14.3\rls\adrs-mdl-32\cxstd-14-iso\pythn-3.8\thrd-mlt\src\peer_info.obj peer_info.cpp src\peer_info.cpp(124): error C2220: 以下警告被视为错误 src\peer_info.cpp(124): warning C4996: 'libtorrent::peer_info::queued': 被声明为已否决 src\peer_info.cpp(153): warning C4996: 'libtorrent::peer_info::bw_torrent': 被声明为已否决 src\peer_info.cpp(154): warning C4996: 'libtorrent::peer_info::bw_global': 被声明为已否决
call "..\..\bin\standalone\msvc\msvc-14.3\adrs-mdl-32\msvc-setup.bat" >nul
cl /Zm800 -nologo "src\peer_info.cpp" -c -Fo"bin\msvc-14.3\rls\adrs-mdl-32\cxstd-14-iso\pythn-3.8\thrd-mlt\src\peer_info.obj" -TP /bigobj /wd4268 /wd4675 /EHs /std:c++14 /GR /Zc:throwingNew /O2 /Ob2 /W3 /WX /MD /Zc:forScope /Zc:wchar_t /Zc:inline /Gw -DBOOST_ALL_NO_LIB -DBOOST_ASIO_ENABLE_CANCELIO -DBOOST_ASIO_HAS_STD_CHRONO -DBOOST_ASIO_NO_DEPRECATED -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_PYTHON_STATIC_LIB -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_SYSTEM_STATIC_LINK=1 -DNDEBUG -DOPENSSL_NO_SSL2 -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 "-I....\deps\try_signal" "-I....\include" "-I....\include\libtorrent" "-ID:\OpenSSL3.0\include" "-ID:\Python38-32\Include" "-ID:\boost_1_78_0" "-Isrc"
...failed compile-c-c++ bin\msvc-14.3\rls\adrs-mdl-32\cxstd-14-iso\pythn-3.8\thrd-mlt\src\peer_info.obj... compile-c-c++ bin\msvc-14.3\rls\adrs-mdl-32\cxstd-14-iso\pythn-3.8\thrd-mlt\src\session_settings.obj session_settings.cpp src\session_settings.cpp(99): error C2220: 以下警告被视为错误 src\session_settings.cpp(99): warning C4996: 'libtorrent::dht::dht_settings': 被声明为已否决 src\session_settings.cpp(100): warning C4996: 'libtorrent::dht::dht_settings': 被声明为已否决 src\session_settings.cpp(101): warning C4996: 'libtorrent::dht::dht_settings': 被声明为已否决 src\session_settings.cpp(102): warning C4996: 'libtorrent::dht::dht_settings': 被声明为已否决 src\session_settings.cpp(103): warning C4996: 'libtorrent::dht::dht_settings': 被声明为已否决 src\session_settings.cpp(104): warning C4996: 'libtorrent::dht::dht_settings': 被声明为已否决 src\session_settings.cpp(105): warning C4996: 'libtorrent::dht::dht_settings': 被声明为已否决 src\session_settings.cpp(106): warning C4996: 'libtorrent::dht::dht_settings': 被声明为已否决 src\session_settings.cpp(107): warning C4996: 'libtorrent::dht::dht_settings': 被声明为已否决 src\session_settings.cpp(108): warning C4996: 'libtorrent::dht::dht_settings': 被声明为已否决 src\session_settings.cpp(109): warning C4996: 'libtorrent::dht::dht_settings': 被声明为已否决 src\session_settings.cpp(110): warning C4996: 'libtorrent::dht::dht_settings': 被声明为已否决 src\session_settings.cpp(111): warning C4996: 'libtorrent::dht::dht_settings': 被声明为已否决 src\session_settings.cpp(112): warning C4996: 'libtorrent::dht::dht_settings': 被声明为已否决 src\session_settings.cpp(113): warning C4996: 'libtorrent::dht::dht_settings': 被声明为已否决 src\session_settings.cpp(114): warning C4996: 'libtorrent::dht::dht_settings': 被声明为已否决 src\session_settings.cpp(115): warning C4996: 'libtorrent::dht::dht_settings': 被声明为已否决 src\session_settings.cpp(116): warning C4996: 'libtorrent::dht::dht_settings': 被声明为已否决 src\session_settings.cpp(122): warning C4996: 'libtorrent::pe_settings': 被声明为已否决 src\session_settings.cpp(122): warning C4996: 'libtorrent::pe_settings': 被声明为已否决
call "..\..\bin\standalone\msvc\msvc-14.3\adrs-mdl-32\msvc-setup.bat" >nul
cl /Zm800 -nologo "src\session_settings.cpp" -c -Fo"bin\msvc-14.3\rls\adrs-mdl-32\cxstd-14-iso\pythn-3.8\thrd-mlt\src\session_settings.obj" -TP /bigobj /wd4268 /wd4675 /EHs /std:c++14 /GR /Zc:throwingNew /O2 /Ob2 /W3 /WX /MD /Zc:forScope /Zc:wchar_t /Zc:inline /Gw -DBOOST_ALL_NO_LIB -DBOOST_ASIO_ENABLE_CANCELIO -DBOOST_ASIO_HAS_STD_CHRONO -DBOOST_ASIO_NO_DEPRECATED -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_PYTHON_STATIC_LIB -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_SYSTEM_STATIC_LINK=1 -DNDEBUG -DOPENSSL_NO_SSL2 -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 "-I....\deps\try_signal" "-I....\include" "-I....\include\libtorrent" "-ID:\OpenSSL3.0\include" "-ID:\Python38-32\Include" "-ID:\boost_1_78_0" "-Isrc"
...failed compile-c-c++ bin\msvc-14.3\rls\adrs-mdl-32\cxstd-14-iso\pythn-3.8\thrd-mlt\src\session_settings.obj... compile-c-c++ bin\msvc-14.3\rls\adrs-mdl-32\cxstd-14-iso\pythn-3.8\thrd-mlt\src\magnet_uri.obj magnet_uri.cpp src\magnet_uri.cpp(30): error C2220: 以下警告被视为错误 src\magnet_uri.cpp(30): warning C4996: 'libtorrent::add_torrent_params::url': 被声明为已否决 src\magnet_uri.cpp(72): warning C4996: 'libtorrent::add_torrent_params::url': 被声明为已否决
call "..\..\bin\standalone\msvc\msvc-14.3\adrs-mdl-32\msvc-setup.bat" >nul
cl /Zm800 -nologo "src\magnet_uri.cpp" -c -Fo"bin\msvc-14.3\rls\adrs-mdl-32\cxstd-14-iso\pythn-3.8\thrd-mlt\src\magnet_uri.obj" -TP /bigobj /wd4268 /wd4675 /EHs /std:c++14 /GR /Zc:throwingNew /O2 /Ob2 /W3 /WX /MD /Zc:forScope /Zc:wchar_t /Zc:inline /Gw -DBOOST_ALL_NO_LIB -DBOOST_ASIO_ENABLE_CANCELIO -DBOOST_ASIO_HAS_STD_CHRONO -DBOOST_ASIO_NO_DEPRECATED -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_PYTHON_STATIC_LIB -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_SYSTEM_STATIC_LINK=1 -DNDEBUG -DOPENSSL_NO_SSL2 -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 "-I....\deps\try_signal" "-I....\include" "-I....\include\libtorrent" "-ID:\OpenSSL3.0\include" "-ID:\Python38-32\Include" "-ID:\boost_1_78_0" "-Isrc"
...failed compile-c-c++ bin\msvc-14.3\rls\adrs-mdl-32\cxstd-14-iso\pythn-3.8\thrd-mlt\src\magnet_uri.obj...
...skipped <pbin\msvc-14.3\rls\adrs-mdl-32\cxstd-14-iso\pythn-3.8\thrd-mlt>libtorrent.cp38-win32.pyd for lack of <pbin\msvc-14.3\rls\adrs-mdl-32\cxstd-14-iso\pythn-3.8\thrd-mlt>src\session_settings.obj...
...skipped pC:\msys64\home\Administrator\libtorrent-rasterbar-2.0.5\bindings\python\build\lib.win32-3.8libtorrent.cp38-win32.pyd for lack of <pbin\msvc-14.3\rls\adrs-mdl-32\cxstd-14-iso\pythn-3.8\thrd-mlt>libtorrent.cp38-win32.pyd...
...failed updating 3 targets...
...skipped 2 targets...
Traceback (most recent call last):
File "setup.py", line 6, in
can you translate those error messages to english?
github recently updated their msvc version and I made some updates accordingly. Could you try the RC_2_0 branch?
C2220: 以下警告被视为错误 error C2220: warning treated as error
C4996 被声明为已否决 warning C4996: was declared deprecated
I'm using VS2022 have no problem compiling with deprecated-functions DEFAULT ON via cmake.
Option /WX- should disable C2220 or don't use /WX to compile. Or /WX:NO
C2220:
以下警告被视为错误error C2220: warning treated as error C4996被声明为已否决warning C4996: was declared deprecated I'm using VS2022 have no problem compiling withdeprecated-functions DEFAULT ONvia cmake.Option /WX- should disable C2220 or don't use /WX to compile. Or /WX:NO
C2220:错误 C2220:警告被视为错误 C4996 警告 C4996:已声明弃用 我正在使用 VS2022 通过 cmake 进行编译没有问题。
以下警告被视为错误``被声明为已否决``deprecated-functions DEFAULT ON
C:\Users\Administrator\Downloads\libtorrent-RC_2_0>python setup.py build_ext --b2-args="openssl-lib=D:/OpenSSL3.0/lib/x86 openssl-include=D:/OpenSSL3.0/include warnings-as-errors=on"
running build_ext
project-config.jam contents:
import feature ;
feature.feature libtorrent-python : on ;
using python : 3.8 : "D:\Python38-32\python.exe" : "D:\Python38-32\Include" "D:\Python38-32\Include" : :
b2 openssl-lib=D:/OpenSSL3.0/lib/x86 openssl-include=D:/OpenSSL3.0/include warnings-as-errors=on --abbreviate-paths boost-link=static libtorrent-link=static crypto=openssl deprecated-functions=on variant=release address-model=32 python=3.8 libtorrent-python=on python-install-path=C:\Users\Administrator\Downloads\libtorrent-RC_2_0\bindings\python\build\lib.win32-3.8 install_module --project-config=C:\Users\ADMINI~1\AppData\Local\Temp\tmpu9p9we2y CXXFLAGS = LDFLAGS = OS = NT building boost from source directory: D:\boost_1_78_0 CXXFLAGS = LDFLAGS = D:/boost_1_78_0/tools/build/src/build\project.jam:259: in find-jamfile from module project error: Unable to load Jamfile. error: Could not find a Jamfile in directory '../../deps/try_signal'. error: Attempted to find it with pattern '[Bb]uild.jam [Jj]amfile.v2 [Jj]amfile [Jj]amfile. [Jj]amfile.jam'. error: Please consult the documentation at 'https://www.bfgroup.xyz/b2/'. D:/boost_1_78_0/tools/build/src/build\project.jam:322: in load-jamfile from module project D:/boost_1_78_0/tools/build/src/build\project.jam:64: in load from module project D:/boost_1_78_0/tools/build/src/build\project.jam:89: in load-used-projects from module project D:/boost_1_78_0/tools/build/src/build\project.jam:75: in load from module project D:/boost_1_78_0/tools/build/src/build\project.jam:109: in load-parent from module project D:/boost_1_78_0/tools/build/src/build\project.jam:513: in initialize from module project D:/boost_1_78_0/tools/build/src/build\project.jam:348: in load-jamfile from module project D:/boost_1_78_0/tools/build/src/build\project.jam:64: in load from module project D:/boost_1_78_0/tools/build/src/build\project.jam:142: in project.find from module project D:/boost_1_78_0/tools/build/src\build-system.jam:618: in load from module build-system D:/boost_1_78_0/tools/build/src/kernel\modules.jam:294: in import from module modules D:/boost_1_78_0/tools/build/src/kernel/bootstrap.jam:139: in boost-build from module D:/boost_1_78_0/tools/build/boost-build.jam:8: in module scope from module
you need to clone the submodules too. run this:
git submodule update init --recursive
submodule update init --recursive python main.py Traceback (most recent call last): File "main.py", line 1, in
import libtorrent as lt ImportError: DLL load failed while importing libtorrent: 找不到指定的模块。 C:\Users\Administrator\Downloads\libtorrent-rasterbar-2.0.5>python setup.py install running install running bdist_egg running egg_info creating libtorrent.egg-info writing libtorrent.egg-info\PKG-INFO writing dependency_links to libtorrent.egg-info\dependency_links.txt writing top-level names to libtorrent.egg-info\top_level.txt writing manifest file 'libtorrent.egg-info\SOURCES.txt' reading manifest file 'libtorrent.egg-info\SOURCES.txt' writing manifest file 'libtorrent.egg-info\SOURCES.txt' installing library code to build\bdist.win32\egg running install_lib running build_ext project-config.jam contents: import feature ; feature.feature libtorrent-python : on ; using python : 3.8 : "D:\Python38-32\python.exe" : "D:\Python38-32\Include" "D:\Python38-32\Include" : : on : ".cp38-win32" ;
b2 --abbreviate-paths boost-link=static libtorrent-link=static crypto=openssl deprecated-functions=on variant=release address-model=32 python=3.8 libtorrent-python=on python-install-path=C:\Users\Administrator\Downloads\libtorrent-rasterbar-2.0.5\bindings\python\build\lib.win32-3.8 install_module --project-config=C:\Users\ADMINI~1\AppData\Local\Temp\tmpmdira42c CXXFLAGS = LDFLAGS = OS = NT building boost from source directory: D:\boost_1_78_0 CXXFLAGS = LDFLAGS = warning: No toolsets are configured. warning: Configuring default toolset "msvc". warning: If the default is wrong, your build may not work correctly. warning: Use the "toolset=xxxxx" option to override our guess. warning: For more configuration options, please consult warning: https://www.bfgroup.xyz/b2/manual/release/index.html#bbv2.overview.configuration Performing configuration checks
- default address-model : 64-bit (cached) [1]
- default architecture : x86 (cached) [1]
[1] msvc-14.3 ...patience... ...patience... ...patience... ...patience... ...found 9085 targets... creating build\bdist.win32 creating build\bdist.win32\egg copying build\lib.win32-3.8\libtorrent.cp38-win32.pyd -> build\bdist.win32\egg creating stub loader for libtorrent.cp38-win32.pyd byte-compiling build\bdist.win32\egg\libtorrent.py to libtorrent.cpython-38.pyc creating build\bdist.win32\egg\EGG-INFO copying libtorrent.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFO copying libtorrent.egg-info\SOURCES.txt -> build\bdist.win32\egg\EGG-INFO copying libtorrent.egg-info\dependency_links.txt -> build\bdist.win32\egg\EGG-INFO copying libtorrent.egg-info\top_level.txt -> build\bdist.win32\egg\EGG-INFO writing build\bdist.win32\egg\EGG-INFO\native_libs.txt zip_safe flag not set; analyzing archive contents... pycache.libtorrent.cpython-38: module references file creating dist creating 'dist\libtorrent-2.0.5-py3.8-win32.egg' and adding 'build\bdist.win32\egg' to it removing 'build\bdist.win32\egg' (and everything under it) Processing libtorrent-2.0.5-py3.8-win32.egg creating d:\python38-32\lib\site-packages\libtorrent-2.0.5-py3.8-win32.egg Extracting libtorrent-2.0.5-py3.8-win32.egg to d:\python38-32\lib\site-packages Adding libtorrent 2.0.5 to easy-install.pth file
Installed d:\python38-32\lib\site-packages\libtorrent-2.0.5-py3.8-win32.egg Processing dependencies for libtorrent==2.0.5 Finished processing dependencies for libtorrent==2.0.5
is there something that still isn't resolved here?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.