ChaosGroup / blender_with_vray_additions

Blender with patches for V-Ray *.vrscene export
Other
28 stars 13 forks source link

Can't build the current source (VS2017) #241

Closed philstopford closed 5 years ago

philstopford commented 5 years ago

I am not certain whether the build instructions are up to date. I was hoping to get a local build set up here. I can easily build regular blender with my development environment, but the V-ray version seems to fail with many linker errors (unresolved symbols), across OpenColorIO, OSL,

I followed the instructions to clone the repository and ensured I have the external libraries (zmq, libsodium) in-place and this doesn't look related. I'm building against the blender.org libs package for vc14 x64, which would seem to be valid.

Over 118 linker errors are reported when I try to build the current source.

Is VS2017 supported?

bdancer commented 5 years ago

Is VS2017 supported?

We do not add any restrictions to compiler versions. If Blender supports VS2017 then it's supported. As mentioned here https://wiki.blender.org/wiki/Building_Blender

MS-Windows/MSVC: | 2013 | 2013

only 2013 is supported.

philstopford commented 5 years ago

No - VS2017 is supported : https://wiki.blender.org/wiki/Building_Blender/Windows#Visual_Studio

bdancer commented 5 years ago

Ok, then what are the errors?

philstopford commented 5 years ago

Building the INSTALL project seems to hide these errors from review (or at least make finding the error report much more difficult). Building 'blender' results in this :

build.log

bdancer commented 5 years ago

Ok, this seems like a bug in our linking related to 2017 libs, however, since we're successfully building the project with 2013 compiler I'm not sure if we gonna fix this in near future.

philstopford commented 5 years ago

Massaging the master, I now only have these errors in the build with VS 2017:

Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol "declspec(dllimport) public: unsigned int64 cdecl OSL_v1_9::OSLQuery::nparams(void)const " (imp_?nparams@OSLQuery@OSL_v1_9@@QEBA_KXZ) referenced in function "struct _object __cdecl vfb_osl_update_node_func(struct _object ,struct _object )" (?vfb_osl_update_node_func@@YAPEAU_object@@PEAU1@0@Z) blender D:\development\blender-git\b_v\source\creator\vray_for_blender_rt.lib(vfb_python_api.obj) 1
Error LNK2001 unresolved external symbol "declspec(dllimport) public: unsigned int64 cdecl OSL_v1_9::OSLQuery::nparams(void)const " (imp_?nparams@OSLQuery@OSL_v1_9@@QEBA_KXZ) blender D:\development\blender-git\b_v\source\creator\vray_for_blender_rt.lib(vfb_export_shader.obj) 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: struct OSL_v1_9::OSLQuery::Parameter const
cdecl OSL_v1_9::OSLQuery::getparam(unsigned int64)const " (imp_?getparam@OSLQuery@OSL_v1_9@@QEBAPEBUParameter@12@_K@Z) referenced in function "struct _object __cdecl vfb_osl_update_node_func(struct _object ,struct _object *)" (?vfb_osl_update_node_func@@YAPEAU_object@@PEAU1@0@Z) blender D:\development\blender-git\b_v\source\creator\vray_for_blender_rt.lib(vfb_python_api.obj) 1
Error LNK2001 unresolved external symbol "
declspec(dllimport) public: struct OSL_v1_9::OSLQuery::Parameter const * cdecl OSL_v1_9::OSLQuery::getparam(unsigned int64)const " (_imp?getparam@OSLQuery@OSL_v1_9@@QEBAPEBUParameter@12@_K@Z) blender D:\development\blender-git\b_v\source\creator\vray_for_blender_rt.lib(vfb_export_shader.obj) 1
Error LNK1120 2 unresolved externals blender D:\development\blender-git\b_v\bin\Release\blender.exe 1

philstopford commented 5 years ago

I noticed that you merged master recently; did that help with the VS2017 compile side of things? It looks like I'm still bumping against libsodium/libzeromq linking issues that I'm not sure how to resolve.

