BachiLi / diffvg

Differentiable Vector Graphics Rasterization
https://people.csail.mit.edu/tzumao/diffvg/
Apache License 2.0
923 stars 155 forks source link

Windows build fail #14

Open jemx opened 3 years ago

jemx commented 3 years ago

Hey there,

I tried to compile this project under Windows 10, but sadly wasn't able to do so.

At first glance, Visual Studio tries to compile the project but fails with the following error:

  diffvg.cpp
  CMake Error at diffvg_generated_diffvg.cpp.obj.Release.cmake:280 (message):
    Error generating file
    [...]/diffvg/build/temp.win-amd64-3.8/Release/CMakeFiles/diffvg.dir//Release/diffvg_generated_diffvg.cpp.obj

My enviroment is a Windows 10 with a Python 3.8.5, Annaconda 2020.11, Visual Studio 2019, Visual Studio Build Tool 2017.

Have I missed something? Do you need any more information?

Thanks in advance!

marcdownie commented 3 years ago

Some more information (or, rather, the errors and versions of things leading up to this message):

PS C:\Users\marc\temp\diffvg> python .\setup.py install
running install
running bdist_egg
running egg_info
writing diffvg.egg-info\PKG-INFO
writing dependency_links to diffvg.egg-info\dependency_links.txt
writing requirements to diffvg.egg-info\requires.txt
writing top-level names to diffvg.egg-info\top_level.txt
reading manifest file 'diffvg.egg-info\SOURCES.txt'
writing manifest file 'diffvg.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
Re-run cmake no build system arguments
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.20279.
-- pybind11 v2.6.0 dev
-- Using pybind11: (version "2.6.0" dev)
-- Build with CUDA support
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/marc/temp/diffvg/build/temp.win-amd64-3.7/Release
Microsoft (R) Build Engine version 16.8.2+25e4d540b for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 12/27/2020 9:34:48 PM.
     1>Project "C:\Users\marc\temp\diffvg\build\temp.win-amd64-3.7\Release\ALL_BUILD.vcxproj" on node 1 (default targets).
     1>Project "C:\Users\marc\temp\diffvg\build\temp.win-amd64-3.7\Release\ALL_BUILD.vcxproj" (1) is building "C:\Users\marc\temp\diffvg\build\temp.win-amd64-3.7\Release\ZERO_CHECK.vcxproj" (2) on node 1 (default targets).
     2>InitializeBuildStatus:
         Creating "x64\Release\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
       CustomBuild:
         All outputs are up-to-date.
         Checking Build System
       FinalizeBuildStatus:
         Deleting file "x64\Release\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild".
         Touching "x64\Release\ZERO_CHECK\ZERO_CHECK.tlog\ZERO_CHECK.lastbuildstate".
     2>Done Building Project "C:\Users\marc\temp\diffvg\build\temp.win-amd64-3.7\Release\ZERO_CHECK.vcxproj" (default targets).
     1>Project "C:\Users\marc\temp\diffvg\build\temp.win-amd64-3.7\Release\ALL_BUILD.vcxproj" (1) is building "C:\Users\marc\temp\diffvg\build\temp.win-amd64-3.7\Release\diffvg.vcxproj" (3) on node 2 (default targets).
     3>InitializeBuildStatus:
         Touching "diffvg.dir\Release\diffvg.tlog\unsuccessfulbuild".
       CustomBuild:
         Building NVCC (Device) object CMakeFiles/diffvg.dir/Release/diffvg_generated_diffvg.cpp.obj
         diffvg.cpp
     3>C:\Users\marc\temp\diffvg\pybind11\include\pybind11\cast.h(1041): warning : pointless comparison of unsigned integer with zero [C:\Users\marc\temp\diffvg\build\temp.win-amd64-3.7\Release\diffvg.vcxproj]
                   detected during:
                     instantiation of "__nv_bool pybind11::detail::type_caster<T, std::enable_if_t<<expression>, void>>::load(pybind11::handle, __nv_bool) [with T=pybind11::detail::intrinsic_t<size_t>]"
         (2004): here
                     instantiation of "__nv_bool pybind11::detail::argument_loader<Args...>::load_impl_sequence(pybind11::detail::function_call &, std::index_sequence<Is...>) [with Args=<pybind11::detail::value_and_holder &, size_t>, Is=<0ULL, 1ULL>]"
         (1980): here
                     instantiation of "__nv_bool pybind11::detail::argument_loader<Args...>::load_args(pybind11::detail::function_call &) [with Args=<pybind11::detail::value_and_holder &, size_t>]"
         C:/Users/marc/temp/diffvg/pybind11/include\pybind11/pybind11.h(159): here
                     instantiation of "void pybind11::cpp_function::initialize(Func &&, Return (*)(Args...), const Extra &...) [with Func=lambda [](pybind11::detail::value_and_holder &, size_t)->void, Return=void, Args=<pybind11::detail::value_and_holder &, size_t>, Extra=<pybind11::name, pybind11::is_m
         ethod, pybind11::sibling, pybind11::detail::is_new_style_constructor>]"
         C:/Users/marc/temp/diffvg/pybind11/include\pybind11/pybind11.h(72): here
                     instantiation of "pybind11::cpp_function::cpp_function(Func &&, const Extra &...) [with Func=lambda [](pybind11::detail::value_and_holder &, size_t)->void, Extra=<pybind11::name, pybind11::is_method, pybind11::sibling, pybind11::detail::is_new_style_constructor>, <unnamed>=void]"
         C:/Users/marc/temp/diffvg/pybind11/include\pybind11/pybind11.h(1162): here
                     instantiation of "pybind11::class_<type_, options...> &pybind11::class_<type_, options...>::def(const char *, Func &&, const Extra &...) [with type_=ptr<void>, options=<>, Func=lambda [](pybind11::detail::value_and_holder &, size_t)->void, Extra=<pybind11::detail::is_new_style_const
         ructor>]"
         C:\Users\marc\temp\diffvg\pybind11\include\pybind11\detail/init.h(176): here
                     instantiation of "void pybind11::detail::initimpl::constructor<Args...>::execute(Class &, const Extra &...) [with Args=<size_t>, Class=pybind11::class_<ptr<void>>, Extra=<>, <unnamed>=0]"
         C:/Users/marc/temp/diffvg/pybind11/include\pybind11/pybind11.h(1191): here
                     instantiation of "pybind11::class_<type_, options...> &pybind11::class_<type_, options...>::def(const pybind11::detail::initimpl::constructor<Args...> &, const Extra &...) [with type_=ptr<void>, options=<>, Args=<size_t>, Extra=<>]"
         C:/Users/marc/temp/diffvg/diffvg.cpp(1655): here

         ptxas fatal   : Unresolved extern function '_Z3powfi'
         diffvg.cpp
         CMake Error at diffvg_generated_diffvg.cpp.obj.Release.cmake:280 (message):
           Error generating file
           C:/Users/marc/temp/diffvg/build/temp.win-amd64-3.7/Release/CMakeFiles/diffvg.dir//Release/diffvg_generated_diffvg.cpp.obj

     3>C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(238,5): error MSB8066: Custom build for 'C:\Users\marc\temp\diffvg\diffvg.cpp;C:\Users\marc\temp\diffvg\scene.cpp' exited with code 1. [C:\Users\marc\temp\diffvg\build\temp.win-amd
       64-3.7\Release\diffvg.vcxproj]
     3>Done Building Project "C:\Users\marc\temp\diffvg\build\temp.win-amd64-3.7\Release\diffvg.vcxproj" (default targets) -- FAILED.
     1>Done Building Project "C:\Users\marc\temp\diffvg\build\temp.win-amd64-3.7\Release\ALL_BUILD.vcxproj" (default targets) -- FAILED.

