0029520: Visualization - drop deprecated V3d_View::Export() functionality and depende...
[occt.git] / dox / dev_guides / building / 3rdparty / 3rdparty_linux.md
CommitLineData
ba06f8bb 1\feff Building 3rd-party libraries on Linux {#occt_dev_guides__building_3rdparty_linux}
79d580f2 2=========
3
e5bd0d98 4@tableofcontents
5
6@section dev_guides__building_3rdparty_linux_1 Introduction
7
79d580f2 8This document presents additional guidelines for building third-party
9products used by Open CASCADE Technology and samples on Linux platform.
e5bd0d98 10
79d580f2 11The links for downloading the third-party products are available on the web site
12of OPEN CASCADE SAS at
d3013f55 13http://www.opencascade.com/content/3rd-party-components.
e5bd0d98 14
79d580f2 15There are two types of third-party products, which are necessary to build OCCT:
e5bd0d98 16
77906c4c 17* Mandatory products:
18 * Tcl/Tk 8.5 - 8.6;  
18006a0f 19 * FreeType 2.4.10 - 2.5.3;
77906c4c 20* Optional products:
21 * TBB 3.x - 4.x;
18006a0f 22 * FreeImage 3.14.1 - 3.16.0;
23 * VTK 6.1.0.
e5bd0d98 24
25@section dev_guides__building_3rdparty_linux_2 Building Mandatory Third-party Products
26
79d580f2 27@subsection dev_guides__building_3rdparty_linux_2_1 Tcl/Tk
e5bd0d98 28
79d580f2 29Tcl/Tk is required for DRAW test harness.
e5bd0d98 30
79d580f2 31@subsubsection dev_guides__building_3rdparty_linux_2_1_2 Installation from sources: Tcl
e5bd0d98 32
79d580f2 33Download the necessary archive from http://www.tcl.tk/software/tcltk/download.html and unpack it.
e5bd0d98 34
77906c4c 351. Enter the unix sub-directory of the directory where the Tcl source files are located <i>(TCL_SRC_DIR)</i>.
e5bd0d98 36
79d580f2 37 cd TCL_SRC_DIR/unix
e5bd0d98 38
77906c4c 392. Run the *configure* command:
e5bd0d98 40
79d580f2 41 configure --enable-gcc --enable-shared --enable-threads --prefix=TCL_INSTALL_DIR
e5bd0d98 42
77906c4c 43 For a 64 bit platform also add <i>--enable-64bit</i> option to the command line.
e5bd0d98 44
77906c4c 453. If the configure command has finished successfully, start the building process:
e5bd0d98 46
79d580f2 47 make
e5bd0d98 48
79d580f2 494. If building is finished successfully, start the installation of Tcl.
77906c4c 50 All binary and service files of the product will be copied to the directory defined by *TCL_INSTALL_DIR*
e5bd0d98 51
79d580f2 52 make install
e5bd0d98 53
79d580f2 54@subsubsection dev_guides__building_3rdparty_linux_2_1_3 Installation from sources: Tk
e5bd0d98 55
79d580f2 56Download the necessary archive from http://www.tcl.tk/software/tcltk/download.html and unpack it.
e5bd0d98 57
77906c4c 581. Enter the unix sub-directory of the directory where the Tk source files are located <i>(TK_SRC_DIR)</i>
e5bd0d98 59
79d580f2 60 cd TK_SRC_DIR/unix
e5bd0d98 61
77906c4c 622. Run the configure command, where <i>TCL_LIB_DIR</i> is *TCL_INSTALL_DIR/lib*.
e5bd0d98 63
79d580f2 64 configure --enable-gcc --enable-shared --enable-threads --with-tcl=TCL_LIB_DIR --prefix=TK_INSTALL_DIR
e5bd0d98 65
77906c4c 66 For a 64 bit platform also add <i>--enable-64bit</i> option to the command line.
e5bd0d98 67
77906c4c 683. If the configure command has finished successfully, start the building process:
e5bd0d98 69
79d580f2 70 make
e5bd0d98 71
77906c4c 724. If the building has finished successfully, start the installation of Tk.
79d580f2 73 All binary and service files of the product will be copied
77906c4c 74 to the directory defined by *TK_INSTALL_DIR* (usually it is *TCL_INSTALL_DIR*)
e5bd0d98 75
79d580f2 76 make install
e5bd0d98 77
79d580f2 78@subsection dev_guides__building_3rdparty_linux_2_2 FreeType
e5bd0d98 79
77906c4c 80FreeType is required for text display in the 3D viewer.
79d580f2 81Download the necessary archive from http://sourceforge.net/projects/freetype/files/ and unpack it.
e5bd0d98 82
77906c4c 831. Enter the directory where the source files of FreeType are located <i>(FREETYPE_SRC_DIR)</i>.
e5bd0d98 84
79d580f2 85 cd FREETYPE_SRC_DIR
e5bd0d98 86
77906c4c 872. Run the *configure* command:
e5bd0d98 88
79d580f2 89 configure --prefix=FREETYPE_INSTALL_DIR
e5bd0d98 90
77906c4c 91 For a 64 bit platform also add <i>CFLAGS='-m64 -fPIC' CPPFLAGS='-m64 -fPIC'</i> option to the command line.
e5bd0d98 92
77906c4c 933. If the *configure* command has finished successfully, start the building process:
e5bd0d98 94
79d580f2 95 make
e5bd0d98 96
77906c4c 974. If the building has finished successfully, start the installation of FreeType.
98 All binary and service files of the product will be copied to the directory defined by *FREETYPE_INSTALL_DIR*
e5bd0d98 99
79d580f2 100 make install
e5bd0d98 101
102@section dev_guides__building_3rdparty_linux_3 Building Optional Third-party Products
103
79d580f2 104@subsection dev_guides__building_3rdparty_linux_3_1 TBB
e5bd0d98 105
79d580f2 106This third-party product is installed with binaries from the archive that can be downloaded from http://threadingbuildingblocks.org.
18006a0f 107Go to the **Download** page, find the release version you need and pick the archive for Linux platform.
79d580f2 108To install, unpack the downloaded archive of TBB product.
e5bd0d98 109
79d580f2 110@subsection dev_guides__building_3rdparty_linux_3_3 FreeImage
e5bd0d98 111
79d580f2 112Download the necessary archive from http://sourceforge.net/projects/freeimage/files/Source%20Distribution/
77906c4c 113and unpack it. The directory with unpacked sources is further referred to as *FREEIMAGE_SRC_DIR*.
e5bd0d98 114
77906c4c 1151. Modify *FREEIMAGE_SRC_DIR/Source/OpenEXR/Imath/ImathMatrix.h*:
e5bd0d98 116 In line 60 insert the following:
117
79d580f2 118 #include string.h
e5bd0d98 119
77906c4c 1202. Enter the directory where the source files of FreeImage are located <i>(FREEIMAGE_SRC_DIR)</i>.
e5bd0d98 121
79d580f2 122 cd FREEIMAGE_SRC_DIR
e5bd0d98 123
79d580f2 1243. Run the building process
e5bd0d98 125
79d580f2 126 make
127
1284. Run the installation process
129
77906c4c 130 a. If you have the permission to write into directories <i>/usr/include</i> and <i>/usr/lib</i>, run the following command:
79d580f2 131
132 make install
77906c4c 133 b. If you do not have this permission, you need to modify file *FREEIMAGE_SRC_DIR/Makefile.gnu*:
e5bd0d98 134
79d580f2 135 Change lines 7-9 from:
e5bd0d98 136
79d580f2 137 DESTDIR ?= /
138 INCDIR ?= $(DESTDIR)/usr/include
139 INSTALLDIR ?= $(DESTDIR)/usr/lib
140
141 to:
142
143 DESTDIR ?= $(DESTDIR)
144 INCDIR ?= $(DESTDIR)/include
145 INSTALLDIR ?= $(DESTDIR)/lib
146
147 Change lines 65-67 from:
148
149 install -m 644 -o root -g root $(HEADER) $(INCDIR)
150 install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
151 install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
e5bd0d98 152
79d580f2 153 to:
e5bd0d98 154
79d580f2 155 install -m 755 $(HEADER) $(INCDIR)
156 install -m 755 $(STATICLIB) $(INSTALLDIR)
157 install -m 755 $(SHAREDLIB) $(INSTALLDIR)
e5bd0d98 158
79d580f2 159 Change line 70 from: 
e5bd0d98 160
79d580f2 161 ldconfig
e5bd0d98 162
79d580f2 163 to:
e5bd0d98 164
79d580f2 165 \#ldconfig
e5bd0d98 166
79d580f2 167 Then run the installation process by the following command:
e5bd0d98 168
79d580f2 169 make DESTDIR=FREEIMAGE_INSTALL_DIR install
e5bd0d98 170
77906c4c 1715. Clean temporary files
79d580f2 172
18006a0f 173 make clean
79d580f2 174
18006a0f 175@subsection dev_guides__building_3rdparty_linux_3_4 VTK
79d580f2 176
18006a0f 177You can download VTK sources from http://www.vtk.org/VTK/resources/software.html
79d580f2 178
18006a0f 179### The building procedure:
79d580f2 180
18006a0f 181Download the necessary archive from http://www.vtk.org/VTK/resources/software.html and unpack it.
79d580f2 182
18006a0f 1831. Install or build *cmake* product from the source file.
1842. Start *cmake* in GUI mode with the directory where the source files of *VTK* are located:
79d580f2 185
18006a0f 186 ccmake VTK_SRC_DIR
e5bd0d98 187
18006a0f 188 * Press <i>[c]</i> to make the initial configuration
189 * Define the necessary options in *VTK_INSTALL_PREFIX*
190 * Press <i>[c]</i> to make the final configuration
191 * Press <i>[g]</i> to generate Makefile and exit
e5bd0d98 192
18006a0f 1933. Start the building of VTK:
e5bd0d98 194
18006a0f 195 make
e5bd0d98 196
e52ba46e 1974. Start the installation of VTK. Binaries will be installed according to the *VTK_INSTALL_PREFIX* option.
e5bd0d98 198
18006a0f 199 make install
f3fb84ce 200
201@section dev_guides__building_3rdparty_linux_4 Installation From Official Repositories
202
203@subsection dev_guides__building_3rdparty_linux_4_1 Debian-based distributives
204
205All 3rd-party products required for building of OCCT could be installed
206from official repositories. You may install them from console using apt-get utility:
207
e52ba46e 208 sudo apt-get install tcllib tklib tcl-dev tk-dev libfreetype-dev libxt-dev libxmu-dev libxi-dev libgl1-mesa-dev libglu1-mesa-dev libfreeimage-dev libtbb-dev
f3fb84ce 209
210To launch binaries built with WOK you need to install C shell and 32-bit libraries on x86_64 distributives:
211
212 # you may need to add i386 if not done already by command "dpkg --add-architecture i386"
213 sudo apt-get install csh libstdc++6:i386 libxt6:i386 libxext6:i386 libxmu6:i386
214
215Building is possible with C++ compliant compiler:
216
217 sudo apt-get install g++