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!
gh2
Posts: 19
Joined: Tue Jan 08, 2019 1:14 pm

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

Post by gh2 »

But that was about different versions of Coin not about different versions of Coin and Pivy ?
Draft module checks at the beginning different versions of Coin. It would be another message.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

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

Post by triplus »

If Pivy depends on a different version of Coin, compared to the Coin version you used, when compiling FreeCAD, then such issue can be the outcome. Where did you get the Pivy and Coin from?
gh2
Posts: 19
Joined: Tue Jan 08, 2019 1:14 pm

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

Post by gh2 »

I have
Coin3D-pivy-db2e64a4a880.zip from https://bitbucket.org/Coin3D/pivy/downloads/
Coin-3.1.3.tar.gz from https://bitbucket.org/Coin3D/coin/downloads/
and I use swig 3.0.12

OK. I have found other site in Internet whit other versions. Maybe I will try other one.
Last edited by gh2 on Thu Mar 21, 2019 9:09 am, edited 1 time in total.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

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

Post by triplus »

And you didn't install any other Coin version on this system in the past? And therefore possibly compile FreeCAD against that Coin version?
gh2
Posts: 19
Joined: Tue Jan 08, 2019 1:14 pm

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

Post by gh2 »

Version 2 - My building FreeCAD 0.17 from source code on NetBSD 8.0

This version without Pivy (Draft, Arch and Path workbenches will be disabled) and Start workbench (Start workbench does not work), with oce (Open Cascade Community Edition).
(Binary packages have /usr/pkg install prefix mostly. I installed other items in /usr/pkg too becasue of search python path.)

