maya-usd icon indicating copy to clipboard operation
maya-usd copied to clipboard

Support for static Boost builds

Open OEP opened this issue 5 years ago • 2 comments

Describe the issue

Using a static build of Boost results in a linker error like the one seen below in the build log. The root cause is the build system setting BOOST_ALL_DYN_LINK which forces Boost to use the dynamic symbol names.

Build log

            Creating library D:/pkg/bfd/ext/mayaplugins/usd/build/windows_x64_msvc14_release_maya201900_python2.7/lib/mayaUsd/Release/mayaUsd.lib and object D:/pkg/bfd/ext/mayaplugins/usd/build/windows_x64_msvc14_release_maya201900_python2.7/lib/mayaUsd/Release/mayaUsd.exp
     7>proxyShapeBase.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class boost::system::error_category const & __cdecl boost::system::system_category(void)" (__imp_?system_category@system@boost@@YAAEBVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'native_ecat''(void)" (??__Enative_ecat@system@boost@@YAXXZ) [D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\lib\mayaUsd\mayaUsd.vcxproj]
     7>material.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class boost::system::error_category const & __cdecl boost::system::system_category(void)" (__imp_?system_category@system@boost@@YAAEBVerror_category@12@XZ) [D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\lib\mayaUsd\mayaUsd.vcxproj]
     7>utilFileSystem.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class boost::system::error_category const & __cdecl boost::system::system_category(void)" (__imp_?system_category@system@boost@@YAAEBVerror_category@12@XZ) [D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\lib\mayaUsd\mayaUsd.vcxproj]
     7>proxyShapeBase.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (__imp_?generic_category@system@boost@@YAAEBVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'errno_ecat''(void)" (??__Eerrno_ecat@system@boost@@YAXXZ) [D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\lib\mayaUsd\mayaUsd.vcxproj]
     7>material.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (__imp_?generic_category@system@boost@@YAAEBVerror_category@12@XZ) [D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\lib\mayaUsd\mayaUsd.vcxproj]
     7>utilFileSystem.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (__imp_?generic_category@system@boost@@YAAEBVerror_category@12@XZ) [D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\lib\mayaUsd\mayaUsd.vcxproj]
     7>proxyShapeBase.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl boost::filesystem::path_traits::convert(char const *,char const *,class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > &,class std::codecvt<wchar_t,char,struct _Mbstatet> const &)" (__imp_?convert@path_traits@filesystem@boost@@YAXPEBD0AEAV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@AEBV?$codecvt@_WDU_Mbstatet@@@5@@Z) referenced in function "private: class Autodesk::Maya::OpenMaya20190000::MStatus __cdecl pxrInternal_v0_20__pxrReserved__::MayaUsdProxyShapeBase::computeInStageDataCached(class Autodesk::Maya::OpenMaya20190000::MDataBlock &)" (?computeInStageDataCached@MayaUsdProxyShapeBase@pxrInternal_v0_20__pxrReserved__@@AEAA?AVMStatus@OpenMaya20190000@Maya@Autodesk@@AEAVMDataBlock@456@@Z) [D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\lib\mayaUsd\mayaUsd.vcxproj]
     7>material.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) void __cdecl boost::filesystem::path_traits::convert(char const *,char const *,class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > &,class std::codecvt<wchar_t,char,struct _Mbstatet> const &)" (__imp_?convert@path_traits@filesystem@boost@@YAXPEBD0AEAV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@AEBV?$codecvt@_WDU_Mbstatet@@@5@@Z) [D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\lib\mayaUsd\mayaUsd.vcxproj]
     7>utilFileSystem.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) void __cdecl boost::filesystem::path_traits::convert(char const *,char const *,class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > &,class std::codecvt<wchar_t,char,struct _Mbstatet> const &)" (__imp_?convert@path_traits@filesystem@boost@@YAXPEBD0AEAV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@AEBV?$codecvt@_WDU_Mbstatet@@@5@@Z) [D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\lib\mayaUsd\mayaUsd.vcxproj]
     7>proxyShapeBase.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __cdecl boost::filesystem::path::is_absolute(void)const " (__imp_?is_absolute@path@filesystem@boost@@QEBA_NXZ) referenced in function "private: class Autodesk::Maya::OpenMaya20190000::MStatus __cdecl pxrInternal_v0_20__pxrReserved__::MayaUsdProxyShapeBase::computeInStageDataCached(class Autodesk::Maya::OpenMaya20190000::MDataBlock &)" (?computeInStageDataCached@MayaUsdProxyShapeBase@pxrInternal_v0_20__pxrReserved__@@AEAA?AVMStatus@OpenMaya20190000@Maya@Autodesk@@AEAVMDataBlock@456@@Z) [D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\lib\mayaUsd\mayaUsd.vcxproj]
     7>proxyShapeBase.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class std::codecvt<wchar_t,char,struct _Mbstatet> const & __cdecl boost::filesystem::path::codecvt(void)" (__imp_?codecvt@path@filesystem@boost@@SAAEBV?$codecvt@_WDU_Mbstatet@@@std@@XZ) referenced in function "private: class Autodesk::Maya::OpenMaya20190000::MStatus __cdecl pxrInternal_v0_20__pxrReserved__::MayaUsdProxyShapeBase::computeInStageDataCached(class Autodesk::Maya::OpenMaya20190000::MDataBlock &)" (?computeInStageDataCached@MayaUsdProxyShapeBase@pxrInternal_v0_20__pxrReserved__@@AEAA?AVMStatus@OpenMaya20190000@Maya@Autodesk@@AEAVMDataBlock@456@@Z) [D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\lib\mayaUsd\mayaUsd.vcxproj]
     7>material.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class std::codecvt<wchar_t,char,struct _Mbstatet> const & __cdecl boost::filesystem::path::codecvt(void)" (__imp_?codecvt@path@filesystem@boost@@SAAEBV?$codecvt@_WDU_Mbstatet@@@std@@XZ) [D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\lib\mayaUsd\mayaUsd.vcxproj]
     7>utilFileSystem.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class std::codecvt<wchar_t,char,struct _Mbstatet> const & __cdecl boost::filesystem::path::codecvt(void)" (__imp_?codecvt@path@filesystem@boost@@SAAEBV?$codecvt@_WDU_Mbstatet@@@std@@XZ) [D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\lib\mayaUsd\mayaUsd.vcxproj]
     7>proxyShapeBase.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl boost::filesystem::path::~path(void)" (__imp_??1path@filesystem@boost@@QEAA@XZ) referenced in function "private: class Autodesk::Maya::OpenMaya20190000::MStatus __cdecl pxrInternal_v0_20__pxrReserved__::MayaUsdProxyShapeBase::computeInStageDataCached(class Autodesk::Maya::OpenMaya20190000::MDataBlock &)" (?computeInStageDataCached@MayaUsdProxyShapeBase@pxrInternal_v0_20__pxrReserved__@@AEAA?AVMStatus@OpenMaya20190000@Maya@Autodesk@@AEAVMDataBlock@456@@Z) [D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\lib\mayaUsd\mayaUsd.vcxproj]
     7>material.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl boost::filesystem::path::~path(void)" (__imp_??1path@filesystem@boost@@QEAA@XZ) [D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\lib\mayaUsd\mayaUsd.vcxproj]
     7>utilFileSystem.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl boost::filesystem::path::~path(void)" (__imp_??1path@filesystem@boost@@QEAA@XZ) [D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\lib\mayaUsd\mayaUsd.vcxproj]
     7>material.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: wchar_t const * __cdecl boost::filesystem::path::c_str(void)const " (__imp_?c_str@path@filesystem@boost@@QEBAPEB_WXZ) referenced in function "public: virtual void __cdecl pxrInternal_v0_20__pxrReserved__::HdVP2Material::Sync(class pxrInternal_v0_20__pxrReserved__::HdSceneDelegate *,class pxrInternal_v0_20__pxrReserved__::HdRenderParam *,unsigned int *)" (?Sync@HdVP2Material@pxrInternal_v0_20__pxrReserved__@@UEAAXPEAVHdSceneDelegate@2@PEAVHdRenderParam@2@PEAI@Z) [D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\lib\mayaUsd\mayaUsd.vcxproj]
     7>material.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const __cdecl boost::filesystem::path::string(void)const " (__imp_?string@path@filesystem@boost@@QEBA?BV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) referenced in function "public: virtual void __cdecl pxrInternal_v0_20__pxrReserved__::HdVP2Material::Sync(class pxrInternal_v0_20__pxrReserved__::HdSceneDelegate *,class pxrInternal_v0_20__pxrReserved__::HdRenderParam *,unsigned int *)" (?Sync@HdVP2Material@pxrInternal_v0_20__pxrReserved__@@UEAAXPEAVHdSceneDelegate@2@PEAVHdRenderParam@2@PEAI@Z) [D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\lib\mayaUsd\mayaUsd.vcxproj]
     7>utilFileSystem.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const __cdecl boost::filesystem::path::string(void)const " (__imp_?string@path@filesystem@boost@@QEBA?BV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) [D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\lib\mayaUsd\mayaUsd.vcxproj]
     7>material.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) private: unsigned __int64 __cdecl boost::filesystem::path::m_append_separator_if_needed(void)" (__imp_?m_append_separator_if_needed@path@filesystem@boost@@AEAA_KXZ) referenced in function "public: class boost::filesystem::path & __cdecl boost::filesystem::path::append<char [15]>(char const (&)[15])" (??$append@$$BY0P@D@path@filesystem@boost@@QEAAAEAV012@AEAY0P@$$CBD@Z) [D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\lib\mayaUsd\mayaUsd.vcxproj]
     7>material.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) private: void __cdecl boost::filesystem::path::m_erase_redundant_separator(unsigned __int64)" (__imp_?m_erase_redundant_separator@path@filesystem@boost@@AEAAX_K@Z) referenced in function "public: class boost::filesystem::path & __cdecl boost::filesystem::path::append<char [15]>(char const (&)[15])" (??$append@$$BY0P@D@path@filesystem@boost@@QEAAAEAV012@AEAY0P@$$CBD@Z) [D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\lib\mayaUsd\mayaUsd.vcxproj]
     7>material.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class boost::filesystem::path __cdecl boost::filesystem::detail::temp_directory_path(class boost::system::error_code *)" (__imp_?temp_directory_path@detail@filesystem@boost@@YA?AVpath@23@PEAVerror_code@system@3@@Z) referenced in function "public: virtual void __cdecl pxrInternal_v0_20__pxrReserved__::HdVP2Material::Sync(class pxrInternal_v0_20__pxrReserved__::HdSceneDelegate *,class pxrInternal_v0_20__pxrReserved__::HdRenderParam *,unsigned int *)" (?Sync@HdVP2Material@pxrInternal_v0_20__pxrReserved__@@UEAAXPEAVHdSceneDelegate@2@PEAVHdRenderParam@2@PEAI@Z) [D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\lib\mayaUsd\mayaUsd.vcxproj]
     7>utilFileSystem.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class boost::filesystem::path __cdecl boost::filesystem::path::parent_path(void)const " (__imp_?parent_path@path@filesystem@boost@@QEBA?AV123@XZ) referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl pxrInternal_v0_20__pxrReserved__::UsdMayaUtilFileSystem::getDir(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?getDir@UsdMayaUtilFileSystem@pxrInternal_v0_20__pxrReserved__@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV34@@Z) [D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\lib\mayaUsd\mayaUsd.vcxproj]
     7>utilFileSystem.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class boost::filesystem::path __cdecl boost::filesystem::detail::canonical(class boost::filesystem::path const &,class boost::filesystem::path const &,class boost::system::error_code *)" (__imp_?canonical@detail@filesystem@boost@@YA?AVpath@23@AEBV423@0PEAVerror_code@system@3@@Z) referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl pxrInternal_v0_20__pxrReserved__::UsdMayaUtilFileSystem::resolveRelativePathWithinMayaContext(class Autodesk::Maya::OpenMaya20190000::MObject const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?resolveRelativePathWithinMayaContext@UsdMayaUtilFileSystem@pxrInternal_v0_20__pxrReserved__@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBVMObject@OpenMaya20190000@Maya@Autodesk@@AEBV34@@Z) [D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\lib\mayaUsd\mayaUsd.vcxproj]
     7>D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\lib\mayaUsd\Release\mayaUsd.dll : fatal error LNK1120: 13 unresolved externals [D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\lib\mayaUsd\mayaUsd.vcxproj]
     7>Done Building Project "D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\lib\mayaUsd\mayaUsd.vcxproj" (default targets) -- FAILED.
    11>Done Building Project "D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\plugin\pxr\maya\lib\usdMaya\usdMaya.vcxproj" (default targets) -- FAILED.
    10>Done Building Project "D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\plugin\pxr\maya\lib\usdMaya\_usdMaya.vcxproj" (default targets) -- FAILED.
     5>Done Building Project "D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\plugin\pxr\python.vcxproj" (default targets) -- FAILED.
     4>Done Building Project "D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\plugin\adsk\plugin\mayaUsdPlugin.vcxproj" (default targets) -- FAILED.
     3>Done Building Project "D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\ALL_BUILD.vcxproj" (default targets) -- FAILED.
     1>Done Building Project "D:\pkg\bfd\ext\mayaplugins\usd\build\windows_x64_msvc14_release_maya201900_python2.7\install.vcxproj" (default targets) -- FAILED.

Specs:

  • Windows 10
  • Visual Studio 2017
  • Maya version: Maya 2019
  • Maya USD commit SHA: 62037f387 (0.5.0)
  • Pixar USD commit SHA: 71b4baace (20.08)

Additional context

To work around, you can just delete the define.

OEP avatar Nov 04 '20 23:11 OEP

@OEP We can wrap this compiler definition around a flag that can be controlled via CMake option. Something like this:

option(BUILD_WITH_STATIC_BOOST "Build with static boost." OFF)

Would that help?

HamedSabri-adsk avatar Nov 11 '20 23:11 HamedSabri-adsk

@HamedSabri-adsk That'd probably do the trick, but it may be worth using Boost::dynamic_linking import target from FindBoost.cmake since that seems to be what would set that for you (still learning CMake over here...)

Either way, having an option works for me.

OEP avatar Nov 12 '20 02:11 OEP