Porting FreeCAD to BSD (NetBSD and cousins) and other stuff

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
Kunda1
Posts: 4755
Joined: Thu Jan 05, 2017 9:03 pm

Re: Porting FreeCAD to BSD (NetBSD and cousins) and other stuff

Postby Kunda1 » Tue Jan 08, 2019 11:59 pm

https://github.com/luzpaz/freecad-dependencies#freecad
The FreeBSD port maintainers are great. Qt 5.12 is supported on ports I bet we could get them to support pyside and shiboken as well. Then subsequently be able to get 0.18 supported when it's released

Edit: tracking downstream tickets for pyside2 and shiboken2 for FreeBSD at https://github.com/luzpaz/FreeCAD-depen ... /issues/41
Last edited by Kunda1 on Wed Jan 09, 2019 1:07 pm, edited 1 time in total.
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
gh2
Posts: 19
Joined: Tue Jan 08, 2019 1:14 pm

Re: Porting FreeCAD to BSD (NetBSD and cousins) and other stuff

Postby gh2 » Wed Jan 09, 2019 10:32 am

Post deleted by gh2
Last edited by gh2 on Wed Mar 13, 2019 10:18 am, edited 1 time in total.
triplus
Posts: 8420
Joined: Mon Dec 12, 2011 4:45 pm

Re: Porting FreeCAD to BSD (NetBSD and cousins) and other stuff

Postby triplus » Wed Jan 09, 2019 1:48 pm

Hi @gh2

I took another look today and on NetBSD you should be able to install FreeCAD 0.16:

http://pkgsrc.se/search.php

That should i guess therefore just work. As i don't have much experience with BSD read the following more as some general pointers. All the build dependencies seem to be there and therefore you should be able to compile FreeCAD (Py2/Qt4) yourself, by downloading FreeCAD source code, installing build dependencies and compiling FreeCAD after. That is without involving Linux emulation.
show-depends print dependencies for building
This might help you to get a list of FreeCAD 0.16 package build dependencies (pkgsrc). And you can use it when trying to compile FreeCAD yourself.

If you want to involve Linux emulation, that reads somewhat complex:

https://www.netbsd.org/docs/guide/en/chap-linux.html

If i understand it correctly, when enabling Linux emulation, you basically install a package offering the Linux emulation. And some shared libraries are already provided? If libraries like glibc are provided by default i guess running AppImage under Linux emulation might be an option too:

https://github.com/FreeCAD/FreeCAD/releases

But all in all you likely need to be an expert to make it work, therefore good luck!
gh2
Posts: 19
Joined: Tue Jan 08, 2019 1:14 pm

Re: Porting FreeCAD to BSD (NetBSD and cousins) and other stuff

Postby gh2 » Sat Jan 12, 2019 11:51 pm

triplus wrote:
Wed Jan 09, 2019 1:48 pm
Hi triplus

Thanks for answer.
Site http://pkgsrc.se/search.php is strange place. I can't find packages there. Freecad 0.16 is there described in cathegory wip which means work in progress. Official NetBSD repository (http://ftp.netbsd.org/pub/pkgsrc/curren ... EADME.html) has not Freecad and it's dependicies.
Link to wip is on www.pkgsrc.org
Last edited by gh2 on Wed Mar 13, 2019 10:21 am, edited 1 time in total.
User avatar
Kunda1
Posts: 4755
Joined: Thu Jan 05, 2017 9:03 pm

Re: Porting FreeCAD to BSD (NetBSD and cousins) and other stuff

Postby Kunda1 » Sat Mar 09, 2019 8:54 pm

gh2 wrote:
Sat Jan 12, 2019 11:51 pm
I must leave forum.
No! Come baaaaaaack :shock:
:?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
gh2
Posts: 19
Joined: Tue Jan 08, 2019 1:14 pm

Re: Porting FreeCAD to BSD (NetBSD and cousins) and other stuff

Postby gh2 » Sat Mar 09, 2019 11:53 pm

