compile FreeCAD 0.17 with occt 7.1.0 and netgen, script for Xenial and Jessie

Having trouble installing or compiling FreeCAD? Get help here.
luvres
Posts: 15
Joined: Thu Apr 28, 2016 10:54 pm

Re: compile FreeCAD 0.17 with occt 7.1.0 and netgen, script for Xenial and Jessie

Postby luvres » Mon Jul 31, 2017 3:43 pm

I have tried compiling FreeCAD on Xenial and Jessie.
I did this on docker. I hope to help in some way. I'll post here the scripts I used.
I would like to learn, contribute and participate more in the FreeCAD project.

FreeCAD 0.17 -> libMED 3.2.0, VTK-8.0.0, occt-7.1.0p1, netgen-5.3.1, Calculix-2.12 -> Debian Jessie (8.9)
https://github.com/luvres/freecad/blob/ ... Dockerfile

Code: Select all

FROM izone/freecad:nvidia-jessie
MAINTAINER Leonardo Loures <luvres@hotmail.com>

# References:
# https://gist.github.com/berndhahnebach/38d5bfe73134928c0a1ad001a94df05f
# https://github.com/berndhahnebach/Netgen
# https://sourceforge.net/p/netgen-mesher/wiki/Home/
# https://aur.archlinux.org/packages

ENV FREECAD=/opt/local/FreeCAD-0.17
RUN \
    cd \
    && mkdir -p $FREECAD \
    \
    && package_list=" doxygen \
                      libboost1.55-dev \
                      libboost-filesystem1.55-dev \
                      libboost-program-options1.55-dev \
                      libboost-python1.55-dev \
                      libboost-regex1.55-dev \
                      libboost-signals1.55-dev \
                      libboost-system1.55-dev \
                      libboost-thread1.55-dev \
                      libcoin80 \
                      libcoin80-dev \
                      libeigen3-dev \
                      libpyside-dev \
                      libqtcore4 \
                      libshiboken-dev \
                      libxerces-c-dev \
                      libxmu-dev \
                      libxmu-headers \
                      libxmu6 \
                      libxmuu-dev \
                      libxmuu1 \
                      pyside-tools \
                      python-dev \
                      python-pyside \
                      python-matplotlib \
                      qt4-dev-tools \
                      qt4-qmake \
                      libqtwebkit-dev \
                      shiboken \
                      gmsh \
                      swig " \
    \
    && apt-get update \
    && apt-get install -y \
        dictionaries-common wget \
        $package_list \
        python-pivy \
        git \
      # Enable backports to build VTK 8
        cmake \
        g++ \
        libfreetype6-dev \
        tcl8.5-dev \
        tk8.5-dev \
        automake \
        libtogl-dev \
        libhdf5-dev

### cmake -> Enable backports to "cmake 3.3 or higher" required by VTK 8
#---------
# RUN \
#     echo 'deb http://deb.debian.org/debian jessie-backports main' > /etc/apt/sources.list.d/backports.list \
#     && apt-get update \
#     && apt-get -t jessie-backports install -y \
#   \
#     cmake

### libMED 3.0.6
#----------------
# RUN apt-get install -y \
#     libmed-dev \
#     libmedc-dev

### libMED 3.2.0
#----------------
RUN \
    cd \
    && mkdir med \
    && cd med \
    && git clone https://github.com/luvres/libMED.git \
  \
  # building MED
    && mkdir build \
    && cd build \
    && cmake ../libMED -DCMAKE_INSTALL_PREFIX:PATH=$FREECAD \
    && make -j$(nproc) \
    && make install