I made the following steps as root:
  1. Set path to binary packages repository from 8.0_2018Q3 release with command:
    export PKG_PATH=ftp://ftp.NetBSD.org/pub/pkgsrc/package ... 2018Q3/All
  2. Install binary packages:
    pkg_add cmake
    pkg_add gmake
    pkg_add gtar
    pkg_add ccache
    pkg_add python27
    pkg_add py27-matplotlib
    pkg_add qt4
    pkg_add boost
    pkg_add doxygen
    pkg_add eigen3
    pkg_add xerces-c
    pkg_add zlib
    pkg_add Coin
    pkg_add oce
    pkg_add zip
    pkg_add swig3
  3. Run commands:
    export PATH=$PATH:/usr/pkg/qt4/bin
    export QTDIR=/usr/pkg/qt4
  4. Build and install pybind11:
    • download pybind11-master.zip from https://github.com/pybind/pybind11 (Clone or download button)
    • unzip -a pybind11-master.zip
      cd pybind11-master
      mkdir build
      cd build
      ccmake ..
    • press c, wait, press e
      set variables:
      CMAKE_INSTALL_PREFIX /usr/pkg
      PYBIND11_PYTHON_VERSION 2.7
      PYBIND11_TEST OFF
      press c, wait, press c, press g
    • gmake -jn place number of processors or number of cores of processor in your computer insted of n
    • gmake install
  5. Build and install pyside 1.2.2 group:
    • 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
    • build and install shiboken
      • install libxslt package using the command pkg_add libxslt
      • gtar -jxf shiboken-1.2.2.tar.bz2
        cd shiboken-1.2.2
      • replace

        Code: Select all

        #define __STDC__
        with

        Code: Select all

        #define __STDC__ 1
        in ApiExtractor/parser/rpp/pp-qt-configuration
      • insert Code1 (Code1 is at the bottom of this report) at the beginnig of CMakeLists.txt
      • mkdir build
        cd build
        ccmake ..
      • press c, wait, press e
        set variables
        BUILD_TESTS OFF
        CMAKE_BUILD_TYPE Release
        CMAKE_INSTALL_PREFIX /usr/pkg
        press t
        CMAKE_CXX_FLAGS -I/usr/X11R7/include
        press c, press e, press g
      • gmake -jn place number of processors or number of cores of processor in your computer insted of n
      • gmake install
    • build and install pyside-qt4.8
      • gtar -jxf pyside-qt4.8+1.2.2.tar.bz2
        cd pyside-qt4.8+1.2.2
      • insert Code1 (Code1 is at the bottom of this report) at the beginnig of CMakeLists.txt
      • mkdir build
        cd build
        ccmake ..
      • press c, wait
        set variables
        BUILD_TESTS OFF
        CMAKE_BUILD_TYPE Release
        CMAKE_INSTALL_PREFIX /usr/pkg
        press t
        CMAKE_CXX_FLAGS -I/usr/X11R7/include
        press c, wait, press g
      • gmake -jn place number of processors or number of cores of processor in your computer insted of n
      • gmake install
    • build and install pyside-tools
      • gtar -zxf Tools-0.2.15.tar.gz
        cd Tools-0.2.15
      • insert Code1 at the beginnig of CMakeLists.txt
      • mkdir build
        cd build
        ccmake ..
      • press c, wait
        set variables
        BUILD_TESTS OFF
        CMAKE_BUILD_TYPE Release
        CMAKE_INSTALL_PREFIX /usr/pkg
        press t
        CMAKE_CXX_FLAGS -I/usr/X11R7/include
        press c, wait, press g
      • gmake -jn place number of processors or number of cores of processor in your computer insted of n
      • gmake install
  6. Build and install VTK
    • install hdf5 package using the command pkg_add 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

      Code: Select all

      && !defined(__NetBSD__)
      to 38 line in IO/LSDyna/private/LSDynaFamily.cxx file
    • insert Code1 at the beginnig of CMakeLists.txt
    • mkdir build
      cd build
      ccmake ..
    • press c, wait, press e
      set variables
      CMAKE_BUILD_TYPE Release
      CMAKE_INSTALL_PREFIX /usr/pkg
      VTK_PYTHON_VERSION 2.7
      press c, wait, press e, press g
    • gmake -jn place number of processors or number of cores of processor in your computer insted of n
    • gmake install
  7. Build and install MED
    • download med-3.0.7.tar.gz from https://forge.scilab.org/index.php/p/me ... tallation/
    • gtar -zxf med-3.0.7.tar.gz
      cd med-3.0.7
    • insert Code1 at the beginnig of CMakeLists.txt
    • replace

      Code: Select all

      MEDequivInfo(int fid, char *maa, int ind, char *eq, char *des)
      with

      Code: Select all

      MEDequivInfo(med_idt fid, char *maa, int ind, char *eq, char *des)
      in src/2.3.6/ci/MEDequivInfo.c
    • mkdir build
      cd build
      ccmake ..
    • press c, wait, press e
      set variables:
      CMAKE_BUILD_TYPE Release
      CMAKE_INSTALL_PREFIX /usr/pkg
      press t
      CMAKE_CXX_FLAGS -L/usr/pkg/lib/gcc-lib/x86_64--netbsd/4.1.2 -R/usr/pkg/lib/gcc-lib/x86_64--netbsd/4.1.2
      press c, wait, press e, press g
    • gmake -jn place number of processors or number of cores of processor in your computer insted of n
    • gmake install
  8. Build and install FreeCAD 0.17
    • download FreeCAD-0.17.tar.gz from https://github.com/FreeCAD/FreeCAD/releases/tag/0.17
    • gtar -zxf FreeCAD-0.17.tar.gz
    • remove ^M dos signs from archive:
      pack FreeCAD-0.17 directory to FreeCAD-0.17.zip using the command zip -r FreeCAD-0.17.zip FreeCAD-0.17
      rm -r FreeCAD-0.17
      unzip -a FreeCAD-0.17.zip
      rm FreeCAD-0.17.zip
      cd FreeCAD-0.17
    • change

      Code: Select all

      python
      to

      Code: Select all

      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
    • add

      Code: Select all

      && !defined(__NetBSD__)
      at 60 line
      add

      Code: Select all

      || defined(__NetBSD__)
      at 84 line in src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh.cpp
    • replace

      Code: Select all

      mib[1] = KERN_PROC;
      mib[2] = KERN_PROC_PATHNAME;
      mib[3] = -1;
      with

      Code: Select all

      mib[1] = KERN_PROC_ARGS;
      mib[2] = -1;
      mib[3] = KERN_PROC_PATHNAME;
      in src/App/Application.cpp
    • insert Code1 at the beginnig of CMakeLists.txt
    • mkdir build
      cd build
      ccmake ..
    • press c, wait, press e
      set variables:
      BUILD_START OFF
      CMAKE_BUILD_TYPE Release
      CMAKE_INSTALL_PREFIX /usr/pkg
      MpidotH /usr/pkg/include/mpi.h
      press t
      CMAKE_CXX_FLAGS -I/usr/X11R7/include -L/usr/X11R7/lib
      press c, wait, press e, press g
    • gmake -jn place number of processors or number of cores of processor in your computer insted of n
    • gmake install
  9. Run command: unset PKG_PATH


