tpaviot / oce

OpenCASCADE Community Edition (OCE): a community driven fork of the Open CASCADE library.
http://groups.google.com/group/oce-dev
GNU Lesser General Public License v2.1
811 stars 284 forks source link

Copy missing headers #685

Closed aothms closed 6 years ago

aothms commented 6 years ago

Hi, merry christmas,

Starting from 0.18, including a specific OCE header fails due to the preprocessor failing to find some the subsequent includes in that file. In particular:

#include <Interface_Static.hxx>
int main(int, char**) { return 0; }
In file included from ...:
/.../Interface_Static.hxx:21:41: fatal error: Interface_StaticSatisfies.hxx: No such file or directory
compilation terminated.

So I went on to investigate and found that there are several .hxx files in src/ that are not in inc/. 876 files to be precise including the missing Interface_StaticSatisfies.hxx header. What's the deal with that?

$ ls inc/*.hxx | sort > files_inc.tmp
$ find src/ -type f -name "*.hxx" | sort > files_src.tmp
$ comm -13 files_inc.tmp files_src.tmp | wc -l
876
$ comm -13 files_inc.tmp files_src.tmp | grep Interface_
src/Interface/Interface_Macros.hxx
src/Interface/Interface_StaticSatisfies.hxx
src/Interface/Interface_Statics.hxx
src/Interface/Interface_Translates.hxx
src/Interface/Interface_ValueInterpret.hxx
src/Interface/Interface_ValueSatisfies.hxx
src/Interface/Interface_VectorOfFileParameter.hxx
src/Interface/Interface_Version.hxx

Note that this is also the case for OCE-0.17.3, 826 to be precise, but there the example above compiles.

So, knowing that is probably not the way forward, but at least to get a discussion going, what I did is submit a pull request that copies all files matching a certain set of extensions to the inc/ folder. What do you think is the proper way to resolve this?

aothms commented 6 years ago

To further clarify.

I call IGESControl_Controller::Init() somewhere in the code which requires #include <Interface_Static.hxx>. At least at some point in time for some OCCT version it was necessary.

I dug this up in an old mantis issue:

If i call "IGESControl_Controller::Init()" before IGESCAFControl_Writer, the crash won't occur. This might be helpful for bug fix. My code is simple, i just construct a IGESCAFControl_Writer object and it crash.

From: https://tracker.dev.opencascade.org/view.php?id=25689

That is a message from 2015. According to mantis it is fixed in 6.9.0. So I might be able to remove the dependency on this header anyway.

tpaviot commented 6 years ago

This is a long story (see for instance #359). Some of the headers are located in the inc/ folder, some other in src/*, and some of them are duplicated. Upstream occt does not have any inc/ folder.

During the installation stage ("make install"), all necessary headers are copied to the include/oce folders, whether they come from /inc or src/* (see the adm/cmake/BuildTollkit.cmake file). Regarding your issue, Interface_Static.hxx is in inc/, Interface_StaticSatisfies.hxx is in src/Interface. After installing, they're both available from include/oce.

If ever you don't install oce, you can try to set the OCE_ADD_HEADERS macro to True (False by default), that should do it.