### VTK 7.1.1
#-------------
# 8.0.0
RUN \
    vtk_VERSION_MAJOR=7.1 && \
    vtk_VERSION_MINOR=7.1.1 && \
  \
    cd \
    && mkdir vtk \
    && cd vtk \
    && wget http://www.vtk.org/files/release/${vtk_VERSION_MAJOR}/VTK-${vtk_VERSION_MINOR}.tar.gz \
    && gunzip VTK-${vtk_VERSION_MINOR}.tar.gz \
    && tar xf VTK-${vtk_VERSION_MINOR}.tar \
    && rm VTK-${vtk_VERSION_MINOR}.tar \
  # building VTK
    && mkdir build \
    && cd build \
  \
    && cmake ../VTK-${vtk_VERSION_MINOR} \
            -DCMAKE_INSTALL_PREFIX:PATH=$FREECAD \
            -DVTK_Group_Rendering:BOOL=OFF \
            -DVTK_Group_StandAlone:BOOL=ON \
            -DVTK_RENDERING_BACKEND=None \
  \
    && make -j$(nproc) \
    && make install

### OCCT 7.1.0
#--------------
RUN \
   #url_OCCT="http://git.dev.opencascade.org/gitweb/?p=occt.git;a=snapshot;h=1780d6cc299f1d06eb106f5cfc27731cdaf97a56;sf=tgz" && 
   url_OCCT="http://desktop/Workstation/occt-7.1.0p1.tgz" && \
   dir_OCCT=1780d6c && \
  \
    cd \
    && mkdir occt \
    && cd occt \
  \
    && wget ${url_OCCT} -O occt.tgz \
    && gunzip occt.tgz \
    && tar xf occt.tar \
    && rm occt.tar \
    && cd occt-${dir_OCCT} \
  \
    && bash -c "grep -v vtkRenderingFreeTypeOpenGL src/TKIVtk/EXTERNLIB >& /tmp/EXTERNLIB" \
    && cp /tmp/EXTERNLIB src/TKIVtk/EXTERNLIB \
    && bash -c "grep -v vtkRenderingFreeTypeOpenGL src/TKIVtkDraw/EXTERNLIB >& /tmp/EXTERNLIB" \
    && cp /tmp/EXTERNLIB src/TKIVtkDraw/EXTERNLIB \
  # building OCCT
    && cd .. \
    && mkdir build \
    && cd build \
  \
    && cmake \
        ../occt-${dir_OCCT} \
        -DCMAKE_INSTALL_PREFIX:PATH=$FREECAD \
        -DUSE_VTK:BOOL=OFF \
  \
    && make -j$(nproc) \
    && make install

### Netgen 5.3.1
#----------------
RUN \
    cd \
    && apt-get install -y \
    openmpi-bin libopenmpi-dev \
    && git clone https://github.com/luvres/netgen.git \
    && cd netgen \
  \
  # building Netgen
    && ./configure \
            --prefix=$FREECAD \
            #--with-sysroot=/usr/lib/
            #--with-metis=/usr/lib/x86_64-linux-gnu/
            #--with-togl=/usr/lib/
            --with-tcl=/usr/lib/tcl8.5 \
            --with-tk=/usr/lib/tk8.5 \
            --with-occ=$FREECAD \
            --enable-occ \
            --enable-shared \
            --enable-nglib \
            --disable-gui \
            --disable-dependency-tracking \
            CPPFLAGS="-I/usr/lib/openmpi/include/" \
            CXXFLAGS="-DNGLIB_EXPORTS -std=gnu++11" \
  \
    && make -j$(nproc) \
    && make install \
    && cp -rf libsrc $FREECAD/libsrc


### FreeCAD latest Github commit
#--------------------------------
RUN \
    cd \
    && git clone https://github.com/FreeCAD/FreeCAD \
  # building FreeCAD
    && mkdir build \
    && cd build \
  \
  # with oce-dev installed, with netgen
    && cmake ../FreeCAD  \
            -DCMAKE_INSTALL_PREFIX:PATH=$FREECAD  \
            -DBUILD_FEM_NETGEN=1  \
            -DCMAKE_CXX_FLAGS="-DNETGEN_V5"  \
            -DNETGEN_ROOT=$FREECAD  \
            -DFREECAD_USE_OCC_VARIANT="Official Version"  \
            -DOCC_INCLUDE_DIR=$FREECAD/include/opencascade  \
            -DOCC_LIBRARY=$FREECAD/lib/libTKernel.so \
  \
    && make -j$(nproc) 