After installation as user who has started X windows run command: FreeCAD &

APPENDIX

Below code allows cmake automaticaly set RPATH to libraries and setting LD_LIBRARY_PATH is not needed.

Code: Select all

#Code 1 (Always full RPATH)

# use, i.e. don't skip the full RPATH for the build tree
SET(CMAKE_SKIP_BUILD_RPATH  FALSE)

# when building, don't use the install RPATH already
# (but later on when installing)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)

SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")

# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)


# the RPATH to be used when installing, but only if it's not a system directory
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib"
 isSystemDir)
IF("${isSystemDir}" STREQUAL "-1")
   SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
ENDIF("${isSystemDir}" STREQUAL "-1")

#End of Code1
Last edited by gh2 on Mon Mar 25, 2019 12:16 am, edited 8 times in total.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

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

Post by Kunda1 »

gh2 wrote: Fri Mar 22, 2019 12:46 am This version without Pivy (Draft, Arch and Path workbenches will be disabled), with oce (Open Cascade Community Edition).
(Binary packages have /usr/pkg install prefix mostly. I installed other items in /usr/pkg too becasue of search python path.)
Wow. involved.
How about python3/Qt5 and for version 0.18 ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
gh2
Posts: 19
Joined: Tue Jan 08, 2019 1:14 pm

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

Post by gh2 »

Kunda1 wrote: Fri Mar 22, 2019 2:14 pm
gh2 wrote: Fri Mar 22, 2019 12:46 am This version without Pivy (Draft, Arch and Path workbenches will be disabled), with oce (Open Cascade Community Edition).
(Binary packages have /usr/pkg install prefix mostly. I installed other items in /usr/pkg too becasue of search python path.)
Wow. involved.
How about python3/Qt5 and for version 0.18 ?
I do not fly so high ;)
Seriously, I wrote in one of the previous messages that I can not even build qt4 from the source code. And I laughed at myself. I'm not the creator of the packages.
A whole army of people is probably working on FreeCAD 0.18.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

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

Post by triplus »

Nice progress @gh2.

P.S. Such progress does indicate, that eventually people using BSD platforms, should experience FreeCAD in a more streamlined way.
gh2
Posts: 19
Joined: Tue Jan 08, 2019 1:14 pm

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

Post by gh2 »

Version 3 - My building FreeCAD 0.17 from source code on NetBSD 8.0

This version without Start workbench (Start workbench does not work), with oce (Open Cascade Community Edition).
(Binary packages use /usr/pkg install prefix mostly. I installed other items in /usr/pkg too becasue of search python path.)