Kunda1 wrote:
Sat Mar 09, 2019 8:54 pm
gh2 wrote:
Sat Jan 12, 2019 11:51 pm
I must leave forum.
No! Come baaaaaaack :shock:
:?
I'm comming back :-)

Version 1

I installed FreeCAD 0.17 on NetBSD 8.0 for Intel processor but Draft and Arch workbenches don't work.
I started with a fresh system installation.
Then following steps as root:
1. Run the command:
export PKG_PATH=ftp://ftp.NetBSD.org/pub/pkgsrc/package ... 2018Q3/All
to enable install binary packages from 8.0_2018Q3 release.
2. Install cmake package with command: pkg_add -v cmake.
3. Install gmake package with command: pkg_add -v gmake.
4. Install gtar package with command: pkg_add -v gtar.
(tar does not work well with all types of archives).
5. Install ccache package with command: pkg_add -v ccache
to speed up building other programms.
6. Install python27 package with command: pkg_add -v python27
7. Install py27-matplotlib package with command: pkg_add -v py27-matplotlib
8. Install qt4 package with command: pkg_add -v qt4
9. Build and install pyside:
a) download shiboken-1.2.2.tar.bz2, pyside-qt4.8+1.2.2.tar.bz2, pyside-tools-0.2.15.tar.gz from https://wiki.qt.io/PySide_Downloads
b) gtar -jxf shiboken-1.2.2.tar.bz2
c) cd shiboken-1.2.2
d) Replace #define __STDC__ with #define __STDC__ 1 in ApiExtractor/parser/rpp/pp-qt-configuration
d) mkdir build
e) cd build
f) ccmake .., press c, wait, press e
g) set variables
CMAKE_INSTALL_PREFIX /usr/pkg
QT_QMAKE_EXECUTABLE /usr/pkg/qt4/bin/qmake
press c, press e, press c, press e, press g
h) run gmake with -j parameter and number of processor for example gmake -j4.
It is important to set number of processor to speed up building process.
i) gmake install
j) gtar -jxf pyside-qt4.8+1.2.2.tar.bz2
k) cd pyside-qt4.8+1.2.2
l) export LD_LIBRARY_PATH=/usr/pkg/qt4/lib
m) mkdir build
n) cd build
o) ccmake .., press c, wait, press e
p) set variables
MAKE_INSTALL_PREFIX /usr/pkg
QT_QMAKE_EXECUTABLE /usr/pkg/qt4/bin/qmake
press t
CMAKE_CXX_FLAGS -I/usr/X11R7/include
press c, press c, press g, press e
r) gmake -j4, where 4 is number of processors or cores of processor
s) gmake install
t) gtar -zxf Tools-0.2.15.tar.gz
u) cd Tools-0.2.15
v) mkdir build
w) cd build
x) ccmake .., press c, wait, press e
y) set variables
CMAKE_INSTALL_PREFIX /usr/pkg
QT_QMAKE_EXECUTABLE /usr/pkg/qt4/bin/qmake
press c, press c, press g
z) gmake -j4, where 4 is number of processors or cores of processor,
gmake install
10. Install boost package with command: pkg_add -v boost
11. Install doxygen package with command: pkg_add -v doxygen
12. Build and install Coin3D series:
a) install flac package with command pkg_add -v flac
b) install libsndfile with command pkg_add -v libsndfile
c) install simage wigh command pkg_add -v simage
d) build and install Coin3D
- download Coin-3.1.3.tar.gz from https://bitbucket.org/Coin3D/coin/downloads/
- gtar -zxf Coin-3.1.3.tar.gz
- cd Coin-3.1.3
- insert line #include <Inventor/C/errors/debugerror.h>
to include/Inventor/SbBasic.h
- insert line #include <cstdlib> at line 50
to src/fonts/freetype.cpp
right before the extern "C" code
- replace all instances /usr/local with /usr/pkg in configure file
- mkdir coin3d-build
- cd coin3d-build
- ../configure
- gmake -j4, where 4 is number of processors or number of cores of processor
- gmake install
e) build and install Coin3D-soqt
- download Coin3D-soqt-bef9d6df88b9.zip from https://bitbucket.org/Coin3D/soqt/downloads/
- run command: unzip Coin3D-soqt-bef9d6df88b9.zip
- cd Coin3D-soqt-bef9d6df88b9
- download Coin3D-sogui-04d1d8732971.zip from https://bitbucket.org/Coin3D/sogui/downloads/ to src/Inventor/Qt
- unzip Coin3D-sogui-04d1d8732971.zip
- rename Coin3D-sogui-04d1d8732971 to common
- You are in Coin3D-soqt-bef9d6df88b9 directory and replace all instances /usr/local with /usr/pkg in configure file
- export QTDIR=/usr/pkg/qt4
- add QtGui/ before QMenu in src/Inventor/Qt/widgets/QtNativePopupMenu.cpp file
- add QtGui/ before QColormap in src/Inventor/Qt/SoQtGLWidget.cpp file - mkdir soqt-build
- cd soqt-build
- ../configure CPPFLAGS='-I/usr/X11R7/include -I/usr/pkg/qt4/include'
- gmake -j4, where 4 is number of processors or cores of processor
- gmake install
f) build and install Coin3D-pivy
- install swig3 package with command: pkg_add -v swig3
- download Coin3D-pivy-db2e64a4a880.zip from https://bitbucket.org/Coin3D/pivy/downloads/
- unzip Coin3D-pivy-db2e64a4a880.zip
- cd Coin3D-pivy-db2e64a4a880
- python2.7 setup_old.py build
- python2.7 setup_old.py install
13. Install eigen3 package with command: pkg_add -v eigen3
14. Install xerces-c package with command: pkg_add -v xerces-c
15. Install zlib package with command: pkg_add -v zlib
16. Build and install OpenCascade:
a) build and install VTK
- install hdf5 package with command: pkg_add -v hdf5
- download VTK-7.1.1.tar.gz from https://vtk.org/download/
- gtar -zxf VTK-7.1.1.tar.gz
- cd VTK-7.1.1
- add && !defined(__NetBSD__) to IO/LSDyna/private/LSDynaFamily.cxx at 38 line
- mkdir build
- cd build
- ccmake ..
press c, wait, press e
- set variables
CMAKE_BUILD_TYPE Release
CMAKE_INSTALL_PREFIX /usr/pkg
EXECUTABLE_OUTPUT_PATH /usr/pkg/bin
LIBRARY_OUTPUT_PATH /usr/pkg/lib
VTK_PYTHON_VERSION 2.7
press t
CMAKE_CXX_FLAGS -L/usr/X11R7/lib -L/usr/pkg/lib -L/usr/pkg/qt4/lib
INSTALL_BIN_DIR /usr/pkg/bin
INSTALL_INC_DIR /usr/pkg/include
INSTALL_LIB_DIR /usr/pkg/lib
INSTALL_MAN_DIR /usr/pkg/share/man
INSTALL_PKGCONFIG_DIR /usr/pkg/share/pkgconfig
press c, wait, press e, press g
- gmake -j4, where 4 is number of processors or cores of processor
- gmake install
b) download occt-2a8846f.tar.gz from https://git.dev.opencascade.org/gitweb/ ... 5eb3842d75
(search for link tar.gz on page)
c) gtar -zxf occt-2a8846f.tar.gz
d) cd occt-2a8846f
e) add || defined(__NetBSD__) at 26 line in src/OSD/OSD_Path.cxx
f) insert
} elseif { [ regexp NetBSD $LINE_FROM_UNAME ] } {
return "bsd"
at 33 line in src/DrawResources/InitEnvironment.tcl
g) add
|| defined(__NetBSD__)
at 54 line in src/OSD/OSD_Chronometer.cxx
h) insert
if (!strcmp(info.sysname,"NetBSD")) return (OSD_UnixBSD);
at 74 line
insert
if (!strcmp(info.sysname,"NetBSD")) return (OSD_LIN);
at 156 line in src/OSD/OSD_Host.cxx
i) add
&& !defined(__NetBSD__)
at 83 line in src/Standard/Standard_CString.cxx
j) add
|| defined(__NetBSD__)
at 252 line in src/Standard/Standard_MMgrOpt.cxx
k) mkdir build
l) cd build
m) ccmake ..
press c, wait
n) set variables
INSTALL_DIR /usr/pkg
USE_VTK ON
press t
CMAKE_CXX_FLAGS -I/usr/X11R7/include -I/usr/pkg/include -L/usr/X11R7/lib -L/usr/pkg/lib
press c, wait, press c, wait, press g
o) gmake -j4, where 4 is number of processors or cores of processor
In this step error will occur related to -ldl. Run command:
find . -name 'link.txt' | xargs sed -i 's: -ldl::g'
which remove -ldl from all link.txt files.
p) run gmake -j4 again
r) gmake install
17. Build and install MED
a) download med-3.0.7.tar.gz from https://forge.scilab.org/index.php/p/me ... tallation/
b) gtar -zxf med-3.0.7.tar.gz
c) cd med-3.0.7
d) replace
MEDequivInfo(int fid, char *maa, int ind, char *eq, char *des)
with
MEDequivInfo(med_idt fid, char *maa, int ind, char *eq, char *des)
in src/2.3.6/ci/MEDequivInfo.c
e) mkdir build
f) cd build
g) ccmake ..
press c, wait, press e
h) set variables:
CMAKE_INSTALL_PREFIX /usr/pkg
press c, wait, press e, press g
i) gmake -j4 where 4 is number of processors or cores of processor
j) gmake install
18. Build and install pybind11
a) install py27-pip package with command pkg_add -v py27-pip
b) run command:
/usr/pkg/bin/python2.7 -m pip install pytest
c) install catch package with command pkg_add -v catch
d) download pybind11-master.zip from https://github.com/pybind/pybind11
(Clone or download button)
e) unzip pybind11-master.zip
f) cd pybind11-master
g) mkdir build
h) cd build
i) ccmake ..
press c, wait
j) set variables:
CATCH_INCLUDE_DIR /usr/pkg/include
CMAKE_INSTALL_PREFIX /usr/pkg
PYBIND11_PYTHON_VERSION 2.7
USE_PYTHON_INCLUDE_DIR ON
press c, wait, press g
k) gmake -j4, where 4 is number of processors or number of cores of processor
l) gmake install
19. Build and install orocos-kdl
a) download orocos_kinematics_dynamics-master.zip from https://github.com/orocos/orocos_kinematics_dynamics
(Clone or download button)
b) unzip orocos_kinematics_dynamics-master.zip
c) cd orocos_kinematics_dynamics-master
d) cd orocos_kdl
e) mkdir build
f) cd build
g) ccmake ..
press c, wait
h) set variables:
CMAKE_INSTALL_PREFIX /usr/pkg
press c, press g
i) gmake -j4, where 4 is number of processors or number of cores of processor
j) gmake install
20. Build and install freecad 0.17
a) download FreeCAD-0.17.tar.gz from https://github.com/FreeCAD/FreeCAD/releases/tag/0.17
b) gtar -zxf FreeCAD-0.17.tar.gz
c) cd FreeCAD-0.17
d) change python to python27 at 25 line in src/Mod/Path/libarea/CMakeLists.txt.
If you don't do it, you will get error then:
Could not find the following Boost libraries:
boost_python
e) add && !defined(__NetBSD__) at 61 line
ad || defined(__NetBSD__) at 84 line in src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh.cpp
f) mkdir build
g) cd build
h) ccmake ..
press c, wait, press e
i) set variables:
CMAKE_INSTALL_PREFIX /usr/pkg
FREECAD_USE_OCC_VARIANT Official Version
OCC_INCLUDE_DIR /usr/pkg/include/opencascade
press c, wait, press e
MpidotH /usr/pkg/include/mpi.h
FREECAD_USE_EXTERNAL_KDL ON
press t
CMAKE_CXX_FLAGS -L/usr/X11R7/lib -L/usr/pkg/lib -L/usr/pkg/qt4/lib -I/usr/X11R7/include -I/usr/pkg/qt4/include
press c, wait, press e, press c, press e, press g
j) gmake -j4, where 4 is number of processors or number of cores of processor
k) gmake install
21. Run command: unset PKG_PATH