#    #&& make install
# 
# # start FreeCAD
# # $FREECAD/bin/FreeCAD


### Calculix 2.12 and CGX
#-------------------------
RUN \
    ccx_VERSION=2.12 && \
    apt-get install -y gfortran cpio \
    && cd \
    && git clone https://github.com/luvres/calculix.git \
    && cd calculix/ \
    && ./install \
    && cp $HOME/CalculiX-${ccx_VERSION}/bin/ccx_${ccx_VERSION} /usr/bin/ccx \
    && cp $HOME/CalculiX-${ccx_VERSION}/bin/cgx /usr/bin/cgx \
    && cd && rm CalculiX-${ccx_VERSION} calculix -fR

FreeCAD 0.17 -> libMED 3.2.0, VTK-8.0.0, occt-7.1.0p1, netgen-5.3.1, Calculix-2.12 -> Ubuntu Xenial (16.04)
https://github.com/luvres/freecad/blob/ ... Dockerfile

Code: Select all

FROM izone/freecad:nvidia
MAINTAINER Leonardo Loures <luvres@hotmail.com>

# References:
# https://gist.github.com/berndhahnebach/38d5bfe73134928c0a1ad001a94df05f
# https://github.com/berndhahnebach/Netgen
# https://sourceforge.net/p/netgen-mesher/wiki/Home/
# https://aur.archlinux.org/packages

ENV FREECAD=/opt/local/FreeCAD-0.17
RUN \
    cd \
    && mkdir -p $FREECAD \
    \
    && package_list=" doxygen \
                      libboost1.58-dev \
                      libboost-filesystem1.58-dev \
                      libboost-program-options1.58-dev \
                      libboost-python1.58-dev \
                      libboost-regex1.58-dev \
                      libboost-signals1.58-dev \
                      libboost-system1.58-dev \
                      libboost-thread1.58-dev \
                      libcoin80v5 \
                      libcoin80-dev \
                      libeigen3-dev \
                      libpyside-dev \
                      libqtcore4 \
                      libshiboken-dev \
                      libxerces-c-dev \
                      libxmu-dev \
                      libxmu-headers \
                      libxmu6 \
                      libxmuu-dev \
                      libxmuu1 \
                      pyside-tools \
                      python-dev \
                      python-pyside \
                      python-matplotlib \
                      qt4-dev-tools \
                      qt4-qmake \
                      libqtwebkit-dev \
                      shiboken \
                      gmsh \
                      swig " \
    \
    && apt-get update \
    && apt-get install -y \
        dictionaries-common wget \
        $package_list \
        python-pivy \
        git \
        cmake \
        g++ \
        libfreetype6-dev \
        tcl8.5-dev \
        tk8.5-dev \
        automake \
        libtogl-dev \
        libhdf5-dev 
        #calculix-ccx

### libMED 3.2.0
#----------------
RUN \
    cd \
    && mkdir med \
    && cd med \
    && git clone https://github.com/luvres/libMED.git \
  \
  # building MED
    && mkdir build \
    && cd build \
    && cmake ../libMED -DCMAKE_INSTALL_PREFIX:PATH=$FREECAD \
    && make -j$(nproc) \
    && make install

### VTK 8.0.0
#-------------
RUN \
    vtk_VERSION_MAJOR=8.0 && \
    vtk_VERSION_MINOR=8.0.0 && \
  \
    cd \
    && mkdir vtk \
    && cd vtk \
    && wget http://www.vtk.org/files/release/${vtk_VERSION_MAJOR}/VTK-${vtk_VERSION_MINOR}.tar.gz \
    && gunzip VTK-${vtk_VERSION_MINOR}.tar.gz \
    && tar xf VTK-${vtk_VERSION_MINOR}.tar \
    && rm VTK-${vtk_VERSION_MINOR}.tar \
  # building VTK
    && mkdir build \
    && cd build \
  \
    && cmake ../VTK-${vtk_VERSION_MINOR} \
            -DCMAKE_INSTALL_PREFIX:PATH=$FREECAD \
            -DVTK_Group_Rendering:BOOL=OFF \
            -DVTK_Group_StandAlone:BOOL=ON \
            -DVTK_RENDERING_BACKEND=None \
  \
    && make -j$(nproc) \
    && make install