I made the following steps as root:
  1. Set path to binary packages repository from 8.0_2018Q3 release with command:
    export PKG_PATH=ftp://ftp.NetBSD.org/pub/pkgsrc/package ... 2018Q3/All
  2. Install binary packages:
    pkg_add cmake
    pkg_add gmake
    pkg_add gtar
    pkg_add ccache
    pkg_add python27
    pkg_add py27-matplotlib
    pkg_add qt4
    pkg_add boost
    pkg_add doxygen
    pkg_add eigen3
    pkg_add xerces-c
    pkg_add zlib
    pkg_add Coin
    pkg_add oce
    pkg_add zip
    pkg_add swig3
  3. Run commands:
    export PATH=$PATH:/usr/pkg/qt4/bin
    export QTDIR=/usr/pkg/qt4
  4. Build and install pybind11
    • download pybind11-master.zip from https://github.com/pybind/pybind11
      (Clone or download button)
    • unzip -a pybind11-master.zip
    • cd pybind11-master
    • mkdir build
    • cd build
    • ccmake ..
      press c, wait, press e
    • set variables:
      CMAKE_INSTALL_PREFIX /usr/pkg
      PYBIND11_PYTHON_VERSION 2.7
      PYBIND11_TEST OFF
      press c, wait, press c, press g
    • gmake -jn, place number of processors or number of cores of processor in your computer insted of n
    • gmake install
  5. Build and install pyside 1.2.2 group:
    • 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
    • build and install shiboken
      • install libxslt package using the command pkg_add libxslt
      • gtar -jxf shiboken-1.2.2.tar.bz2
      • cd shiboken-1.2.2
      • Replace

        Code: Select all

        #define __STDC__
        with

        Code: Select all

        #define __STDC__ 1
        in ApiExtractor/parser/rpp/pp-qt-configuration
      • insert Code1 (Code1 is at the bottom of this instruction) at the beginnig of CMakeLists.txt
      • mkdir build
      • cd build
      • ccmake ..
        press c, wait, press e
      • set variables
        BUILD_TESTS OFF
        CMAKE_BUILD_TYPE Release
        CMAKE_INSTALL_PREFIX /usr/pkg (it is needed for python search path)
        press t
        CMAKE_CXX_FLAGS -I/usr/X11R7/include
        press c, press e, press g
      • gmake -jn, place number of processors or number of cores of processor in your computer insted of n
      • gmake install
    • build and install pyside-qt4.8
      • gtar -jxf pyside-qt4.8+1.2.2.tar.bz2
      • cd pyside-qt4.8+1.2.2
      • insert Code1 (Code1 is at the bottom of this instruction) at the beginnig of CMakeLists.txt
      • mkdir build
      • cd build
      • ccmake ..
        press c, wait
      • set variables (pyside uses shiboken in some way)
        BUILD_TESTS OFF
        CMAKE_BUILD_TYPE Release
        CMAKE_INSTALL_PREFIX /usr/pkg
        press t
        CMAKE_CXX_FLAGS -I/usr/X11R7/include
        press c, wait, press g
      • gmake -jn, place number of processors or number of cores of processor in your computer insted of n
      • gmake install
    • build and install pyside-tools
      • gtar -zxf Tools-0.2.15.tar.gz
      • cd Tools-0.2.15
      • insert Code1 at the beginnig of CMakeLists.txt
      • mkdir build
      • cd build
      • ccmake ..
        press c, wait
      • set variables
        BUILD_TESTS OFF
        CMAKE_BUILD_TYPE Release
        CMAKE_INSTALL_PREFIX /usr/pkg
        press t
        CMAKE_CXX_FLAGS -I/usr/X11R7/include
        press c, wait, press g
      • gmake -jn, place number of processors or number of cores of processor in your computer insted of n
      • gmake install
  6. Build and install Pivy
  7. Build and install VTK
    • install hdf5 package using the command pkg_add 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

      Code: Select all

      && !defined(__NetBSD__) 
      to 38 line in IO/LSDyna/private/LSDynaFamily.cxx file
    • insert Code1 at the beginnig of CMakeLists.txt
    • mkdir build
    • cd build
    • ccmake ..
      press c, wait, press e
    • set variables
      CMAKE_BUILD_TYPE Release
      CMAKE_INSTALL_PREFIX /usr/pkg
      VTK_PYTHON_VERSION 2.7
      press c, wait, press e, press g
    • gmake -jn, place number of processors or number of cores of processor in your computer insted of n
    • gmake install
  8. Build and install MED
    • download med-3.0.7.tar.gz from https://forge.scilab.org/index.php/p/me ... tallation/
    • gtar -zxf med-3.0.7.tar.gz
    • cd med-3.0.7
    • insert Code1 at the beginnig of CMakeLists.txt
    • replace

      Code: Select all

      MEDequivInfo(int fid, char *maa, int ind, char *eq, char *des)
      with

      Code: Select all

      MEDequivInfo(med_idt fid, char *maa, int ind, char *eq, char *des)
      in src/2.3.6/ci/MEDequivInfo.c
    • mkdir build
    • cd build
    • ccmake ..
      press c, wait, press e
    • set variables:
      CMAKE_BUILD_TYPE Release
      CMAKE_INSTALL_PREFIX /usr/pkg
      press t
      CMAKE_CXX_FLAGS -L/usr/pkg/lib/gcc-lib/x86_64--netbsd/4.1.2 -R/usr/pkg/lib/gcc-lib/x86_64--netbsd/4.1.2
      press c, wait, press e, press g
    • gmake -jn, place number of processors or number of cores of processor in your computer insted of n
    • gmake install
  9. Build and install freecad 0.17
    • download FreeCAD-0.17.tar.gz from https://github.com/FreeCAD/FreeCAD/releases/tag/0.17
    • gtar -zxf FreeCAD-0.17.tar.gz
    • remove ^M dos signs from archive:
      pack FreeCAD-0.17 directory to FreeCAD-0.17.zip using the command zip -r FreeCAD-0.17.zip FreeCAD-0.17
      rm -r FreeCAD-0.17
      unzip -a FreeCAD-0.17.zip
      rm FreeCAD-0.17.zip
    • cd FreeCAD-0.17
    • change

      Code: Select all

      python
      to

      Code: Select all

      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
    • add

      Code: Select all

      && !defined(__NetBSD__) 
      at 60 line
      add

      Code: Select all

      || defined(__NetBSD__)
      at 84 line in src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh.cpp
    • replace

      Code: Select all

      mib[1] = KERN_PROC;
      mib[2] = KERN_PROC_PATHNAME;
      mib[3] = -1; 
      with

      Code: Select all

      mib[1] = KERN_PROC_ARGS;
      mib[2] = -1; 
      mib[3] = KERN_PROC_PATHNAME;
      in src/App/Application.cpp
    • there is a bug in FreeCAD-0.17.tar.gz source code related to https://www.freecadweb.org/tracker/view.php?id=3478. But fix https://github.com/FreeCAD/FreeCAD/commit/4f5e304d6 was only aplied to FreeCAD 0.18. For this reason you must follow:
      • replace line 344

        Code: Select all

        PyObject* unicode = PyUnicode_AsLatin1String(value);
        with

        Code: Select all

        PyObject* unicode = PyUnicode_AsUTF8String(value); 
        in src/App/DocumentPyImp.cpp
      • replace line 274

        Code: Select all

        FreeCADGui.doCommand('base=FreeCAD.ActiveDocument.addObject("Sketcher::SketchObject","'+translate('Arch','WallTrace')+'")')
        with

        Code: Select all

        FreeCADGui.doCommand('base=FreeCAD.ActiveDocument.addObject("Sketcher::SketchObject","WallTrace")')
        in src/Mod/Arch/ArchWall.py
    • insert Code1 at the beginnig of CMakeLists.txt
    • mkdir build
    • cd build
    • ccmake ..
      press c, wait, press e
    • set variables:
      BUILD_START OFF
      CMAKE_BUILD_TYPE Release
      CMAKE_INSTALL_PREFIX /usr/pkg
      MpidotH /usr/pkg/include/mpi.h
      press t
      CMAKE_CXX_FLAGS -I/usr/X11R7/include -L/usr/X11R7/lib
      press c, wait, press e, press g
    • gmake -jn, place number of processors or number of cores of processor in your computer insted of n
    • gmake install
  10. Run command: unset PKG_PATH
