OpenCamLib is not working! Fixed for python 2.7

Having trouble installing or compiling FreeCAD? Get help here.
User avatar
freman
Posts: 876
Joined: Tue Nov 27, 2018 10:30 pm

OpenCamLib is not working! Fixed for python 2.7

Postby freman » Wed May 29, 2019 8:10 pm

I tagged this on top the end of another thread in path forum where someone had similar issues, but I guess it is more appropriate here in help.

OS: Linux (LXDE/LXDE)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.16854 (Git)
Build type: Release
Branch: master
Hash: fe0fd5512ba9a8a9c729cdc47af35bbe965050ac
Python version: 2.7.15
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English


I'm getting OpenCamLib is not working! when I open my FreeCAD file. I realised it was not installed, so I followed the instructions for git down/build/install. That seems fine but restarting FreeCAD gives the same message.

Presumably I need to rebuild FreeCAD now OpenCamLib is installed.

I go back to my freecad-build directory and re-run the cmake command line.

Code: Select all

cmake -DCMAKE_BUILD_TYPE=Release -DFREECAD_USE_OCC_VARIANT="Official Version" ../FreeCAD
Now, if I run cmake --build . , it goes through the motions but does not seem to actually compiling any code, like nothing is new. It takes 3 min instead of 3 hours ! I still get the same error when opening my FreeCAD files. Apparently it is still not finding OpenCamLib at build time.

I do not see anything about OpenCam either being detected or missing. What should I be looking for in the output?

Code: Select all

==============
Summary report
==============

-- Python:              [/bin/python2.7] [-python2.7]
-- PCL:                 not enabled
-- pybind11:            not enabled
-- Boost:               106600
-- XercesC:             [/usr/lib64/libxerces-c.so] [/usr/include]
-- ZLIB:                1.2.11
-- PyCXX:               [/svn/FreeCAD/src]
-- OCC:                 7.3.0 [TKFillet;TKMesh;TKernel;TKG2d;TKG3d;TKMath;TKIGES;TKSTL;TKShHealing;TKXSBase;TKBin;TKBool;TKBO;TKCDF;TKBRep;TKTopAlgo;TKGeomAlgo;TKGeomBase;TKOffset;TKPrim;TKSTEP;TKSTEPBase;TKSTEPAttr;TKHLR;TKFeat]
-- SMESH:               build internal
--  MEDFile:            [/usr/lib64/libmedC.so;/usr/lib64/libmed.so] [/usr/include/med]
--  HDF5:               1.8.20
--  VTK:                7.1.1
-- NETGEN:              not enabled
-- SWIG:                3.0.12
-- Eigen3               3.3.7
-- Qt4:                 
-- QtWebKit:            found
-- Shiboken:            1.2.4 [/usr/include/shiboken]
-- PySide:              1.2.4 [/usr/include/PySide]
-- PySideTools:         [/bin/pyside-uic] [/bin/pyside-rcc]
-- Freetype:            2.9.1
-- OpenGLU:             /usr/lib64/libGLU.so [/usr/lib64/libGLU.so][/usr/include]
-- Coin3D:              [/usr/local/lib64/libCoin.so] [/usr/local/include]
-- SPNAV:               [/usr/lib64/libspnav.so] [/usr/include]
-- Matplotlib:          2.2.4
-- Rift:                not enabled (BUILD_VR)
-- Doxygen:             not found
=================================================
Now run 'cmake --build /svn/freecad-build' to build FreeCAD
=================================================
BTW I do have pybind11 and its header files installed. Why is that not being found either ( and does it matter ) ?

Code: Select all

dnf remove python2-pybind11 python3-pybind11 pybind11-devel
Dependencies resolved.
=========================================================================================================
 Package                       Architecture        Version                    Repository            Size
=========================================================================================================
Removing:
 pybind11-devel                x86_64              2.2.4-1.fc29               @fedora              542 k
 python2-pybind11              x86_64              2.2.4-1.fc29               @fedora              6.7 k
 python3-pybind11              x86_64              2.2.4-1.fc29               @fedora              6.2 k

Transaction Summary
=========================================================================================================
Remove  3 Packages

Freed space: 554 k
Is this ok [y/N]: n
Operation aborted.
I also installed pcl and pcl-tools , there does not seem to be any -devel pkg for these though.

Code: Select all

-- PCL:                 not enabled
:?

Thanks for any explanations, especially on OpenCamLib.

[EDIT] see end of thread for a work around for python 2.7
Last edited by freman on Sat Jun 01, 2019 5:41 pm, edited 1 time in total.
chrisb
Posts: 20765
Joined: Tue Mar 17, 2015 9:14 am

Re: OpenCamLib is not working!

Postby chrisb » Wed May 29, 2019 9:40 pm

Moved to Install/Compile, although I think it would be placed better in the Path forum.
User avatar
sgrogan
Posts: 5548
Joined: Wed Oct 22, 2014 5:02 pm

Re: OpenCamLib is not working!

Postby sgrogan » Wed May 29, 2019 9:52 pm