### OCCT 7.1.0
#--------------
RUN \
    url_OCCT="http://git.dev.opencascade.org/gitweb/?p=occt.git;a=snapshot;h=1780d6cc299f1d06eb106f5cfc27731cdaf97a56;sf=tgz" && \
    #url_OCCT="http://desktop/Workstation/occt-7.1.0p1.tgz" && 
    dir_OCCT=1780d6c && \
  \  
    cd \
    && mkdir occt \
    && cd occt \
  \
    && wget ${url_OCCT} -O occt.tgz \
    && gunzip occt.tgz \
    && tar xf occt.tar \
    && rm occt.tar \
    && cd occt-${dir_OCCT} \
  \
    && bash -c "grep -v vtkRenderingFreeTypeOpenGL src/TKIVtk/EXTERNLIB >& /tmp/EXTERNLIB" \
    && cp /tmp/EXTERNLIB src/TKIVtk/EXTERNLIB \
    && bash -c "grep -v vtkRenderingFreeTypeOpenGL src/TKIVtkDraw/EXTERNLIB >& /tmp/EXTERNLIB" \
    && cp /tmp/EXTERNLIB src/TKIVtkDraw/EXTERNLIB \
  # building OCCT
    && cd .. \
    && mkdir build \
    && cd build \
  \
    && cmake \
        ../occt-${dir_OCCT} \
        -DCMAKE_INSTALL_PREFIX:PATH=$FREECAD \
        -DUSE_VTK:BOOL=OFF \
  \
    && make -j$(nproc) \
    && make install

### Netgen 5.3.1
#----------------
RUN \
    cd \
    && apt-get install -y \
    openmpi-bin libopenmpi-dev \
    && git clone https://github.com/luvres/netgen.git \
    && cd netgen \
  \
  # building Netgen
    && ./configure \
            --prefix=$FREECAD \
            #--with-sysroot=/usr/lib/
            #--with-metis=/usr/lib/x86_64-linux-gnu/
            #--with-togl=/usr/lib/
            --with-tcl=/usr/lib/tcl8.5 \
            --with-tk=/usr/lib/tk8.5 \
            --with-occ=$FREECAD \
            --enable-occ \
            --enable-shared \
            --enable-nglib \
            --disable-gui \
            --disable-dependency-tracking \
            CPPFLAGS="-I/usr/lib/openmpi/include/" \
            CXXFLAGS="-DNGLIB_EXPORTS -std=gnu++11" \
  \
    && make -j$(nproc) \
    && make install \
    && cp -rf libsrc $FREECAD/libsrc


### FreeCAD latest Github commit
#--------------------------------
RUN \
    cd \
    && git clone https://github.com/FreeCAD/FreeCAD \
  # building FreeCAD
    && mkdir build \
    && cd build \
  \
  # with oce-dev installed, with netgen
    && cmake ../FreeCAD  \
            -DCMAKE_INSTALL_PREFIX:PATH=$FREECAD  \
            -DBUILD_FEM_NETGEN=1  \
            -DCMAKE_CXX_FLAGS="-DNETGEN_V5"  \
            -DNETGEN_ROOT=$FREECAD  \
            -DFREECAD_USE_OCC_VARIANT="Official Version"  \
            -DOCC_INCLUDE_DIR=$FREECAD/include/opencascade  \
            -DOCC_LIBRARY=$FREECAD/lib/libTKernel.so \
  \
    && make -j$(nproc) 
    #&& make install

# start FreeCAD
# $FREECAD/bin/FreeCAD