After installation (as user who has started X windows run command):
  1. Run command: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/X11R7/lib
  2. Add line:

    Code: Select all

    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/X11R7/lib
    to your .profile file.
  3. Try run FreeCAD using the command: FreeCAD &

APPENDIX

Code: Select all

#Code 1 (Always full RPATH)

# use, i.e. don't skip the full RPATH for the build tree
SET(CMAKE_SKIP_BUILD_RPATH  FALSE)

# when building, don't use the install RPATH already
# (but later on when installing)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)

SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")

# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)


# the RPATH to be used when installing, but only if it's not a system directory
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib"
 isSystemDir)
IF("${isSystemDir}" STREQUAL "-1")
   SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
ENDIF("${isSystemDir}" STREQUAL "-1")

#End of Code1
Last edited by gh2 on Mon Mar 25, 2019 1:05 am, edited 2 times in total.
gh2
Posts: 19
Joined: Tue Jan 08, 2019 1:14 pm

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

Post by gh2 »

Version 4 - My building FreeCAD 0.17 from source code on NetBSD 8.0

This version with occt (Open Cascade Technology - Official Version) and without Start workbench (Start workbench does not work).
(Binary packages use /usr/pkg install prefix mostly. I installed other items in /usr/pkg too becasue of search python path.)