After installation loged as user (group wheel):
1. Run command: export LD_LIBRARY_PATH=/usr/pkg/lib:/usr/pkg/qt4/lib:/usr/X11R7/lib
2. cd /usr/pkg
3. Try run FreeCAD with command:
FreeCAD &
and you will get SEGMANTATION FAULT which is related to Start workbench
4. Start GNU debuger with command:
gdb FreeCAD
5. Run command:
run
6. FreeCAD should run. Go to Edit menu, Preferences and change moudule running at start up, for example Part design, OK
7. go to File menu, Exit
8. Quit GNU debbuer with command:
quit
9. Run command:
FreeCAD &
Last edited by gh2 on Thu Mar 21, 2019 10:05 pm, edited 4 times in total.
wmayer
Site Admin
Posts: 14425
Joined: Thu Feb 19, 2009 10:32 am

Re: Porting FreeCAD to BSD (NetBSD and cousins) and other stuff

Postby wmayer » Sun Mar 10, 2019 8:00 am

I installed FreeCAD 0.17 on NetBSD 8.0 for Intel processor but Draft and Arch workbenches don't work.
Do you get any feedback why the workbenches don't work? What about the Path workbench? Can this be activated?
gh2
Posts: 19
Joined: Tue Jan 08, 2019 1:14 pm