### Calculix 2.12 and CGX
#-------------------------
RUN \
    ccx_VERSION=2.12 && \
    apt-get install -y gfortran cpio \
    && cd \
    && git clone https://github.com/luvres/calculix.git \
    && cd calculix/ \
    && ./install \
    && cp $HOME/CalculiX-${ccx_VERSION}/bin/ccx_${ccx_VERSION} /usr/bin/ccx \
    && cp $HOME/CalculiX-${ccx_VERSION}/bin/cgx /usr/bin/cgx \
    && cd && rm CalculiX-${ccx_VERSION} calculix -fR
Last edited by luvres on Mon Jul 31, 2017 7:44 pm, edited 2 times in total.
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: compile FreeCAD 0.17 with occt 7.1.0 and netgen, script for Xenial and Jessie

Postby NormandC » Mon Jul 31, 2017 5:51 pm

This is an ENGLISH forum.

We should not have to translate your message because you are too lazy or clueless to do so. This is disrespectful to people who do not understand your language. :evil:

If you want to communicate in your own language, there are specific forums to do so listed at the bottom of the forum index.

Here's the direct link, since you did not manage to discover them by yourself.

https://forum.freecadweb.org/viewforum.php?f=11
luvres
Posts: 15
Joined: Thu Apr 28, 2016 10:54 pm

Re: compile FreeCAD 0.17 with occt 7.1.0 and netgen, script for Xenial and Jessie

Postby luvres » Mon Jul 31, 2017 9:27 pm

You're right! Sorry for the mistake. I already edited the post.
Thank you NormandC.
gdo35
Posts: 189
Joined: Wed Jan 25, 2012 7:25 pm

Re: compile FreeCAD 0.17 with occt 7.1.0 and netgen, script for Xenial and Jessie

Postby gdo35 » Tue Aug 01, 2017 11:53 pm

Hello !

Happy to come back to the forum. ;)

Sorry if I was away for a long time but May and June are generally the worst monthes for me :lol: It extends to July this year...

Around 4 months agos, I packaged for ubuntu netgen 5.3.1 and just had time for a small working test :
https://forum.freecadweb.org/viewtopic. ... 20#p168699

I did not fully check what bernd did but if it is the reference for building netgen, I could merge his work in the branch I already created 4 months ago :
https://git.launchpad.net/~freecad-main ... gen/?h=gdo

What do you think about it ?

++
gdo
luvres
Posts: 15
Joined: Thu Apr 28, 2016 10:54 pm

Re: compile FreeCAD 0.17 with occt 7.1.0 and netgen, script for Xenial and Jessie

Postby luvres » Wed Aug 02, 2017 8:38 pm

Count on me for what is best and what you need.
I had to make a change in Netgen to work for my environment that I'm using. The procedure is described in github:
Https://github.com/luvres/netgen

1) Download Netgen on sourceforge

2) Apply pach nglib-occt7

3) Changes to the configure and configure.ac files in the DOCCGEOMETRY line, changing the path "inc" to "include" and "/ usr" to "$ occdir" (I have already included a patch for these changes that I named "occdir .patch ")

I do not know how much this helps with packaging. Because I have no experience with packaging.
I would like to study and help. If you have any references where I can understand more about creating the ppa, I would like to.
User avatar
sgrogan
Posts: 5798
Joined: Wed Oct 22, 2014 5:02 pm

Re: compile FreeCAD 0.17 with occt 7.1.0 and netgen, script for Xenial and Jessie

Postby sgrogan » Wed Aug 02, 2017 10:39 pm

luvres wrote:
Wed Aug 02, 2017 8:38 pm
I do not know how much this helps with packaging. Because I have no experience with packaging.
I would like to study and help. If you have any references where I can understand more about creating the ppa, I would like to.
Welcome luvres!
I started here:https://www.debian.org/doc/manuals/maint-guide/ not an exactly how to :(
gdo35 wrote:
Tue Aug 01, 2017 11:53 pm
Around 4 months agos, I packaged for ubuntu netgen 5.3.1 and just had time for a small working test :
https://forum.freecadweb.org/viewtopic. ... 20#p168699
Sorry for not following up on this. Does nglib build on LP? Should I try to build FreeCAD against this package?
@gdo35, good to see you back! I can certainly use your help.
jean.thil
Posts: 207
Joined: Tue Jul 28, 2015 7:28 am

