-
Notifications
You must be signed in to change notification settings - Fork 22.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues with building Libtorch with /MTd in Windows #46318
Comments
Please try the following commands. cd %PYTORCH_ROOT%
set BUILD_SHARED_LIBS=OFF
set DEBUG=1
for /f "usebackq tokens=*" %i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version [15^,16^) -products * -latest -property installationPath`) do call "%i\VC\Auxiliary\Build\vcvarsall.bat" x64 -vcvars_ver=14.27
set CL=/DFBGEMM_STATIC#1
python tools\build_libtorch.py |
@peterjc123 : Thanks but I'm getting this error :
Full message looks like this:
whats wrong here? |
Googling the error leads to this : #39848 as well. I'm not sure how to go about this. Seems the static libs werent successful there either. Update:
Could this indicate a bug in the cmake itself? it seems, setting Debug or Relase to 0 or 1 doesnt change the way cmake config is built. in either case, Debug or Release is used if its set with either value (i.e. if Debug=0/1, the debug config will be issued, and if Rlease=0/1, release config will be issued by cmake.
|
@peterjc123 I could really appreciate a feedback on this. |
@Coderx7 I guess you might try the RelWithDebInfo builds by |
@peterjc123 Thanks a lot will test it right now. |
@peterjc123 Sadly this failed as well with the
Anyway is there a way to ditch the static build and instead just like the dynamic one, build with MT but for debug? clearly this worked for the release dlls. so I guess I should be able to do so with debug as well. whats different here that makes it not work readily? UPDATE:
Also I noticed the build was not built as debug as the protobuf libs wherent built for debug (didnt have |
Hi @peterjc123 : Should I assume, there is no way to get MTd to work with libtorch? |
@Coderx7 I feel sorry about it but the answer is yes for now. |
@peterjc123 Thanks a lot peter. really appreciate your kind help so far. I'm greatful. |
Hi @Coderx7 , I am closing this issue since the discussion has came to an end. Please feel free to open a new issue if you encounter a bug or have a feature request in the future. |
🐛 Bug
DLLs cant be built as Debug configuration with
/MTd
under windows.Creating staticly built libs under windows is also problamatic. and generates wierd linker issues.
@peterjc123 kindly suggested to build static libs this way :
This results in the following errors :
Creating a Debug configuration with
/MTd
using normal cmake (i.e. generating visual studio solution from cmake by doing this and then making all libs build as/MTd
) also results in the very same linker issues.Building with
/MT
for release configuration works though but for debug it fails.Building with
/MD
and/MDd
work just fine both for dynamic and static libs.Trying something like
cmake -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded$<$<CONFIG:Debug>:Debug>" ..
didnt work either.This is an example showing how this fails. The solution is created using cmake and we are building dynamic libs (dlls) :
To Reproduce
Steps to reproduce the behavior:
1.Simply try to build a Pytorch 1.6 branch Debug configurations with
/MTd
under windows (both static and dynamic ones)Expected behavior
Should be able to build properly without any issues.
Environment
Please copy and paste the output from our
environment collection script
(or fill out the checklist below manually).
You can get the script and run it with:
Additional context
please note that Pytorch 1.6 needs to be patched when using Visual C++. See oneapi-src/oneDNN#812 .(This is fixed in master though).
cc @malfet @seemethere @walterddr @peterjc123 @maxluk @nbcsm @guyang3532 @gunandrose4u @smartcat2010 @mszhanyi
The text was updated successfully, but these errors were encountered: