Page MenuHome

Disable cycles if pugixml is not found
AbandonedPublic

Authored by Martin Preisler (mpreisler) on Jul 4 2018, 10:45 PM.

Details

Summary

Minor fix: Cycles was being built even if the pugixml headers were missing. This was not caught at configure time but only when you attempted the build.

Prevents:

[  9%] Building CXX object intern/itasc/CMakeFiles/bf_intern_itasc.dir/kdl/treefksolverpos_recursive.cpp.o
In file included from /home/mpreisle/d/blender/intern/cycles/graph/../graph/node_xml.h:23,
                from /home/mpreisle/d/blender/intern/cycles/graph/node_xml.cpp:17:
/home/mpreisle/d/blender/intern/cycles/graph/../util/util_xml.h:22:10: fatal error: pugixml.hpp: No such file or directory
#include <pugixml.hpp>
         ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [intern/cycles/graph/CMakeFiles/cycles_graph.dir/build.make:89: intern/cycles/graph/CMakeFiles/cycles_graph.dir/node_xml.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1426: intern/cycles/graph/CMakeFiles/cycles_graph.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

After this is applied you will instead see this:

-- Could NOT find PUGIXML (missing: PUGIXML_LIBRARY PUGIXML_INCLUDE_DIR)  
CMake Warning at CMakeLists.txt:718 (message):
 PugiXML was not found, disabling WITH_CYCLES

Diff Detail

Repository
rB Blender

Event Timeline

Martin Preisler (mpreisler) edited the summary of this revision. (Show Details)
Martin Preisler (mpreisler) edited the summary of this revision. (Show Details)
Brecht Van Lommel (brecht) requested changes to this revision.Jul 4 2018, 11:25 PM

We don't want to build against the pugixml package, but use the version that is bundled as part of OpenImageIO.

Does this simpler fix solve the problem for you?

diff --git a/intern/cycles/util/util_xml.h b/intern/cycles/util/util_xml.h
index 6f06f17937b..1311d24abd6 100644
--- a/intern/cycles/util/util_xml.h
+++ b/intern/cycles/util/util_xml.h
@@ -19,7 +19,7 @@

 /* PugiXML is used for XML parsing. */

-#include <pugixml.hpp>
+#include <OpenImageIO/pugixml.hpp>

 CCL_NAMESPACE_BEGIN
This revision now requires changes to proceed.Jul 4 2018, 11:25 PM

Ah, OK, should I use the different include then and delete the FindPugiXML.cmake file? AFAIK it's not used by anything.

../intern/cycles/graph/../util/util_xml.h:22:10: fatal error: OpenImageIO/pugixml.hpp: No such file or directory
 #include <OpenImageIO/pugixml.hpp>

It doesn't fix it but I think I can figure out what to change. Lemme look into this.

So I may be doing something wrong but at least on Fedora 28 the OpenImageIO package doesn't bundle pugixml.

mpreisle@localhost /usr/include/OpenImageIO $ ls
argparse.h    color.h         export.h      fstream_mingw.h  imagebufalgo_util.h  image_view.h    osdep.h      plugin.h  span.h         sysutil.h  tinyformat.h                ustring.h
array_view.h  dassert.h       filesystem.h  function_view.h  imagebuf.h           missing_math.h  parallel.h   refcnt.h  strided_ptr.h  texture.h  typedesc.h                  varyingref.h
atomic.h      deepdata.h      filter.h      hash.h           imagecache.h         oiioversion.h   paramlist.h  SHA1.h    string_view.h  thread.h   unittest.h                  version.h
benchmark.h   errorhandler.h  fmath.h       imagebufalgo.h   imageio.h            optparser.h     platform.h   simd.h    strutil.h      timer.h    unordered_map_concurrent.h
mpreisle@localhost /usr/include/OpenImageIO $ grep "pugi" -r .
mpreisle@localhost /usr/include/OpenImageIO $ sudo dnf info OpenImageIO-devel
Last metadata expiration check: 2:17:59 ago on Wed 04 Jul 2018 04:01:01 PM EDT.
Installed Packages
Name         : OpenImageIO-devel
Version      : 1.8.12
Release      : 1.fc28
Arch         : x86_64
Size         : 3.5 M
Source       : OpenImageIO-1.8.12-1.fc28.src.rpm
Repo         : @System
From repo    : updates
Summary      : Documentation for OpenImageIO
URL          : https://sites.google.com/site/openimageio/home
License      : BSD
Description  : Development files for package OpenImageIO
                                                                                                                                                                                                                                        
Available Packages                                                                                                                                                                                                                      
Name         : OpenImageIO-devel                                                                                                                                                                                                        
Version      : 1.8.12                                                                                                                                                                                                                   
Release      : 1.fc28                                                                                                                                                                                                                   
Arch         : i686                                                                                                                                                                                                                     
Size         : 2.5 M                                                                                                                                                                                                                    
Source       : OpenImageIO-1.8.12-1.fc28.src.rpm                                                                                                                                                                                        
Repo         : updates                                                                                                                                                                                                                  
Summary      : Documentation for OpenImageIO                                                                                                                                                                                            
URL          : https://sites.google.com/site/openimageio/home                                                                                                                                                                           
License      : BSD                                                                                                                                                                                                                      
Description  : Development files for package OpenImageIO

This is why:
https://src.fedoraproject.org/rpms/OpenImageIO/blob/master/f/OpenImageIO.spec#_97

It's a common practice of Linux distributions to avoid bundling. I guess to fix this we could try to find the header in cmake and if it's not in path we can complain, or we can add the path to the list of paths FindPugiXML will try as the first path.

The build system changed a lot since this patch, I think it's no longer relevant.