Saturday, February 19, 2011

Do Women Like Shaved Legs?

qtiplot 0.9.8.4

NOTE: Renato Rivoira, and I thank him, he edited the Italian translation of qtiplot and its manual. In comments on this post asks, who is able to do so, to help him revise his translations. You can contact him by sending an email to renatoriv AT ​libero PUNTO it .

Il 18 febbraio 2011 è stata rilasciata la versione finale di QtiPlot 0.9.8.4, un programma per l'analisi dei dati, equivalente libero di Origin . Questa versione porta con sé numerose novità che potete leggere qui .

QtiPlot è un programma un po' particolare perché il codice sorgente è rilasciato con licenza GPL ma lo sviluppatore distribuisce i binari precompilati a pagamento . Ciò non è in alcun modo in contrasto con il concetto di software libero perché nella sua definizione non si parla di prezzo. La confusione di "software libero" con "software free "is more prevalent in English-speaking people, since this is the word" free "has the double meaning of" free "and" free. "Even if you use this software, having compiled by itself can make a donation to the project to 'Address http://soft.proindependent.com/why_donate.html to allow the developer to carry out his project.

In this post I will explain how to fill qtiplot. This guide is for Ubuntu Maverick Meerkat 10.10 (and probably work without too many problems for Debian), other distributions there may be small differences in the commands that invoke the package manager, the names dei pacchetti e la disponibilità di questi.

Innanzitutto cominciamo con l'installare tutte le dipendenze necessarie per la compilazione. In un terminale dare
 sudo apt-get install build-essential 
sudo apt-get build-dep qtiplot
Il primo comando installa (se non già presente, ma è difficile che non lo sia già) le utility necessarie per compilare la maggior parte dei programmi, il secondo installa le principali librerie che necessita QtiPlot per essere compilato. Nelle ultime versioni QtiPlot ha aggiunto altre dipendenze i cui pacchetti non sono disponibili nella versione di Ubuntu considerata, quindi prima di procedere con la compilazione di QtiPlot stesso dovremo compilare altri programmi.

Scarichiamo il codice sorgente di QtiPlot all'indirizzo http://download.berlios.de/qtiplot/qtiplot-0.9.8.4.tar.bz2 . Da terminale si può usare
 wget http://download.berlios.de/qtiplot/qtiplot-0.9.8.4.tar.bz2 
Scompattiamo l'archivio dove ci pare (se non siete in grado di farlo da terminale, vi ricordo che è possibile farlo attraverso interfaccia grafica) e spostiamoci con il terminale nella cartella in cui si trova il sorgente:
 tar xjvf qtiplot-0.9.8.4.tar.bz2 
cd qtiplot-0.9.8.4/
Aprite il file README.html presente nella cartella del sorgente (è sempre buona norma leggere i file README e/o INSTALL , or the like, before proceeding with the compilation of a program). As you can see the dependencies that are required are as follows: Qt (> = 4.5.0), GSL, muParser (1.32), libpng and zlib. All of these packages were installed (if not already present) with the command sudo apt-get build-dep qtiplot . Also, we need slightly different versions of the libraries QWT (5.2) and QwtPlot3D, but these are in sub 3rdparty / qtiplot source code, so no need to download anything new for this list so far. Other libraries are suggested QTeXEngine , ALGLIB (2.6) and TAMUANOVA .

Compiliamo queste librerie. Salveremo i codici sorgenti di queste nella sottocartella 3rdparty/ , per comodità, quindi spostiamoci in questa cartella:
 cd 3rdparty/ 
Scarichiamo e scompattiamo l'archivio contenente il codice sorgente di QTeXEngine:
 wget http://download.berlios.de/qtiplot/QTeXEngine-0.3-opensource.zip 