poseidon4o commented 5 years ago

@philstopford Hey it looks like OSL is failing to link, all the OSL libs we depend on are the ones provided in the svn repo: https://svn.blender.org/svnroot/bf-blender/trunk/lib/win64_vc14 - make sure to update it.

Alternatively you could disable all OSL with WITH_CYCLES_OSL=OFF, to test if it will build.

We recently switched to VS2017 as compiler for nightly builds. It is strange that you get unresolved externals only in vray_for_blender_rt.lib, could you post the cmake configure line you use.

philstopford commented 5 years ago

cmake -G "Visual Studio 15 2017 Win64" -DWITH_VRAY_FOR_BLENDER=ON -DLIBS_ROOT=D:/development/blender-git/blender-for-vray-libs -DLIBDIR=D:/development/blender-git/lib/win64_vc14 D:/development/blender-git/blender-for-vray

CMakeCache.txt

Attempt to build this morning after 'make update' inside the blender-for-vray folder

yields:

Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol "declspec(dllimport) public: unsigned int64 cdecl OSL_v1_9::OSLQuery::nparams(void)const " (imp_?nparams@OSLQuery@OSL_v1_9@@QEBA_KXZ) referenced in function "struct _object __cdecl vfb_osl_update_node_func(struct _object ,struct _object )" (?vfb_osl_update_node_func@@YAPEAU_object@@PEAU1@0@Z) blender D:\development\blender-git\bv\source\creator\vray_for_blender_rt.lib(vfb_python_api.obj) 1
Error LNK2001 unresolved external symbol "declspec(dllimport) public: unsigned int64 cdecl OSL_v1_9::OSLQuery::nparams(void)const " (imp_?nparams@OSLQuery@OSL_v1_9@@QEBA_KXZ) blender D:\development\blender-git\bv\source\creator\vray_for_blender_rt.lib(vfb_export_shader.obj) 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: struct OSL_v1_9::OSLQuery::Parameter const
cdecl OSL_v1_9::OSLQuery::getparam(unsigned int64)const " (imp_?getparam@OSLQuery@OSL_v1_9@@QEBAPEBUParameter@12@_K@Z) referenced in function "struct _object __cdecl vfb_osl_update_node_func(struct _object ,struct _object )" (?vfb_osl_update_node_func@@YAPEAU_object@@PEAU1@0@Z) blender D:\development\blender-git\bv\source\creator\vray_for_blender_rt.lib(vfb_python_api.obj) 1
Error LNK2001 unresolved external symbol "__declspec(dllimport) public: struct OSL_v1_9::OSLQuery::Parameter const
cdecl OSL_v1_9::OSLQuery::getparam(unsigned int64)const " (imp_?getparam@OSLQuery@OSL_v1_9@@QEBAPEBUParameter@12@_K@Z) blender D:\development\blender-git\bv\source\creator\vray_for_blender_rt.lib(vfb_export_shader.obj) 1
Error LNK2019 unresolved external symbol randombytes_close referenced in function "public:
cdecl zmq::ctx_t::~ctx_t(void)" (??1ctx_t@zmq@@QEAA@XZ) blender D:\development\blender-git\bv\source\creator\libzmq.lib(ctx.obj) 1
Error LNK2019 unresolved external symbol crypto_box_keypair referenced in function zmq_curve_keypair blender D:\development\blender-git\bv\source\creator\libzmq.lib(zmq_utils.obj) 1
Error LNK2001 unresolved external symbol crypto_box_keypair blender D:\development\blender-git\bv\source\creator\libzmq.lib(curve_client.obj) 1
Error LNK2001 unresolved external symbol crypto_box_keypair blender D:\development\blender-git\bv\source\creator\libzmq.lib(curve_server.obj) 1
Error LNK2019 unresolved external symbol sodium_init referenced in function "public:
cdecl zmq::curve_client_t::curve_client_t(struct zmq::options_t const &)" (??0curve_client_t@zmq@@QEAA@AEBUoptions_t@1@@Z) blender D:\development\blender-git\bv\source\creator\libzmq.lib(curve_client.obj) 1
Error LNK2001 unresolved external symbol sodium_init blender D:\development\blender-git\bv\source\creator\libzmq.lib(curve_server.obj) 1
Error LNK2019 unresolved external symbol crypto_box_beforenm referenced in function "private: int cdecl zmq::curve_client_t::process_welcome(unsigned char const *,unsigned __int64)" (?process_welcome@curve_client_t@zmq@@AEAAHPEBE_K@Z) blender D:\development\blender-git\bv\source\creator\libzmq.lib(curve_client.obj) 1
Error LNK2001 unresolved external symbol crypto_box_beforenm blender D:\development\blender-git\bv\source\creator\libzmq.lib(curve_server.obj) 1
Error LNK2019 unresolved external symbol crypto_box referenced in function "private: int
cdecl zmq::curve_client_t::produce_hello(class zmq::msg_t )" (?produce_hello@curve_client_t@zmq@@AEAAHPEAVmsg_t@2@@Z) blender D:\development\blender-git\bv\source\creator\libzmq.lib(curve_client.obj) 1
Error LNK2001 unresolved external symbol crypto_box blender D:\development\blender-git\bv\source\creator\libzmq.lib(curve_server.obj) 1
Error LNK2019 unresolved external symbol crypto_box_open referenced in function "private: int __cdecl zmq::curve_client_t::process_welcome(unsigned char const
,unsigned int64)" (?process_welcome@curve_client_t@zmq@@AEAAHPEBE_K@Z) blender D:\development\blender-git\bv\source\creator\libzmq.lib(curve_client.obj) 1
Error LNK2001 unresolved external symbol crypto_box_open blender D:\development\blender-git\bv\source\creator\libzmq.lib(curve_server.obj) 1
Error LNK2019 unresolved external symbol crypto_box_afternm referenced in function "public: virtual int
cdecl zmq::curve_client_t::encode(class zmq::msg_t )" (?encode@curve_client_t@zmq@@UEAAHPEAVmsg_t@2@@Z) blender D:\development\blender-git\bv\source\creator\libzmq.lib(curve_client.obj) 1
Error LNK2001 unresolved external symbol crypto_box_afternm blender D:\development\blender-git\bv\source\creator\libzmq.lib(curve_server.obj) 1
Error LNK2019 unresolved external symbol crypto_box_open_afternm referenced in function "public: virtual int __cdecl zmq::curve_client_t::decode(class zmq::msg_t
)" (?decode@curve_client_t@zmq@@UEAAHPEAVmsg_t@2@@Z) blender D:\development\blender-git\bv\source\creator\libzmq.lib(curve_client.obj) 1
Error LNK2001 unresolved external symbol crypto_box_open_afternm blender D:\development\blender-git\bv\source\creator\libzmq.lib(curve_server.obj) 1
Error LNK2019 unresolved external symbol randombytes referenced in function "private: int cdecl zmq::curve_client_t::produce_initiate(class zmq::msg_t )" (?produce_initiate@curve_client_t@zmq@@AEAAHPEAVmsg_t@2@@Z) blender D:\development\blender-git\bv\source\creator\libzmq.lib(curve_client.obj) 1
Error LNK2001 unresolved external symbol randombytes blender D:\development\blender-git\bv\source\creator\libzmq.lib(curve_server.obj) 1
Error LNK2019 unresolved external symbol crypto_secretbox referenced in function "private: int __cdecl zmq::curve_server_t::produce_welcome(class zmq::msg_t
)" (?produce_welcome@curve_server_t@zmq@@AEAAHPEAVmsg_t@2@@Z) blender D:\development\blender-git\bv\source\creator\libzmq.lib(curve_server.obj) 1
Error LNK2019 unresolved external symbol crypto_secretbox_open referenced in function "private: int
cdecl zmq::curve_server_t::process_initiate(class zmq::msg_t *)" (?process_initiate@curve_server_t@zmq@@AEAAHPEAVmsg_t@2@@Z) blender D:\development\blender-git\bv\source\creator\libzmq.lib(curve_server.obj) 1
Error LNK1120 13 unresolved externals blender D:\development\blender-git\bv\bin\Release\blender.exe 1
Error MSB3073 The command "setlocal "C:\Program Files\CMake\bin\cmake.exe" -DBUILD_TYPE=Release -P cmake_install.cmake if %errorlevel% neq 0 goto :cmEnd :cmEnd endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone :cmErrorLevel exit /b %1 :cmDone if %errorlevel% neq 0 goto :VCEnd :VCEnd" exited with code 1. INSTALL C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets 138