I made the following steps as root:

  1. Set path to binary packages repository from 8.0_2018Q3 release with command:
    export PKG_PATH=ftp://ftp.NetBSD.org/pub/pkgsrc/package ... 2018Q3/All
  2. Install binary packages:
    pkg_add cmake
    pkg_add gmake
    pkg_add gtar
    pkg_add ccache
    pkg_add python27
    pkg_add py27-matplotlib
    pkg_add qt4
    pkg_add boost
    pkg_add doxygen
    pkg_add eigen3
    pkg_add xerces-c
    pkg_add zlib
    pkg_add Coin
    pkg_add zip
    pkg_add swig3
  3. Run commands:
    export PATH=$PATH:/usr/pkg/qt4/bin
    export QTDIR=/usr/pkg/qt4
  4. Build and install pybind11
    • download pybind11-master.zip from https://github.com/pybind/pybind11
      (Clone or download button)
    • unzip -a pybind11-master.zip
    • cd pybind11-master
    • mkdir build
    • cd build
    • ccmake ..
      press c, wait, press e
    • set variables:
      CMAKE_INSTALL_PREFIX /usr/pkg
      PYBIND11_PYTHON_VERSION 2.7
      PYBIND11_TEST OFF
      press c, wait, press c, press g
    • gmake -jn, place number of processors or number of cores of processor in your computer insted of n
    • gmake install
  5. Build and install pyside 1.2.2 group:
    • 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
    • build and install shiboken
      • install libxslt package using the command pkg_add libxslt
      • gtar -jxf shiboken-1.2.2.tar.bz2
      • cd shiboken-1.2.2
      • Replace

        Code: Select all

        #define __STDC__
        with

        Code: Select all

        #define __STDC__ 1
        in ApiExtractor/parser/rpp/pp-qt-configuration
      • insert Code1 (Code1 is at the bottom of this instruction) at the beginnig of CMakeLists.txt
      • mkdir build
      • cd build
      • ccmake ..
        press c, wait, press e
      • set variables
        BUILD_TESTS OFF
        CMAKE_BUILD_TYPE Release
        CMAKE_INSTALL_PREFIX /usr/pkg (it is needed for python search path)
        press t
        CMAKE_CXX_FLAGS -I/usr/X11R7/include
        press c, wait, press g
      • gmake -jn, place number of processors or number of cores of processor in your computer insted of n
      • gmake install
    • build and install pyside-qt4.8
      • gtar -jxf pyside-qt4.8+1.2.2.tar.bz2
      • cd pyside-qt4.8+1.2.2
      • insert Code1 (Code1 is at the bottom of this instruction) at the beginnig of CMakeLists.txt
      • mkdir build
      • cd build
      • ccmake ..
        press c, wait
      • set variables
        BUILD_TESTS OFF
        CMAKE_BUILD_TYPE Release
        CMAKE_INSTALL_PREFIX /usr/pkg
        press t
        CMAKE_CXX_FLAGS -I/usr/X11R7/include
        press c, wait, press g
      • gmake -jn, place number of processors or number of cores of processor in your computer insted of n
      • gmake install
    • build and install pyside-tools
      • gtar -zxf Tools-0.2.15.tar.gz
      • cd Tools-0.2.15
      • insert Code1 at the beginnig of CMakeLists.txt
      • mkdir build
      • cd build
      • ccmake ..
        press c, wait
      • set variables
        BUILD_TESTS OFF
        CMAKE_BUILD_TYPE Release
        CMAKE_INSTALL_PREFIX /usr/pkg
        press t
        CMAKE_CXX_FLAGS -I/usr/X11R7/include
        press c, wait, press g
      • gmake -jn, place number of processors or number of cores of processor in your computer insted of n
      • gmake install
  6. Build and install Pivy
  7. Build and install VTK
    • install hdf5 package using the command pkg_add 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

      Code: Select all

      && !defined(__NetBSD__)
      to 38 line in IO/LSDyna/private/LSDynaFamily.cxx file
    • insert Code1 at the beginnig of CMakeLists.txt
    • mkdir build
    • cd build
    • ccmake ..
      press c, wait, press e
    • set variables
      CMAKE_BUILD_TYPE Release
      CMAKE_INSTALL_PREFIX /usr/pkg
      VTK_PYTHON_VERSION 2.7
      press c, wait, press e, press g
    • gmake -jn, place number of processors or number of cores of processor in your computer insted of n
    • gmake install
  8. Build and install OpenCascade:
    • download https://git.dev.opencascade.org/gitweb/ ... 6f0;sf=tgz
    • gtar -zxf occt-e1c1585.tar.gz
    • cd occt-e1c1585
    • insert Code1 at the beginnig of CMakeLists.txt
    • add

      Code: Select all

      || defined(__NetBSD__)
      to 26 line in src/OSD/OSD_Path.cxx
    • insert

      Code: Select all

      } elseif { [ regexp NetBSD $LINE_FROM_UNAME ] } {
      return "bsd"
      at 33 line into src/DrawResources/InitEnvironment.tcl
    • add

      Code: Select all

      || defined(__NetBSD__)
      to 54 line in src/OSD/OSD_Chronometer.cxx
    • insert

      Code: Select all

      if (!strcmp(info.sysname,"NetBSD"))         return (OSD_UnixBSD);
      at 74 line
      insert

      Code: Select all

      if (!strcmp(info.sysname,"NetBSD"))        return (OSD_LIN);
      at 156 line into src/OSD/OSD_Host.cxx
    • add

      Code: Select all

      && !defined(__NetBSD__)
      to 83 line in src/Standard/Standard_CString.cxx
    • add

      Code: Select all

      || defined(__NetBSD__)
      to 252 line in src/Standard/Standard_MMgrOpt.cxx
    • to avoid -ldl errors delete line with

      Code: Select all

      CSF_dl
      from src/TKernel/EXTERNLIB file
    • mkdir build
    • cd build
    • ccmake ..
      press c, wait
    • set variables
      INSTALL_DIR /usr/pkg
      USE_VTK ON
      press t
      CMAKE_CXX_FLAGS -L/usr/X11R7/lib -I/usr/X11R7/include
      press c, wait, press c, wait, press g
    • gmake -jn, place number of processors or number of cores of processor in your computer insted of n
    • gmake install
  9. Build and install MED
    • download med-3.0.7.tar.gz from https://forge.scilab.org/index.php/p/me ... tallation/
    • gtar -zxf med-3.0.7.tar.gz
    • cd med-3.0.7
    • insert Code1 at the beginnig of CMakeLists.txt
    • replace

      Code: Select all

      MEDequivInfo(int fid, char *maa, int ind, char *eq, char *des)
      with

      Code: Select all

      MEDequivInfo(med_idt fid, char *maa, int ind, char *eq, char *des)
      in src/2.3.6/ci/MEDequivInfo.c
    • mkdir build
    • cd build
    • ccmake ..
      press c, wait, press e
    • set variables:
      CMAKE_BUILD_TYPE Release
      CMAKE_INSTALL_PREFIX /usr/pkg
      press t
      CMAKE_CXX_FLAGS -L/usr/pkg/lib/gcc-lib/x86_64--netbsd/4.1.2 -R/usr/pkg/lib/gcc-lib/x86_64--netbsd/4.1.2
      press c, wait, press e, press g
    • gmake -jn, place number of processors or number of cores of processor in your computer insted of n
      gmake install
  10. Build and install FreeCAD 0.17
    • download FreeCAD-0.17.tar.gz from https://github.com/FreeCAD/FreeCAD/releases/tag/0.17
    • gtar -zxf FreeCAD-0.17.tar.gz
    • remove ^M dos signs from archive:
      pack FreeCAD-0.17 directory to FreeCAD-0.17.zip using the command zip -r FreeCAD-0.17.zip FreeCAD-0.17
      rm -r FreeCAD-0.17
      unzip -a FreeCAD-0.17.zip
      rm FreeCAD-0.17.zip
    • delete zip package using command pkg_delete zip
    • cd FreeCAD-0.17
    • change

      Code: Select all

      python
      to

      Code: Select all

      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
    • add

      Code: Select all

      && !defined(__NetBSD__)
      at 60 line
    • add

      Code: Select all

      || defined(__NetBSD__)
      at 84 line in src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh.cpp
    • replace

      Code: Select all

      mib[1] = KERN_PROC;
      mib[2] = KERN_PROC_PATHNAME;
      mib[3] = -1; 
      with

      Code: Select all

      mib[1] = KERN_PROC_ARGS;
      mib[2] = -1; 
      mib[3] = KERN_PROC_PATHNAME;
      in src/App/Application.cpp
    • there is a bug in FreeCAD-0.17.tar.gz source code related to https://www.freecadweb.org/tracker/view.php?id=3478. But fix https://github.com/FreeCAD/FreeCAD/commit/4f5e304d6 was only aplied to FreeCAD 0.18. For this reason you must follow:
      replace line 344

      Code: Select all

      PyObject* unicode = PyUnicode_AsLatin1String(value);
      with

      Code: Select all

      PyObject* unicode = PyUnicode_AsUTF8String(value); 
      in src/App/DocumentPyImp.cpp
      replace line 274

      Code: Select all

      FreeCADGui.doCommand('base=FreeCAD.ActiveDocument.addObject("Sketcher::SketchObject","'+translate('Arch','WallTrace')+'")')
      with

      Code: Select all

      FreeCADGui.doCommand('base=FreeCAD.ActiveDocument.addObject("Sketcher::SketchObject","WallTrace")')
      src/Mod/Arch/ArchWall.py
    • insert Code1 at the beginnig of CMakeLists.txt
    • mkdir build
    • cd build
    • ccmake ..
      press c, wait, press e
    • set variables:
      BUILD_START OFF
      CMAKE_BUILD_TYPE Release
      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
      press t
      CMAKE_CXX_FLAGS -I/usr/X11R7/include -L/usr/X11R7/lib
      press c, wait, press e, press g
    • gmake -jn, place number of processors or number of cores of processor in your computer insted of n
    • gmake install
  11. Run command: unset PKG_PATH
After installation (as a user who has started X Windows):
  1. Run command: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/X11R7/lib
  2. Add line: export LD_LIBRARY_PATH=$LD_LIBARY_PATH:/usr/X11R7/lib
    to your .profile file.
  3. Try run FreeCAD using the command: FreeCAD &
APPENDIX

Code: Select all

#Code 1 (Always full RPATH)

# use, i.e. don't skip the full RPATH for the build tree
SET(CMAKE_SKIP_BUILD_RPATH  FALSE)

# when building, don't use the install RPATH already
# (but later on when installing)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)

SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")

# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)


# the RPATH to be used when installing, but only if it's not a system directory
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib"
 isSystemDir)
IF("${isSystemDir}" STREQUAL "-1")
   SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
ENDIF("${isSystemDir}" STREQUAL "-1")

#End of Code1
Post Reply