Bug 220110

Summary: cad/opencascade: Update to 7.1.0
Product: Ports & Packages Reporter: Thibault Jouan <tj+freebsd_ports>
Component: Individual Port(s)Assignee: Thierry Thomas <thierry>
Status: Closed FIXED    
Severity: Affects Some People CC: owen94012, thierry
Priority: --- Keywords: needs-qa
Version: LatestFlags: koobs: maintainer-feedback? (thierry)
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=220873
Attachments:
Description Flags
cad/opencascade7 shar file
none
cad/opencascade port update to 7.1.0
none
cad/opencascade port update to 7.1.0 (svn diff) none

Description Thibault Jouan 2017-06-18 13:54:08 UTC
Created attachment 183603 [details]
cad/opencascade7 shar file

Open CASCADE Technology (OCCT) is an object-oriented C++ class library designed
for rapid production of sophisticated domain-specific CAD/CAM/CAE applications.


  We already have version 6.9.1 in port `cad/opencascade'. This last
one is currently used as a runtime dependency for `cad/freecad' port.
However, FreeCAD is transitioning to opencascade 7, because of
segfaults and bugs with opencascade 6.9.1.
  Building `cad/freecad' with this new port instead solve those
issues.

  The port I suggest here is less complete than `cad/opencascade', for
example VTK is disabled as FreeCAD does not require opencascade to be
built with this option, and this is currently my main focus.


  I think there is two main issues in my work:

  * I could not find a reliable source for download. We can fetch
    snapshot from their gitweb:
    fetch 'http://git.dev.opencascade.org/gitweb/?p=occt.git;a=snapshot;sf=tgz;h=89aebde;/opencascade-7.1.0.tar.gz'
    But content differ every time.
    I think the solution is to mirror it and specify
    `MASTER_SITES=LOCAL/some_dir' or something like that. File is at:
    http://vault.a13.fr/dev/opencascade-7.1.0.tar.gz

  * I use the same `PORTNAME' as `cad/opencascade' port, and did not
    add any `CONFLICT_*' var. I'm not sure if it's the best way.
Comment 1 bye 2017-06-22 02:50:05 UTC
Hello

I am having issues with this as well. I initially thought that the problem was FreeCAD crashing but @Thibault told me it is most likely cad/opencascade6 that's causing the crash.

I can reproduce the crash 100% of the time. Just open FreeCAD go to the draft or part design workbench.

Select the b spline tool, left click 1 or more times, then right click to finish the b spline.

It crashes for me 100% of the time.
Comment 2 Thierry Thomas freebsd_committer freebsd_triage 2017-06-22 17:31:29 UTC
Thanks for your work!

Some remarks:

- do we really need to have two ports for OpenCascade OCCT? We could use this PR to upgrade the existing cad/opencascade to 7.1.0. Else, this new port cad/opencascade7 should be a repocopy of the existing one.

- About MASTER_SITES: we can use LOCAL/thierry, as for the previous releases.

Another possibility: we could also use the OCE edition, located at
https://github.com/tpaviot/oce
Comment 3 Thierry Thomas freebsd_committer freebsd_triage 2017-06-22 18:52:19 UTC
Done. You can now fetch opencascade-7.1.0.tgz from LOCAL/thierry

SHA256 (opencascade-7.1.0.tgz) = 0e23f038f4d12ed68d402dd8093923ac506db34abcf1c09bd2bffba1587f68d5
Comment 4 Thibault Jouan 2017-07-01 00:17:10 UTC
Thank you for hosting the file!

I honestly don't know if we need the two ports, but I noticed other
ports depends on this one:

cad/gmsh
cad/netgen

and thought maybe people use cad/opencascade and need 6.x, but I have
no idea. Also, it was a little easier for me to start from scratch and
copy cad/opencascade/Makefile with the pieces I needed, instead of
guessing what to change and removeĀ :-)

I was able to patch existing cad/opencascade to 7.1.0 I think, I will
give it some more test and add the patch to this PR soon. About the
alternative, I didn't know "repocopy", in this case should it be a
patch instead of a shar file?


Last, about the crash on b spline tool I was able to reproduce with
6.9.1 and it seems 7.1.0 solves it. I will test it again when I'm
satisfied with a new patch.
Comment 5 Thibault Jouan 2017-07-02 10:09:27 UTC
Created attachment 184006 [details]
cad/opencascade port update to 7.1.0

  Here is a patch to update current port to 7.1.0. I confirm it solves
the crash when using the b spline tool (I do have a cursor problem
however but this is something else).


  I have a few comments about the patch:

  * I'm not able to run the regression-test target, both before and
    after my update, I obtain this output:

    make -DMAINTAINER_MODE regression-test
    [poudriere.example] Installing opencascade-6.9.1_9...
    /bin/mkdir -p /tmp/testOCC
    bash -c " cd /usr/local/OpenCAS && . /usr/local/OpenCAS/env.sh &&	 CSF_TestScriptsPath=/usr/local/OpenCAS/tests	 CSF_TestDataPath=/usr/local/OpenCAS/data	 DRAWEXE -f /usr/ports/cad/opencascade/files/regtest "
    this isn't a Tk application

  * the tarball in LOCAL/thierry is not exactly the same that the one
    I worked initially, it's 212 Mo instead of 49 Mo, and files have
    strange permissions (executable bit)

  * I tried to preserve installation directories the same as much as
    possible, however I had trouble updating the commands in
    `post-install' target, so I favored adding `INSTALL_DIR_*' cmake
    variables, I hope that's OK.


  About the OCE edition, I looked into this way as it simplifies