poseidon4o commented 5 years ago

Just pushed a repo with pre-built libs we use in nightlies: https://github.com/ChaosGroup/vray_for_blender_libs try with these.

philstopford commented 5 years ago

Your libraries worked. From inspection, I have a sodium directory in libs/Windows where your archive does not (it seemed to be needed based on https://github.com/ChaosGroup/blender_with_vray_additions, but your package suggests otherwise, at least for Windows).

The file sizes are also slightly different for the libzmq static binary - I used 4.1.4 of libzeromq and 1.0.16 of the sodium library, in case that matters.

poseidon4o commented 5 years ago

ZMQ is built without sodium on windows as it is not strict requirement. The linux and macos are not yet updated with that so they include libsodium.

philstopford commented 5 years ago

Whilst the build works, the resulting binary doesn't seem to have the V-ray addon available. I'm looking into why that might be.

poseidon4o commented 5 years ago

How do you determine that? On first run you need to enable the addon: File -> User Preferences -> Addons -> Render -> Render: V-Ray For Blender 3.0

https://i.imgur.com/49vuxVp.png

philstopford commented 5 years ago

Yeah - I see 'vb30' flagged as being missing and 'ray' in the search field in the addons panel turns up no such addon. In the terminal, I see :

File "D:\development\blender-git\bv\bin\Release\2.79\scripts\modules\addon_utils.py", line 351, in enable mod = import(module_name) ModuleNotFoundError: No module named 'vb30'

poseidon4o commented 5 years ago

Did you clone the python exporter (vb30 module)? Last two steps from here: https://github.com/ChaosGroup/blender_with_vray_additions/blob/dev/vray_for_blender/vb35/README.md

philstopford commented 5 years ago

Indeed - I missed that bit. I cleaned up everything to try again. I'll give that a go and see whether the addon appears. I'll then re-enable OSL and see if that also continues to build cleanly. Thanks for the assistance so far - much appreciated.

philstopford commented 5 years ago

Having the OSL enabled seems to prevent the build from working with your libraries :

142> Creating library D:/development/blender-git/bv/bin/Release/blender.lib and object D:/development/blender-git/bv/bin/Release/blender.exp 142>vray_for_blender_rt.lib(vfb_python_api.obj) : error LNK2019: unresolved external symbol "declspec(dllimport) public: unsigned int64 cdecl OSL_v1_9::OSLQuery::nparams(void)const " (imp_?nparams@OSLQuery@OSL_v1_9@@QEBA_KXZ) referenced in function "struct _object __cdecl vfb_osl_update_node_func(struct _object ,struct _object )" (?vfb_osl_update_node_func@@YAPEAU_object@@PEAU1@0@Z) 142>vray_for_blender_rt.lib(vfb_export_shader.obj) : error LNK2001: unresolved external symbol "declspec(dllimport) public: unsigned int64 cdecl OSL_v1_9::OSLQuery::nparams(void)const " (imp_?nparams@OSLQuery@OSL_v1_9@@QEBA_KXZ) 142>vray_for_blender_rt.lib(vfb_python_api.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: struct OSL_v1_9::OSLQuery::Parameter const cdecl OSL_v1_9::OSLQuery::getparam(unsigned int64)const " (_imp?getparam@OSLQuery@OSL_v1_9@@QEBAPEBUParameter@12@_K@Z) referenced in function "struct _object __cdecl vfb_osl_update_node_func(struct _object ,struct _object )" (?vfb_osl_update_node_func@@YAPEAU_object@@PEAU1@0@Z) 142>vray_for_blender_rt.lib(vfb_export_shader.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct OSL_v1_9::OSLQuery::Parameter const cdecl OSL_v1_9::OSLQuery::getparam(unsigned int64)const " (_imp?getparam@OSLQuery@OSL_v1_9@@QEBAPEBUParameter@12@_K@Z) 142>D:\development\blender-git\bv\bin\Release\blender.exe : fatal error LNK1120: 2 unresolved externals

osl_build_log.txt

philstopford commented 5 years ago

With OSL disabled, the build completes and running the git clone sequence to get the exporter allows it to show up in blender when launched, so that's progress. Not sure why OSL should cause such trouble, though.

poseidon4o commented 5 years ago

What revision is your svn repository with prebuilt libs (win64_vc14)? Mine is at 62143. Also what is the commit you are building from for Blender itself?

philstopford commented 5 years ago

I updated when I first started this morning; the libs revision is below. It looks like a couple of commits were made to the V-ray blender code this morning, so I didn't have those locally. Not sure if you expect a difference but I'll try the build with the output of the below:

D:\development\blender-git\blender-for-vray>make update Updating 'D:\development\blender-git\lib\win64_vc14': At revision 62143. Unpacking objects: 100% (13/13), done.Unpacking objects: 7% (1/13)

remote: Counting objects: 100% (19/19), done. remote: Compressing objects: 100% (4/4), done. remote: Total 13 (delta 10), reused 12 (delta 9), pack-reused 0 From https://github.com/bdancer/blender-for-vray 527770e47a..89f1c0ac73 dev/vray_for_blender/vb35 -> origin/dev/vray_for_blender/vb35

philstopford commented 5 years ago

Same issue when OSL is enabled with the current code noted above.

poseidon4o commented 5 years ago

Can you try defining the symbol OSL_STATIC_BUILD globally?

philstopford commented 5 years ago

Can you tell me how I should define that? I'm willing to try - just not sure what to do to set this correctly. A web search for this in relation to blender wasn't helpful.

poseidon4o commented 5 years ago

Actually I added this to the configuration, please update the source and try to build

philstopford commented 5 years ago

That seems to make the system happy. OSL shows up.

This looks good now.

Is it expected (I also see it in the official nightly builds) that the general settings compute device appears different to the regular blender builds (i.e. the GTX 1060 isn't shown)? How is CUDA handled in the V-ray builds vs the vanilla blender code?

poseidon4o commented 5 years ago

Thank you for reporting the missing cuda support. It should be in next win nightly and a bit later for mac and linux.

For your build you need to install the CUDA Toolkit 9 and pass these parameters to cmake: -DWITH_CYCLES=ON -DWITH_CYCLES_CUDA=ON -DWITH_CYCLES_CUDA_BINARIES=ON

If the configuration or build fails because it fails to find the cuda compiler you need to also pass the path to the installed toolkit -DCUDA_TOOLKIT_ROOT_DIR=<path to cuda compiler>

philstopford commented 5 years ago

CUDA working nicely. I think that covers everything.

If there was a desire to merge blender master with the current V-ray/blender code, how is that typically done - I see numerous mentions of merging blender master with this project, but the technique escapes me.

poseidon4o commented 5 years ago

If you want to merge the latest changes from master you need to add the blender repo as remote, get the changes from the upstream master and merge them to the dev/vray_for_blender/vb35 branch (or any branch you use for development): git remote add upstream git://git.blender.org/blender.git git checkout master git pull upstream master git checkout dev/vray_for_blender/vb35 git merge master

philstopford commented 5 years ago

I think this, from my perspective, can be closed now. The original issue is resolved: I can happily build with VS2017 and the resulting binary works just fine.

poseidon4o commented 5 years ago

Last change was by mistake I will close it now