OCE 0.18 -> OCCT 7.4.0: Crap ton of namespace issues

Having trouble installing or compiling FreeCAD? Get help here.
hobbes1069
Posts: 219
Joined: Wed Nov 09, 2011 3:49 pm

OCE 0.18 -> OCCT 7.4.0: Crap ton of namespace issues

Postby hobbes1069 » Thu Oct 31, 2019 1:13 am

Since OCE appears to be no longer maintained with OCCT's change to a FOSS license I'm working on moving FreeCAD on Fedora from OCE to OCCT but ran into some weird issues.

After switching from OCE to OCCT and removing netgen-mesher (since it doesn't build with current OCCT) I've started getting a ton of errors like this:

Code: Select all

In file included from /builddir/build/BUILD/FreeCAD-0.18.3/src/3rdParty/salomesmesh/src/MEFISTO2/aptrte.cpp:27:
/builddir/build/BUILD/FreeCAD-0.18.3/src/3rdParty/salomesmesh/inc/Rn.h:183:10: error: 'istream' does not name a type
  183 |   friend istream& operator >>(istream& f,  R4 & P)
      |          ^~~~~~~
/builddir/build/BUILD/FreeCAD-0.18.3/src/3rdParty/salomesmesh/inc/Rn.h:188:10: error: 'istream' does not name a type
  188 |   friend istream& operator >>(istream& f,  R4 * P)
      |          ^~~~~~~
For both istream, ofstream, endl, etc. Patching to "std::<function>" for all instances fixes it but why is this necessary? Why would changing from OCE to OCCT affect namespace?

I also got a linker error that looks to be opengl related... weird.

Anyone know what the heck is going on?

Fedora Rawhide (f32)
gcc 9.2.1.

Thanks,
Richard
User avatar
kkremitzki
Posts: 1796
Joined: Thu Mar 03, 2016 9:52 pm
Location: Texas

Re: OCE 0.18 -> OCCT 7.4.0: Crap ton of namespace issues

Postby kkremitzki » Thu Oct 31, 2019 1:34 am

It's actually an OCCT 7.3.0 -> 7.4.0 change: https://www.opencascade.com/doc/occt-7. ... dnamespace

I encountered some resistance working on the aforementioned upgrade myself and haven't gotten the Debian/Ubuntu packaging updated for it yet. You would have better luck if you could use 7.3.0 for the time being.
Like my FreeCAD work? I'd appreciate any level of support via Patreon, Liberapay, or PayPal! Read more about what I do at my blog.
wmayer
Site Admin
Posts: 14999
Joined: Thu Feb 19, 2009 10:32 am

Re: OCE 0.18 -> OCCT 7.4.0: Crap ton of namespace issues

Postby wmayer » Thu Oct 31, 2019 9:47 am

User avatar
tanderson69
Posts: 1500
Joined: Thu Feb 18, 2010 1:07 am

Re: OCE 0.18 -> OCCT 7.4.0: Crap ton of namespace issues

Postby tanderson69 » Thu Oct 31, 2019 1:35 pm

occt had some 'using' declarations in a header file. A 'no no'. These were carrying over to any project including it. They have since fixed this and any project that has accidentally took advantage of this will have to be fixed.

http://git.dev.opencascade.org/gitweb/? ... 2dc6001812
hobbes1069
Posts: 219
Joined: Wed Nov 09, 2011 3:49 pm

Re: OCE 0.18 -> OCCT 7.4.0: Crap ton of namespace issues

Postby hobbes1069 » Fri Nov 01, 2019 11:39 am

Unless it's been fixed in master I probably should submit my patch for fixing all the namespace issues. Also, I got my linker problem sorted.

I was using:

Code: Select all

-DOpenGL_GL_PREFERENCE=GLVND
and getting away with it due to transitive linking of libGL with OCE, but when I switched to OpenCASCADE apparently I wasn't getting it for free anymore.

After hitting my head against the wall and patching freecad to link with libGLU or libGL and getting the same error I tried changing the CMake option to

Code: Select all

-DOpenGL_GL_PREFERENCE=LEGACY
No problems after that but it would probably be a good idea for FreeCAD to use the GL Vendor Neutral path at some point.

Thanks,
Richard
nahshon
Posts: 192
Joined: Wed Jul 24, 2013 8:06 pm

Re: OCE 0.18 -> OCCT 7.4.0: Crap ton of namespace issues

Postby nahshon » Wed Nov 06, 2019 6:04 pm

Are there any pre-compiled RPMS for OCCT? I would like to try them with Fedora 31.
hobbes1069
Posts: 219
Joined: Wed Nov 09, 2011 3:49 pm

Re: OCE 0.18 -> OCCT 7.4.0: Crap ton of namespace issues

Postby hobbes1069 » Wed Nov 06, 2019 9:44 pm

I just recently got them built and they are not yet in stable. I was going to push them with FreeCAD 0.18.4 which I just built today.

If you want to pull them manually you can get them from koji:

https://koji.fedoraproject.org/koji/pac ... geID=30181

Thanks,
Richard
nahshon
Posts: 192
Joined: Wed Jul 24, 2013 8:06 pm

Re: OCE 0.18 -> OCCT 7.4.0: Crap ton of namespace issues

Postby nahshon » Thu Nov 07, 2019 2:16 am

Thanks! I installed these RPMS in Fedora 31 running under VirtualBox. I Could compile and start FreeCAD 0.19 (latest from GitHub).

Since git commit a7d9661b1d FreeCAD failed to compile with OCE on Fedora because Standard_Handle.hxx was missing. Installing OCCT fixed the issue for me.
User avatar
DeepSOIC
Posts: 7162
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: OCE 0.18 -> OCCT 7.4.0: Crap ton of namespace issues

Postby DeepSOIC » Thu Nov 07, 2019 10:13 am

tanderson69 wrote:
Thu Oct 31, 2019 1:35 pm
occt had some 'using' declarations in a header file. A 'no no'.
They are using namespace::identifier, not using namespace. I can't seem to find anyone say it's a no-no, they usually say it is actually the only good way of using using.
https://akrzemi1.wordpress.com/2019/03/ ... space-std/ for example.
So, why is it bad?
User avatar
tanderson69
Posts: 1500
Joined: Thu Feb 18, 2010 1:07 am

Re: OCE 0.18 -> OCCT 7.4.0: Crap ton of namespace issues

Postby tanderson69 » Thu Nov 07, 2019 1:03 pm

DeepSOIC wrote:
Thu Nov 07, 2019 10:13 am
So, why is it bad?
The blog you linked to is about 'using directives' vs 'using declarations' and kind of glosses over headers vs source files. Stack overflow is a good place for this kind of information.
https://stackoverflow.com/questions/584 ... -c-headers