Build FAILED.

       "C:\Users\marc\temp\diffvg\build\temp.win-amd64-3.7\Release\ALL_BUILD.vcxproj" (default target) (1) ->
       "C:\Users\marc\temp\diffvg\build\temp.win-amd64-3.7\Release\diffvg.vcxproj" (default target) (3) ->
       (CustomBuild target) ->
         C:\Users\marc\temp\diffvg\pybind11\include\pybind11\cast.h(1041): warning : pointless comparison of unsigned integer with zero [C:\Users\marc\temp\diffvg\build\temp.win-amd64-3.7\Release\diffvg.vcxproj]

       "C:\Users\marc\temp\diffvg\build\temp.win-amd64-3.7\Release\ALL_BUILD.vcxproj" (default target) (1) ->
       "C:\Users\marc\temp\diffvg\build\temp.win-amd64-3.7\Release\diffvg.vcxproj" (default target) (3) ->
       (CustomBuild target) ->
         C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(238,5): error MSB8066: Custom build for 'C:\Users\marc\temp\diffvg\diffvg.cpp;C:\Users\marc\temp\diffvg\scene.cpp' exited with code 1. [C:\Users\marc\temp\diffvg\build\temp.win-a
       md64-3.7\Release\diffvg.vcxproj]

    1 Warning(s)
    1 Error(s)
marcdownie commented 3 years ago

Moving from Visual Studio 2019 back to 2017 fixes this problem; although I suspect the real issue is in CUDA 11.2's broken 2019 integration.

kjerk commented 3 years ago

Moving from Visual Studio 2019 back to 2017 fixes this problem; although I suspect the real issue is in CUDA 11.2's broken 2019 integration.

Were you actually able to get it to fully install? Even when I've used VS2019, 2017, Build Tools, etc the module is never fully available after a build :\

marcdownie commented 3 years ago

I did, in fact, get the module built with 2017 --- it is possible!

On Thu, Jan 28, 2021 at 4:56 PM Keith Kjer notifications@github.com wrote:

Moving from Visual Studio 2019 back to 2017 fixes this problem; although I suspect the real issue is in CUDA 11.2's broken 2019 integration.

Were you actually able to get it to fully install? Even when I've used VS2019, 2017, Build Tools, etc the module is never fully available after a build :\

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/BachiLi/diffvg/issues/14#issuecomment-769453729, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABBHRKX23ENRDKD2MX3RDTS4HTR7ANCNFSM4VHKU7XQ .

MaxGodTier commented 3 years ago

I did, in fact, get the module built with 2017 --- it is possible!

Did you actually test it? Does it work if you go to diffvg\apps and run python finite_difference_comp.py imgs/tiger.svg ? I can get it to build, but it's not working, I get the same problem as https://github.com/BachiLi/diffvg/issues/12

surjikal commented 2 years ago

In the interim, try a debug build, it worked for me. You'll need to have all the python debug headers & friends installed (there are checkboxes for these in the python installer).

python .\setup.py --debug install
bfrasure commented 2 years ago

how does one target 2017 build?

thuangb commented 2 years ago

I think that the cuda pow function is the culprit because the old pow function of cuda has been changed to powf now so if you use old cuda or old visual studio may be you can compile. However, I trace back to the error and found no pow function being used which is weird. Can anyone confirm this?