chrisb wrote:
Wed May 29, 2019 9:40 pm
Moved to Install/Compile, although I think it would be placed better in the Path forum.
Thanks chrisb. it's good here.

Lot's of users are having issues getting OCL to work with FreeCAD.
First FreeCAD doesn't need OCL at compile time, only at run time. And then only the python extension(binding). FreeCAD needs to be able to find ocl.so (or ocl.pyd on win).

@freman, it seems you've sucessfully built and installed ocl. Can you find ocl.so on your system? I think it should install in your python/site-packages directory.

It might help to post the CMakeCache.txt file from the ocl build directory.
User avatar
freman
Posts: 876
Joined: Tue Nov 27, 2018 10:30 pm

Re: OpenCamLib is not working!

Postby freman » Thu May 30, 2019 12:20 am

thanks for picking this up.

No ocl.so , there's libocl.so :

Code: Select all

find /usr -iname "libocl.so"
/usr/local/lib/opencamlib/libocl.so
User avatar
sgrogan
Posts: 5548
Joined: Wed Oct 22, 2014 5:02 pm

Re: OpenCamLib is not working!

Postby sgrogan » Thu May 30, 2019 12:29 am

freman wrote:
Thu May 30, 2019 12:20 am
It's called libocl.so :
OK so FreeCAD will never find it there.
Run, in FreeCAD's python console

Code: Select all

import sys
for p in sys.path:
	print (p)
So you need to copy or symlink somewhere into FreeCAD's sys.path
Maybe ~.FreeCAD/Mod/ocl?
User avatar
freman
Posts: 876
Joined: Tue Nov 27, 2018 10:30 pm

Re: OpenCamLib is not working!

Postby freman » Thu May 30, 2019 1:10 am

not getting far.

I did a symlink in both freecad-build/Mod and /usr/lib64/python2.7/site-packages but still get the same error.

Code: Select all

pwd
/svn/freecad-build/Mod/Ocl
bash-4.4#ls -il 
total 0
140119 lrwxrwxrwx. 1 root root 35 May 30 02:06 ocl.so -> /usr/local/lib/opencamlib/libocl.so
mlampert
Posts: 1443
Joined: Fri Sep 16, 2016 9:28 pm

Re: OpenCamLib is not working!

Postby mlampert » Thu May 30, 2019 1:50 am

freman wrote:
Thu May 30, 2019 1:10 am
not getting far.

I did a symlink in both freecad-build/Mod and /usr/lib64/python2.7/site-packages but still get the same error.

Code: Select all

pwd
/svn/freecad-build/Mod/Ocl
bash-4.4#ls -il 
total 0
140119 lrwxrwxrwx. 1 root root 35 May 30 02:06 ocl.so -> /usr/local/lib/opencamlib/libocl.so
you can't just create a symlink, you actually need to build the python 3 ocl bindings.
User avatar
freman
Posts: 876
Joined: Tue Nov 27, 2018 10:30 pm

Re: OpenCamLib is not working!

Postby freman » Thu May 30, 2019 8:16 am

you can't just create a symlink, you actually need to build the python 3 ocl bindings.
many thanks, can you explain what that means and how it is done ?

Is that normally taken care of by the opencamlib build process or by FreeCAD's cmake, or does it need doing manually?

If this needs to be in FreeCAD's sys.path, ocl git build is not going to be aware of that. Doesn't this mean that some changes are needed to cmake to detect ocl and ensure it is added to sys.path ? Even if it is not actually needed for compiling, if it is needed at run time and bindings need creating it seems like this should be taken care of at build time.

Why is FreeCAD looking for ocl.so if github pull is installing as libocl.so ? Isn't the correct fix to get FreeCAD to use the name provided by the OpenCadLib developers?
herbk
Posts: 1663
Joined: Mon Nov 03, 2014 3:45 pm
Location: Windsbach, Bavarya (Germany)

Re: OpenCamLib is not working!

Postby herbk » Thu May 30, 2019 9:31 am

Hi freman,
if you look around at the forums you will find several threads with the same topic. Like sgrogan wrote "a lot of users have this prob atm", - me to... ;)

If i understand right the discusions about it, it's a problem of OCL, it's bindings to phyton 3 and some there not existing or not matching packetches.
Gruß Herbert
User avatar
looo
Posts: 3033
Joined: Mon Nov 11, 2013 5:29 pm

Re: OpenCamLib is not working!

Postby looo » Thu May 30, 2019 10:43 am

I tried to build opencamlib several times but failed because of different reasons (python3-supports, cmake difficulties). I guess it's best to do this in an interactive way, trying to figure out what the difficulties of the cmake are. Therefor I created a PR for ocl-conda-package. Would be nice if someone can help with getting it done. Most work is about communicating the errors to the developers and finding out the reason of the build-issues... Once done ocl can be installed via conda and we can include the results in the bundles (appimage/ dmg) if wanted.

https://github.com/conda-forge/staged-recipes/pull/8474
https://github.com/aewallin/opencamlib/issues/64
please help with my conda-packaging efforts: https://liberapay.com/looooo/
minimalistic blog: https://looooo.github.io/mini-blog/