Open ericmehl opened 1 year ago
I can reproduce the same or similar issue. This is with MSVC 2022 either with clang compiler supplied with it or with intel one api compiler.
liboslexec/wide/wide_opcolor.cpp:
__OSL_MASKED_OP2(blackbody, Wv, Wf)
..
OSL_OMP_PRAGMA(omp simd simdlen(__OSL_WIDTH))
..
cs.lookup_blackbody_rgb(temperature); <-- This function is unresolved symbol:
wide_opcolor_b8_AVX2.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class Imath_3_1::Color3<float> __cdecl OSL_v1_14_1::pvt::ColorSystem::lookup_blackbody_rgb(float)const " (__imp_?lookup_blackbody_rgb@ColorSystem@pvt@OSL_v1_14_1@@QEBA?AV?$Color3@M@Imath_3_1@@M@Z) referenced in function osl_b8_AVX2_blackbody_vf
This function is inline function implemented in included opcolor_impl.h.
It was a few different issues. Unnecessary dllimport function attribute was causing the issue I showed above and many similar issues. Then, functions definitions in headers followed by unused code that called those functions seemed to be generating unresolved external symbol errors. And then there were some functions like to_rgb() mentioned above which was called from wide/wide_opcolor.cpp and implemented in opcolor.cpp, but opcolor.cpp didn't seem to be compiled into the batched dll. Not sure why those only gave issues in MSVC environment, maybe they are just never called in any tests and would generate errors at runtime if they were. I just commented those out for now. I might make a patch for this at some point.
Problem
Building with
USE_BATCHED
options on Windows fails due to unresolved external symbols.Expected behavior: Successful build with
USE_BATCHED
option.Actual behavior: There are quite a few unresolved symbols, here are a few representative ones when using
USE_BATCHED=b8_AVX
:Steps to Reproduce
-D USED_BATCHED=b8_AVX
build flagVersions