Page MenuHome

MSVC: Fix obscure RNA related build error
ClosedPublic

Authored by Ray molenkamp (LazyDodo) on Fri, Feb 14, 7:14 PM.

Details

Summary

Allright this one is remarkably hard to reproduce and also happening that often that it is being a real pain to deal with and needs solving, yet I can offer no fool proof repro steps, but generally the issue shows when you switch back and forth debug and release modes in visual studio (aka getting actual work done).

In a multi target cmake generator (problem found on VS, but i suspect XCode may run into this as well)

The debug and release mode share the generated code files in the bf_rna project.

Now sometimes, and I'm unsure what triggers this you end up with RNA code generated in debug mode being compiled and linked in release mode

and you end up with this build error:

------ Build started: Project: bf_rna, Configuration: Release x64 ------
rna_object_gen.c
K:\BlenderGit\build_windows_Release_x64_vc16_Release\source\blender\makesrna\intern\rna_object_gen.c(3501,25): error C4013: 'rna_Object_me_eval_info' undefined; assuming extern returning int
K:\BlenderGit\build_windows_Release_x64_vc16_Release\source\blender\makesrna\intern\rna_object_gen.c(3608,6): error C2371: 'rna_Object_me_eval_info': redefinition; different basic types
Done building project "bf_rna.vcxproj" -- FAILED.

Force rebuilding makesrna fixes it, but for less experienced (or even experienced) developers this solution is not entirely obvious.

This root cause is

  1. rna_Object_me_eval_info being defined only in debug mode with an #ifndef NDEBUG guard.
  2. some code gets generated in debug mode that references it
  3. in release mode this function is omitted, but the code that uses it is still there.
  4. boom

This patch 'fixes' the issue by supplying an empty stub for release mode.

wish I had a better fix or repro case but this sadly will have to do, since it is still better than what we have now.

Diff Detail

Repository
rB Blender

Event Timeline

This revision is now accepted and ready to land.Fri, Feb 14, 7:42 PM