unzip QTeXEngine-0.3-opensource.zip
cd QTeXEngine
Compiliamo la libreria (le istruzioni sono presenti nel file README.txt :
 qmake 
make
Se tutto è andato bene (lo potete controllare guardando l'exit status con il comando echo $? , se è 0 then the operation has been completed correctly) back to the parent directory, download the source code and ALGLIB compiliamolo:
 cd .. 
http://www.alglib.net/translator/re/alglib-2.6.0.cpp.zip
unzip wget-alglib 2.6.0.cpp.zip; mv cpp alglib
cd alglib
The instructions for filling of this library are in the file manual.cpp.html . We must run the build script passing as argument the compiler to use, in our case, GCC. The script builds has execute permissions, so before we start to make the file executable :
 chmox 
+ x build. / Build gcc
If this operation has been completed successfully (check the exit status with echo $? : if we get 0 then it was fine) we go forward we can build TAMUANOVA. Let's move to the parent directory, download the source code TAMUANOVA, unpack the archive folder and enter the source code of this library:
 cd .. 
http://www.stat.tamu.edu/ wget tar xzvf ~ aredd/tamuanova/tamu_anova-0.2.tar.gz
tamu_anova-0.2.tar.gz; tamu_anova-0.2 mv / tamu_anova /
tamu_anova cd /
compile this library (instructions are included in the INSTALL file ):
. / configure make 

Check the exit status with echo $? . If you get 0 compilation is successful. No need to install the library (as even earlier), just completed it. Before we change a file: 3rdparty/qwtplot3d/qwtplot3d.pro . This file contains instructions for building the library QwtPlot3D (which will happen later when you compile qtiplot). At the end of this file you should add the following line:
  unix: CONFIG + =  staticlib 
to be compiled statically (hint taken from here ).

return to the terminal nella cartella principale del codice sorgente di QtiPlot (che si trova due cartelle superiori rispetto alla carella di ALGLIB in cui ci trovavamo prima):
 cd ../.. 
Prima di iniziare la compilazione vera e propria ci sono ancora diverse operazioni da fare. Prima di tutto dobbiamo creare un file chiamato build.conf da posizionare nella cartella del codice sorgente di QtiPlot e che contiene alcune istruzioni che servono per la compilazione. Questo file dovrà essere realizzato sulla base del modello build.conf.example che si trova nella stessa cartella. Per la precisione, build.conf contiene alcune opzioni e variabili per la compilazione e i percorsi delle librerie da utilizzare (oppure le corrispondenti compilation options). In this file the variable QTI_ROOT is equal to the root folder path of the source code qtiplot. I edited build.conf.example based on real locations and libraries used here is my build.conf :
  isEmpty (QTI_ROOT) { 
message ( "each Including this config file needs to Set QTI_ROOT to the dir containing this file! ")}


################################### #######################
# # System specific configuration
##########################################################

# Global include path which is always added at the end of the INCLUDEPATH
SYS_INCLUDEPATH = /opt/local/include
# Global lib path and libs which is ls always added at the end of LIBS
SYS_LIBS = -L/opt/local/lib

##########################################################
## zlib (http://www.zlib.net/)
##########################################################

# include path. leave it blank to use SYS_INCLUDE
ZLIB_INCLUDEPATH = $$QTI_ROOT/3rdparty/zlib/

##########################################################
## muParser (http://muparser.sourceforge.net/)
##########################################################

# include path. leave it blank to use SYS_INCLUDE
MUPARSER_INCLUDEPATH = /usr/include/muParser/
# link statically against a copy in 3rdparty/
MUPARSER_LIBS = /usr/lib/libmuparser.so
# or dynamically against a system-wide installation
# MUPARSER_LIBS = -lmuparser

##########################################################
## GNU Sientific Library (http://www.gnu.org/software/gsl/)
##########################################################

# include path. leave it blank to use SYS_INCLUDE
# GSL_INCLUDEPATH = $$QTI_ROOT/3rdparty/gsl/include
# link statically against a copy in 3rdparty/
# GSL_LIBS = $$QTI_ROOT/3rdparty/gsl/lib/libgsl.a \
# $$QTI_ROOT/3rdparty/gsl/lib/libgslcblas.a
# or dynamically against a system-wide installation
GSL_LIBS = -lgsl -lgslcblas

##########################################################
## QWT - use local copy till upstream catches up
# http://qwt.sourceforge.net/index.html
##########################################################

# include path.
QWT_INCLUDEPATH = $$QTI_ROOT/3rdparty/qwt/src
# link locally against a copy in 3rdparty/
QWT_LIBS = $$QTI_ROOT/3rdparty/qwt/lib/libqwt.a

##########################################################
## QwtPlot3D - use local copy till upstream catches up
# http://qwtplot3d.sourceforge.net/
##########################################################

# include path.
QWT3D_INCLUDEPATH = $$QTI_ROOT/3rdparty/qwtplot3d/include
# link locally against a copy in 3rdparty/
win32:QWT3D_LIBS = $$QTI_ROOT/3rdparty/qwtplot3d/lib/qwtplot3d.dll
unix:QWT3D_LIBS = $$QTI_ROOT/3rdparty/qwtplot3d/lib/libqwtplot3d.a

##########################################################
## libpng - optional. you don't have to set these variables
##########################################################

# include path. leave it blank to use SYS_INCLUDE
# LIBPNG_INCLUDEPATH = $$QTI_ROOT/3rdparty/libpng/
# link statically against a copy in 3rdparty/
# LIBPNG_LIBS = $$QTI_ROOT/3rdparty/libpng/libpng.a
# or dynamically against a system-wide installation
LIBPNG_LIBS = -lpng

##########################################################
## QTeXEngine - optional. you don't have to set these variables
# http://soft.proindependent.com/qtexengine/
##########################################################

# include path.
TEX_ENGINE_INCLUDEPATH = $$QTI_ROOT/3rdparty/QTeXEngine/src
# link locally against a copy in 3rdparty/
TEX_ENGINE_LIBS = $$QTI_ROOT/3rdparty/QTeXEngine/libQTeXEngine.a

##########################################################
## ALGLIB (2.6) - optional. you don't have to set these variables
# http://www.alglib.net/
##########################################################

# include path.
ALGLIB_INCLUDEPATH = $$QTI_ROOT/3rdparty/alglib/src
# link locally against a copy in 3rdparty/
ALGLIB_LIBS = $$QTI_ROOT/3rdparty/alglib/out/libalglib.a

##########################################################
## TAMUANOVA - optional. you don't have to set these variables
# http://www.stat.tamu.edu/~aredd/tamuanova/
##########################################################

# include path.
TAMUANOVA_INCLUDEPATH = $$QTI_ROOT/3rdparty/tamu_anova/
# link locally against a copy in 3rdparty/
TAMUANOVA_LIBS = $$QTI_ROOT/3rdparty/tamu_anova/libtamuanova.a

##########################################################
## python - only used if python is needed
##########################################################

# the python interpreter to use
# (unix only, windows will use what ever is configured to execute .py files!)
PYTHON = python

##########################################################
## Qt tools - allows to use specific versions
##########################################################

LUPDATE = lupdate
LRELEASE = lrelease

############################################################
## Target specific configuration: configure Qtiplot itself
############################################################

contains( TARGET, qtiplot ) {
# building without muParser doesn't work yet
SCRIPTING_LANGS + = muParser
SCRIPTING_LANGS + = Python

# a console displaying output of scripts; particularly useful on Windows
# where running QtiPlot from a terminal is inconvenient
DEFINES + = SCRIPTING_CONSOLE

# DEFINES += QTIPLOT_DEMO

# Uncomment the following line if you want to perform a custom installation using the *.path variables defined in ./qtiplot.pro.
# CONFIG += CustomInstall

# Uncomment The following line If You Want to Build qtiplot as a browser plugin (not working on Internet Explorer).
# CONFIG + = BrowserPlugin

CONFIG + = release
# CONFIG + = debug

Uncomment # The following line If You Want to link statically Against Qt.
# CONFIG + = StaticBuild
# win32: CONFIG + = console}


We have not finished yet, we have to do one last thing. Edit the file qtiplot.pro che si trova nella cartella principale del codice sorgente. Questo contiene il nome di quali cartelle contengono del codice che dovrà essere compilato. Togliamo dall'elenco fitPlugins e manual (eventualmente potranno essere compilati successivamente), quindi il file apparirà più o meno così:
 TEMPLATE = subdirs 

SUBDIRS = 3rdparty/qwt \
3rdparty/qwtplot3d \
qtiplot
A questo punto dovremmo essere in grado, finalmente di compilare QtiPlot. Come spiegato nel file README.html i comandi da dare sono
 qmake 
make
Per rendere più veloce la compilazione, chi ha un processore multicore può passare a make l'opzione -j n , dove n è il numero di core del processore (o meglio di job simultanei che può gestire, però per semplificare il discorso parliamo di core). Quindi chi, per esempio, ha un processore con quattro core potrà usare per compilare QtiPlot il comando
 make -j 4 
Se la compilazione va a buon fine (come al solito possiamo controllarlo con echo $? ) possiamo direttamente avviare QtiPlot, per vedere se funziona, inserendo il percorso relativo dell'eseguibile appena generato:
 qtiplot/qtiplot 
Finally you can, if desired, install the program with
 sudo make install or by using 
checkinstall: sudo checkinstall
 
that creates a simple package. Deb (the result, however, is "professional").

0 comments:

Post a Comment