Re: compile FreeCAD 0.17 with occt 7.1.0 and netgen, script for Xenial and Jessie

Postby jean.thil » Thu Aug 03, 2017 7:15 am

In the hope that it could be useful to some users :
I didn't know it but user Reox informed me that freecad daily for Ubuntu Zesty works on debian 9.1.

OS: Debian GNU/Linux 9.1 (stretch)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.11704 (Git)
Build type: None
Branch: master
Hash: ea708c14b0c87b4217e9d6d548f7aebff742c19c
Python version: 2.7.13
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: French/France (fr_FR)
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: compile FreeCAD 0.17 with occt 7.1.0 and netgen, script for Xenial and Jessie

Postby NormandC » Thu Aug 03, 2017 4:17 pm

jean.thil wrote:
Thu Aug 03, 2017 7:15 am
I didn't know it but user Reox informed me that freecad daily for Ubuntu Zesty works on debian 9.1.
Don't expect it to last. All Ubuntu releases start with a snapshot of Debian testing packages at some given time. At this point in time, Ubuntu Zesty and Debian 9.1 may be in sync. But then, Ubuntu will stay with the same package versions, while Debian will keep being updated. So at some point in time, the Ubuntu daily packages will conflict with your system libraries. Which is why as a general rule we do not advise Debian users to use Ubuntu packages.

Also, the current daily builds PPA do not support netgen, which is one of the goals of this topic. So this is off topic...
jacquesclouseau
Posts: 13
Joined: Sat Jul 09, 2016 10:34 pm

Re: compile FreeCAD 0.17 with occt 7.1.0 and netgen, script for Xenial and Jessie

Postby jacquesclouseau » Tue Aug 08, 2017 5:12 pm

Hi everyone , i am trying the debian Jessie script since yesterday from deepin linux(based on debian).
Script has stopped because of libraries and programs dependencies that I think I had already installed and fixed.

Now I have this, and don't know how to progress:


[ 5%] Building CXX object src/Base/CMakeFiles/FreeCADBase.dir/__/zipios++/zipoutputstream.cpp.o
[ 5%] Linking CXX shared library ../../lib/libFreeCADBase.so
[ 6%] Built target FreeCADBase
Makefile:127: fallo en las instrucciones para el objetivo 'all'
make: *** [all] Error 2
make[2]: *** No hay ninguna regla para construir el objetivo '/usr/lib/libmpi.so', necesario para 'lib/libSMDS.so'. Alto.
CMakeFiles/Makefile2:418: fallo en las instrucciones para el objetivo 'src/3rdParty/salomesmesh/CMakeFiles/SMDS.dir/all'
make[1]: *** [src/3rdParty/salomesmesh/CMakeFiles/SMDS.dir/all] Error 2
Makefile:127: fallo en las instrucciones para el objetivo 'all'
make: *** [all] Error 2


It is spanish, If translation or any aditional info is needed please say it.

Anyone can help with this?
Thanks
User avatar
sgrogan
Posts: 5798
Joined: Wed Oct 22, 2014 5:02 pm

Re: compile FreeCAD 0.17 with occt 7.1.0 and netgen, script for Xenial and Jessie

Postby sgrogan » Tue Aug 08, 2017 11:49 pm

jacquesclouseau wrote:
Tue Aug 08, 2017 5:12 pm
make[2]: *** No hay ninguna regla para construir el objetivo '/usr/lib/libmpi.so', necesario para 'lib/libSMDS.so'. Alto.
Maybe try this

Code: Select all

-DCMAKE_CXX_COMPILER=/usr/bin/mpic++