Re: Porting FreeCAD to BSD (NetBSD and cousins) and other stuff

Postby gh2 » Sun Mar 10, 2019 11:48 am

The workbenches Arch, Draft and Path don't run. The same error on start of the workbench:
assertion "!this->isBad()" failed: file "../../../src/misc/SoType.cpp", line 730, function "SbBool SoType::isDerivedFrom(SoType) const"
wmayer
Site Admin
Posts: 14425
Joined: Thu Feb 19, 2009 10:32 am

Re: Porting FreeCAD to BSD (NetBSD and cousins) and other stuff

Postby wmayer » Sun Mar 10, 2019 1:05 pm

gh2 wrote:
Sun Mar 10, 2019 11:48 am
The workbenches Arch, Draft and Path don't run. The same error on start of the workbench:
assertion "!this->isBad()" failed: file "../../../src/misc/SoType.cpp", line 730, function "SbBool SoType::isDerivedFrom(SoType) const"
This is an indication that your pivy version links a different version of Coin3d compared to FreeCAD.
gh2
Posts: 19
Joined: Tue Jan 08, 2019 1:14 pm

Re: Porting FreeCAD to BSD (NetBSD and cousins) and other stuff

Postby gh2 » Sun Mar 10, 2019 6:52 pm

wmayer wrote:
Sun Mar 10, 2019 1:05 pm
This is an indication that your pivy version links a different version of Coin3d compared to FreeCAD.
No, I don't think it is pivy link to different version of Coin3d than FreeCAD. Module Mod/Draft/InitGui.py detects different versions of Coin3D.
The solution is installation of Coin3D-simvoleon.
So, build and install Coin3D-simvoleon:
- download Coin3D-simvoleon-73d468e78a8f.zip from https://bitbucket.org/Coin3D/simvoleon/downloads/
- unzip Coin3D-simvoleon-73d468e78a8f.zip
- cd Coin3D-simvoleon-73d468e78a8f
- replace all instances /usr/local with /usr/pkg in configure file
- mkdir sim-build
- mkdir lib/VolumeViz/Coin
- copy directory /src/share/gl from Coin-3.1.3 (unpacked in earlier step) to lib/VolumeViz/Coin
- cd sim-build
- ../configure
- gmake -j4, where 4 is number of processors or cores of processor in your computer
- gmake install

[2019-03-23 I must write some comment to above post. The installation of simvoleon got efect just in case of my version 1 installation of FreeCAD. So, I don't recomend install simvoleon and version 1 installation of FreeCAD. gh2]
Last edited by gh2 on Sat Mar 23, 2019 10:40 pm, edited 3 times in total.