retrieving source files, but as I'm focused on doing it for FreeCAD,
it seems the "official" edition is a better choice:
https://forum.freecadweb.org/viewtopic.php?t=12920
https://forum.freecadweb.org/viewtopic.php?t=20021
  In summary, OCE edition seems "too old".
Comment 6 Thibault Jouan 2017-07-02 10:48:38 UTC
  I checked ports depending on cad/opencascade:

  cad/gmsh still builds with OCC option.

  cad/netgen is already broken with OCC option. With OCC 7 it's still
broken but the build error is different as far as I can tell.
Comment 7 bye 2017-07-05 04:07:06 UTC
(In reply to Thibault Jouan from comment #5)

I might be a bit dense here, but I can't seem to download your patch files. How can I download the patch?
Comment 8 Thierry Thomas freebsd_committer freebsd_triage 2017-07-05 17:19:57 UTC
Could you please try again? Maybe you have experienced some site failure, but I just downloaded it successfully.

But there is another problem, it does not apply cleanly:

- there is a tab after the file names
	e.g. --- b/cad/opencascade/Makefile	
	     +++ b/cad/opencascade/Makefile	

- cad/opencascade/files/patch-adm_cmake_occt__macros.cmake does not exist
Comment 9 bye 2017-07-05 17:28:06 UTC
(In reply to Thierry Thomas from comment #8)

What are the steps to download the attachment? I can edit it or view it as a unified whole. Do I have to grab it as a unified whole and then create individual files myself?
Comment 10 bye 2017-07-10 18:50:59 UTC
I found another bug that I am pretty sure is related to this same issue.

Go into FreeCAD, go to the parts workbench create any basic shame; a cube for example.

Go to Drawing workbench and click the A3 button to create a page.
From the menu to the left select the Cube that you previously created.
Click on create orthographic projection button.

100% crash every time with a:
*** Abort *** an exception was raised, but no catch was found.
	... The exception is:SIGSEGV 'segmentation violation' detected. Address 0

error.

I strongly believe that these are related to this OCC package.
Comment 11 Thibault Jouan 2017-07-12 19:50:33 UTC
(In reply to Thierry Thomas from comment #8)
Sorry for the incorrect patch, I realize only now it's problematic for deleted files:
cad/opencascade/files/patch-configure.ac
cad/opencascade/files/patch-src_OSD_OSD_MemInfo.cxx
cad/opencascade/files/patch-inc_Standard_Time.hxx

I should have at least listed them. I guess providing a svn diff will solve this (and other things), I'll work on it asap.
Comment 12 Thibault Jouan 2017-07-12 19:58:36 UTC
(In reply to bcomputerguy from comment #7)
As mentioned the patch is not yet correct to be commited to the ports tree, but as a workaround before I fix it, I think the following should work to test it:

fetch -o ~/occ-update.patch 'https://bugs.freebsd.org/bugzilla/attachment.cgi?id=184006'
patch -p1 -E < ~/occ-update.patch

If -E is not possible, then delete the files I listed in previous comment, or try to remove port patches which became empty:
find cad/opencascade/files -empty -delete


I will try the new bug you posted against 6.9.1 and 7.1.0 to compare, thanks.
Comment 13 bye 2017-07-13 09:30:06 UTC
(In reply to Thibault Jouan from comment #12)

I wanted to ask what someone on the FreeCAD forum asked me. Why am I using the FreeCAD 0.17 pre?

They said there's drastic changes along with all previous tutorials being outdated.

Is there a reason why you're building 0.17 pre release instead of the 0.16 Release version?

https://github.com/FreeCAD/FreeCAD/archive/0.16.tar.gz
Comment 14 Thibault Jouan 2017-07-14 12:59:23 UTC
Created attachment 184352 [details]
cad/opencascade port update to 7.1.0 (svn diff)

Here is an updated patch as a "svn diff". I tested it with `svn patch`
and it seems OK. I hope it will solve the issue for added/removed
files.
Comment 15 Kubilay Kocak freebsd_committer freebsd_triage 2017-07-14 16:09:35 UTC
Assign to maintainer
Comment 16 Kubilay Kocak freebsd_committer freebsd_triage 2017-07-14 16:09:53 UTC
Comment on attachment 184006 [details]
cad/opencascade port update to 7.1.0

Obsolete previous patch version
Comment 17 Thierry Thomas freebsd_committer freebsd_triage 2017-07-15 17:23:59 UTC
Committed, thanks!
(with some bits from Andrea Venturoli and some minor changes from me)
Comment 18 commit-hook freebsd_committer freebsd_triage 2017-07-15 17:25:06 UTC
A commit references this bug:

Author: thierry
Date: Sat Jul 15 17:23:51 UTC 2017
New revision: 445905
URL: https://svnweb.freebsd.org/changeset/ports/445905

Log:
  Upgrade to 7.1.0.

  Release notes at
  https://www.opencascade.com/sites/default/files/documents/release_notes_7.1.0.pdf

  PR:		220110
  Submitted by:	tj+freebsd_portsxi (at) a13.fr
  With bits from:	ml (at) netfence.it

Changes:
  head/cad/opencascade/Makefile
  head/cad/opencascade/distinfo
  head/cad/opencascade/files/patch-CMakeLists.txt
  head/cad/opencascade/files/patch-adm_cmake_occt__csf.cmake
  head/cad/opencascade/files/patch-adm_cmake_occt__macros.cmake
  head/cad/opencascade/files/patch-adm_templates_custom.install.sh.in
  head/cad/opencascade/files/patch-adm_templates_occt_macros.cmake
  head/cad/opencascade/files/patch-configure.ac
  head/cad/opencascade/files/patch-inc_Standard_CLocaleSentry.hxx
  head/cad/opencascade/files/patch-inc_Standard_Time.hxx
  head/cad/opencascade/files/patch-src_OSD_OSD_MemInfo.cxx
  head/cad/opencascade/files/patch-src_STEPConstruct_STEPConstruct__AP203Context.cxx
  head/cad/opencascade/files/patch-src_Standard_Standard_CString.cxx
  head/cad/opencascade/files/patch-src_Standard_Standard__CLocaleSentry.hxx
  head/cad/opencascade/files/patch-src_Standard_Standard__CString.cxx
  head/cad/opencascade/pkg-plist
Comment 19 Thibault Jouan 2017-07-15 21:41:38 UTC
Thanks for finishing the update and committing it!


About the segfault mention in comment #7, I confirm it was in
opencascade 6.9.1 too:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 812a16000 (LWP 100741/FreeCAD)]
0x00000008608ce3b7 in BSplCLib::LocateParameter () from /usr/local/lib/libTKMath.so
(gdb) bt
#0  0x00000008608ce3b7 in BSplCLib::LocateParameter () from /usr/local/lib/libTKMath.so
#1  0x00000008602662d3 in Geom2d_BSplineCurve::ValidateCache () from /usr/local/lib/libTKG2d.so
#2  0x0000000860266bb3 in Geom2d_BSplineCurve::D0 () from /usr/local/lib/libTKG2d.so
#3  0x000000086026c26c in Geom2d_Curve::Value () from /usr/local/lib/libTKG2d.so
#4  0x000000086352f7f4 in BRepLib_MakeEdge2d::Init () from /usr/local/lib/libTKTopAlgo.so
#5  0x0000000863530a32 in BRepLib_MakeEdge2d::Init () from /usr/local/lib/libTKTopAlgo.so
#6  0x0000000863533281 in BRepLib_MakeEdge2d::BRepLib_MakeEdge2d () from /usr/local/lib/libTKTopAlgo.so
#7  0x0000000865babef1 in HLRBRep::MakeEdge () from /usr/local/lib/libTKHLR.so
#8  0x0000000865bbcd5f in HLRBRep_HLRToShape::DrawEdge () from /usr/local/lib/libTKHLR.so
#9  0x0000000865bbcaee in HLRBRep_HLRToShape::DrawFace () from /usr/local/lib/libTKHLR.so
#10 0x0000000865bbc6ce in HLRBRep_HLRToShape::InternalCompound () from /usr/local/lib/libTKHLR.so
#11 0x0000000868f10b25 in HLRBRep_HLRToShape::RgNLineVCompound () from /usr/local/FreeCAD/lib/Drawing.so
#12 0x0000000868f0cb7a in Drawing::ProjectionAlgos::execute () from /usr/local/FreeCAD/lib/Drawing.so
#13 0x0000000868f0c6e7 in Drawing::ProjectionAlgos::ProjectionAlgos () from /usr/local/FreeCAD/lib/Drawing.so
#14 0x0000000868ef787e in Drawing::FeatureViewPart::execute () from /usr/local/FreeCAD/lib/Drawing.so
#15 0x000000080191de0c in App::DocumentObject::recompute () from /usr/local/FreeCAD/lib/libFreeCADApp.so
#16 0x0000000868ef6560 in Drawing::FeatureView::recompute () from /usr/local/FreeCAD/lib/Drawing.so
#17 0x00000008018ed969 in App::Document::_recomputeFeature () from /usr/local/FreeCAD/lib/libFreeCADApp.so
#18 0x00000008018ed507 in App::Document::recompute () from /usr/local/FreeCAD/lib/libFreeCADApp.so
#19 0x0000000868c3ebe4 in DrawingGui::OrthoViews::add_view () from /usr/local/FreeCAD/lib/DrawingGui.so
#20 0x0000000868c40396 in DrawingGui::TaskOrthoViews::TaskOrthoViews () from /usr/local/FreeCAD/lib/DrawingGui.so
#21 0x0000000868c42c3b in DrawingGui::TaskDlgOrthoViews::TaskDlgOrthoViews () from /usr/local/FreeCAD/lib/DrawingGui.so
#22 0x0000000868c3735e in CmdDrawingOrthoViews::activated () from /usr/local/FreeCAD/lib/DrawingGui.so
#23 0x0000000800d69c00 in Gui::Command::invoke () from /usr/local/FreeCAD/lib/libFreeCADGui.so
#24 0x00000008089a5242 in QMetaObject::activate () from /usr/local/lib/qt4/libQtCore.so.4
#25 0x0000000807601e32 in QAction::activate () from /usr/local/lib/qt4/libQtGui.so.4
#26 0x00000008079c06a3 in QAbstractButton::isCheckable () from /usr/local/lib/qt4/libQtGui.so.4
#27 0x00000008079c1368 in QAbstractButton::mouseReleaseEvent () from /usr/local/lib/qt4/libQtGui.so.4
#28 0x0000000807a804df in QToolButton::mouseReleaseEvent () from /usr/local/lib/qt4/libQtGui.so.4
#29 0x00000008076598a4 in QWidget::event () from /usr/local/lib/qt4/libQtGui.so.4
#30 0x00000008079c1270 in QAbstractButton::event () from /usr/local/lib/qt4/libQtGui.so.4
#31 0x0000000807a8095d in QToolButton::event () from /usr/local/lib/qt4/libQtGui.so.4
#32 0x000000080760ac0c in QApplicationPrivate::notify_helper () from /usr/local/lib/qt4/libQtGui.so.4
#33 0x000000080760c58c in QApplication::notify () from /usr/local/lib/qt4/libQtGui.so.4
#34 0x0000000800d4ad5c in Gui::GUIApplication::notify () from /usr/local/FreeCAD/lib/libFreeCADGui.so
#35 0x000000080898d0c6 in QCoreApplication::notifyInternal () from /usr/local/lib/qt4/libQtCore.so.4
#36 0x000000080760b657 in QApplicationPrivate::sendMouseEvent () from /usr/local/lib/qt4/libQtGui.so.4
#37 0x0000000807682505 in qt_try_modal () from /usr/local/lib/qt4/libQtGui.so.4
#38 0x0000000807680c4b in QApplication::x11ProcessEvent () from /usr/local/lib/qt4/libQtGui.so.4
#39 0x00000008076abf9c in QX11Info::isCompositingManagerRunning () from /usr/local/lib/qt4/libQtGui.so.4
#40 0x0000000810525f85 in g_main_context_dispatch () from /usr/local/lib/libglib-2.0.so.0
#41 0x00000008105262b4 in g_main_context_pending () from /usr/local/lib/libglib-2.0.so.0
#42 0x0000000810526344 in g_main_context_iteration () from /usr/local/lib/libglib-2.0.so.0
#43 0x00000008089b9dde in QEventDispatcherGlib::processEvents () from /usr/local/lib/qt4/libQtCore.so.4
#44 0x00000008076abc4d in QX11Info::isCompositingManagerRunning () from /usr/local/lib/qt4/libQtGui.so.4
#45 0x000000080898a6b2 in QEventLoop::exec () from /usr/local/lib/qt4/libQtCore.so.4
#46 0x000000080898d66d in QCoreApplication::exec () from /usr/local/lib/qt4/libQtCore.so.4
#47 0x0000000800d0639f in Gui::Application::runApplication () from /usr/local/FreeCAD/lib/libFreeCADGui.so