segmentation fault in Import/Export sample, IGESControl_Reader

Dear forum members,

I just compiled the QT import/export sample from OCC 6.5.1 under 64bit Linux and found a segmentation fault when i try to import one of the example IGES files. The error occurs in IGESControl_Reader->TransferRoots().
Does anyone has found the same error or can confirm that everything is ok with other operation systems?

Thanks,
Gernot

Forum supervisor's picture

Dear Gernot,
Could you provide the specified IGES file (if it's possible )?
Also exact versions of Linux OS and Compiler are desirable.
Regards

gernot's picture

The error occurs with all IGES files I tried, also with hammer.iges and bearing.iges provided with OCC.
My operating system is Ubuntu 10.10 64bit, the compiler I used is gcc 4.4.5.
At the moment I compile OCC in a 32bit Ubuntu 10.10 to check whether the error occurs there too.
Best regards,
Gernot

gernot's picture

with OCC compiled under 32bit Ubuntu 10.10 I have exactly the same error.
To compile OCC I did exactly the same with both Linux versions:
- I applied the ftgl-patch from the forum (http://www.opencascade.org/org/forum/thread_20128/)
- I added the additional include to the file OSD_MAllocHook.cxx (http://www.opencascade.org/org/forum/thread_20931/)

I am wondering if nobody else uses the IGES import functions of OCC. Up to now I imported IGES files exactly like in the import/export sample. Maybe there is a different way without this error?

Gernot

Forum supervisor's picture

Dear Gernot,
As you probably know Ubuntu is not in the list of supported by OCCT platforms (see "Release Notes" of the last release). As result we don't have technical possibility to check the issue in the specified environment.
Nevertheless we checked the case on the current development version of OCCT compiled by gcc 4.4.5 on Debian-60 64 bit. The problem is not reproduced.
Regards

gernot's picture

Dear forum supervisor,

now I finished testing OCC in Debian, with no differences. Again I get the same segmentation fault when I read an iges file with the qt import/export sample. I made a list of all the things I did to compile the import/export sample:
- new installation of Debian 6.0.2.1-i386 32bit in VirtualBox
- added env.sh to .bashrc
- installed all required software with Synaptic: (only some packages listed, others were installed automatically): qt4.6.3 tcl8.5 tk8.5 tclx8.4 + dev, libftgl + dev, libfreeimage3 + dev, libgl2ps + dev, libtbb2 + dev, libxmu-dev, libxmu-headers
- symbolic link: 'ln -s /usr/include/FTGL/ftgl.h /usr/include/FTGL/FTGL.h'
- symbolic link: 'ln -s /usr/include/freetype2/freetype /usr/include/freetype'
- applied patch for ftgl: 'patch -p1 < fix-ftgl-includes.patch'
- added '#include ' in file ros/src/OSD/OSD_MAllocHook.cxx
- ./configure --prefix=/usr/local/opencascade-6.5.1
- make
- make install
- symbolic link: 'ln -s /usr/bin/lrelease /bin/lrelease'
- edited CASROOT in .bashrc
- qmake IESample.pro
- make
- removed check of QTDIR in run.sh
- run program via run.sh
-> segmentation fault after reading of any iges file

If you really dont see the same error I should have done anything wrong during the compilation procedure. Do you have any idea what this could be?

Please can someone of the other forum members compile the import/export example to verify this error?

Gernot

Forum supervisor's picture

Dear Gernot,

I just can confirm once again that test on Debian60 64bit(Kernel: 2.6.32-5-amd64) & gcc: 4.4.5 didn't detect any problem with Import/Export sample. Iges files are imported successfully. If the problem is blocking for you, you may contact us via Contact Form http://www.opencascade.org/about/contacts/.
We will try to find a solution/workaround acceptable for you.
Regards

Denis Barbier's picture

IGES import works fine here on Debian sid 64bits, as in the import/export example.

gernot's picture

I am still trying to compile OCC in a freshly installed Debian 6.0.2.1. It will take some time because of old hardware and a virtualbox system. But in the meantime I created a minimal example of the IGES import functions without Qt which just reads in the IGES file and converts it to a TopoDS_Shape. This sample works absolutely ok like all the years before.
I have no explanation for this but until I tested the import/export sample in the Debian I will add some Qt to the working minimal program, maybe I find something...

Gernot

gernot's picture

Dear forum members,

I am still trying to find a solution for my problem...
I created a small test project (mesh3.tar.gz attached) which reads the hammer.igs provided with OCC6.5.1 and displays it. There is an option to create a torus and display it which works as it should.

The code for IGES reading is taken from the Import/Export sample. Compiled as release I get the segfault during drawing. Compiled as debug I get a lot of error messages I do not understand, then I see something similiar to the hammer but when I move the mouse over this displayed object I get the segfault.

This are the messages in debug mode during displaying the hammer object:

Total number of loaded entities 651.

** Exception in IGESToBRep_BasicSurface::TransferBasicSurface : 0x7f5b2da093a8 : Standard_RangeError: TCollection_Array2::Create
** Exception in IGESToBRep_BasicSurface::TransferBasicSurface : 0x7f5b2da093a8 : Standard_RangeError: TCollection_Array2::Create
** Exception in IGESToBRep_BasicSurface::TransferBasicSurface : 0x7f5b2da093a8 : Standard_RangeError: TCollection_Array2::CreateWarning: IGESToBRep_IGESBoundary: Deviation = 1.00001
Warning: IGESToBRep_IGESBoundary: 3D and 2D curves are inconsistent; 3D is ignored

** Exception in IGESToBRep_BasicSurface::TransferBasicSurface : 0x7f5b2da093a8 : Standard_RangeError: TCollection_Array2::CreateWarning: IGESToBRep_IGESBoundary: Deviation = 219.392
Warning: IGESToBRep_IGESBoundary: 3D and 2D curves are inconsistent; 3D is ignored
Warning: IGESToBRep_IGESBoundary: Deviation = 4.16671
Warning: IGESToBRep_IGESBoundary: 3D and 2D curves are inconsistent; 3D is ignored
Warning: IGESToBRep_IGESBoundary: 2D curve of edge was reversed
Warning: IGESToBRep_IGESBoundary: Deviation = 558.451
Warning: IGESToBRep_IGESBoundary: 3D and 2D curves are inconsistent; 3D is ignored
Warning: IGESToBRep_IGESBoundary: 2D curve of edge was reversed
Warning: IGESToBRep_IGESBoundary: Deviation = 492.842
Warning: IGESToBRep_IGESBoundary: 3D and 2D curves are inconsistent; 3D is ignored

** Exception in IGESToBRep_BasicSurface::TransferBasicSurface : 0x7f5b2da093a8 : Standard_RangeError: TCollection_Array2::Create
** Exception in IGESToBRep_BasicSurface::TransferBasicSurface : 0x7f5b2da093a8 : Standard_RangeError: TCollection_Array2::Create
** Exception in IGESToBRep_BasicSurface::TransferBasicSurface : 0x7f5b2da093a8 : Standard_RangeError: TCollection_Array2::CreateWarning: IGESToBRep_IGESBoundary: Deviation = 6.32012
Warning: IGESToBRep_IGESBoundary: 3D and 2D curves are inconsistent; 3D is ignored
Warning: IGESToBRep_IGESBoundary: Deviation = 884.009
Warning: IGESToBRep_IGESBoundary: 3D and 2D curves are inconsistent; 3D is ignored
Warning: IGESToBRep_IGESBoundary: Deviation = 1.00001
Warning: IGESToBRep_IGESBoundary: 3D and 2D curves are inconsistent; 3D is ignored
Warning: IGESToBRep_IGESBoundary: Deviation = 2.06157
Warning: IGESToBRep_IGESBoundary: 3D and 2D curves are inconsistent; 3D is ignored

** Exception in IGESToBRep_BasicCurve::TransferBasicCurve : 0x7f5b2da093a8 : Standard_RangeError: TCollection_Array1::Create
** Exception in IGESToBRep_BasicCurve::Transfer2dBasicCurve : 0x7f5b2da093a8 : Standard_RangeError: TCollection_Array1::CreateWarning: IGESToBRep_IGESBoundary: Deviation = 1.20186
Warning: IGESToBRep_IGESBoundary: 3D and 2D curves are inconsistent; 3D is ignored

** Exception in IGESToBRep_BasicSurface::TransferBasicSurface : 0x7f5b2da093a8 : Standard_RangeError: TCollection_Array2::Create
** Exception in IGESToBRep_BasicSurface::TransferBasicSurface : 0x7f5b2da093a8 : Standard_RangeError: TCollection_Array2::Create
** Exception in IGESToBRep_BasicSurface::TransferBasicSurface : 0x7f5b2da093a8 : Standard_RangeError: TCollection_Array2::CreateInfo: ShapeProcess_Context: Reload Resource_Manager: -> IGES
ElSLib.cxx : maxderivative = 0.0
ElSLib.cxx : maxderivative = 0.0
ElSLib.cxx : maxderivative = 0.0
ElSLib.cxx : maxderivative = 0.0
ElSLib.cxx : maxderivative = 0.0
Info: ShapeFix_Wire::FixLacking: Bending pcurves
Warning: ShapeFix_Face: All wires on a face have small area; left untouched
ElSLib.cxx : maxderivative = 0.0
Warning: ShapeFix_Wire::FixIntersection: Non-adjacent intersection fixed (split-0, cut-0, removed-0)
Info: ShapeFix_Wire::FixLacking: Bending pcurves
Info: ShapeFix_Wire::FixLacking: Bending pcurves
Info: ShapeFix_Wire::FixLacking: Bending pcurves
Info: ShapeFix_Wire::FixLacking: Bending pcurves
Warning: ShapeFix_Wire::FixLacking: degenerated edge added
Info: ShapeFix_Wire::FixLacking: Bending pcurves
Info: ShapeFix_Wire::FixLacking: Bending pcurves
Info: ShapeFix_Wire::FixLacking: Bending pcurves
Wire was splitted on 2 wires
Wire no 1 of 2 reversed
Warning: ShapeFix_Face: 1 small area wire(s) removed
ElSLib.cxx : maxderivative = 0.0
Warning: ShapeFix_Wire::FixIntersection: Non-adjacent intersection fixed (split-0, cut-0, removed-2)
Info: ShapeFix_Wire::FixLacking: Bending pcurves
Info: ShapeFix_Wire::FixLacking: Bending pcurves
Info: ShapeFix_Wire::FixLacking: Bending pcurves
Info: ShapeFix_Wire::FixLacking: Bending pcurves
Info: ShapeFix_Wire::FixLacking: Bending pcurves
Info: ShapeFix_Wire::FixLacking: Bending pcurves
Wire was splitted on 2 wires
Wire no 1 of 2 reversed
Wire no 2 of 2 reversed
Warning: ShapeFix_Face: All wires on a face have small area; left untouched
Warning: ShapeFix_Face: All wires on a face have small area; left untouched
ElSLib.cxx : maxderivative = 0.0
Warning: ShapeFix_Wire::FixIntersection: Non-adjacent intersection fixed (split-3, cut-0, removed-2)
Info: ShapeFix_Wire::FixLacking: Bending pcurves
Info: ShapeFix_Wire::FixLacking: Bending pcurves
Info: ShapeFix_Wire::FixLacking: Bending pcurves
Info: ShapeFix_Wire::FixLacking: Bending pcurves
Info: ShapeFix_Wire::FixLacking: Bending pcurves
ElSLib.cxx : maxderivative = 0.0
Warning: ShapeFix_Face: All wires on a face have small area; left untouched
Info: ShapeFix_Wire::FixLacking: Bending pcurves
Warning: ShapeFix_Face: All wires on a face have small area; left untouched
ElSLib.cxx : maxderivative = 0.0
ElSLib.cxx : maxderivative = 0.0
Warning: ShapeFix_Face: All wires on a face have small area; left untouched
Speicherzugriffsfehler

With other IGES files just nothing happens, with the bearing.igs I see something like a clew.
Does someone has any ideas where I can search for the error?
Gernot

Attachments: 
gernot's picture

...in the meantime I am quite sure that there is a problem with reading the IGES contents into a TopoDS-Shape object. I loaded STEP files with nearly the same syntax as with the IGES files. The contents of the STEP files are drawn correctly. A torus created by BRepPrimAPI_MakeTorus is drawn correctly too. Only the TopoDS-Shape created from an IGES file is - depending on the file - not drawn, drawn after minutes as a clew or leads to a segmentation fault.

I tried to follow and understand the code of the IGES reading with a debugger but without success. It is too much nested, I do not understand it.

I am running out of ideas how to find the error. I tested OCE too: the same problem.
Again I want to ask if someone with a well running system could compile my sample project and tell me whether it is working. (you have to adjust the paths in the mesh3.pro)

Or can anyone point me to the relevant classes where the IGES reading is done?

Thanks for any hints!
Gernot

gernot's picture

now I found the error.
Like explained in this post
http://www.opencascade.org/org/forum/thread_18953/
I had to change the environment variable LANG from LANG=de_DE.utf8 to LANG=en, now it works without problems.

I dont understand why this wasnt considered as a bug which could have been fixed since one year...

Gernot

Thomas Paviot's picture

Hi Gernot,

I just pushed a test to OCE github repository (see https://github.com/tpaviot/oce/pull/182). Everything works fine on OSX 64bit, compiled with gcc-4.2.1.

Regards,

Thomas

gernot's picture

Hi Thomas,

today I changed to OCE because of the much simpler installation procedure and the shorter time to compile it.
On 64bit Ubuntu with gcc 4.4.5 and Qt 4.6.3 I still have to set LANG=en to get the IGES import working. I have no idea why but this solved my problems.

But because this simple problem was very annoying for me I really would like to help fixing this. If I can help you with samples or anything else let me know...

Regards,
Gernot

Thomas Paviot's picture

Setting LANG variable to "en" can be done from cmake. Please join the OCE dev mailing list (http://groups.google.com/group/oce-dev) if you wish to discuss this further.

Regards,

Thomas