Android with root Git for version control Lircd with Raspberry Pi for IR receiver and sender Tips for Windows Depolying your own password management tool -- KeeWeb Depoly your flask app into Heroku Fix shit IE code manually ISBN to Book Category by Scraping DangDang A Generic Makefile for C/C++ Program Configure Raspberry pi Remove watermark with PyPDF2 tips for docker Anaconda+TensorFlow+CUDA Snippets Configure Remote Mathematica Kernel Build your own ngrok server Access Array SSL VPN 使用Rstudio制作html5幻灯片 tips for Mac OS X system Tips for ipython notebook 配置Ubuntu server + Openbox (Obuntu) tips for Vimperator tips for Vim 安装CUDA My First Jekyll Blog rsync常见选项 在Linux中读取Ipod touch的文件 tip for texmacs 在VPS上建站的一些tip Gnuplot绘图札记 Samba系统和autofs自动挂载 Linux中alsamixer声卡无法录音 搭建自己的RSS订阅器——Tiny Tiny RSS Grub2引导安装Ubuntu awk tips 将Ubuntu系统装入U盘 The Great Rtorrent 编译GCC 再这样剁手!!!该死的libgd 使用ulimit进行资源限制 使用SSH代理上IPV6 使用RCurl抓取网页数据 修复Ubuntu Grub记 openbox中的文件关联 在Ubuntu 12.04下编译qtiplot 处理BCM4312网卡驱动纪实 配置我的Ubuntu Server记 Cygwin杂记 Linux 使普通用户具有以超级权限执行脚本 让firefox自定义地处理文件类型 WordPress优秀主题及插件 在phpcloud上搭建wordpress UBUNTU下用pptpd做VPN server ubuntu升级内核过后的一些问题 安装telnet服务 kubuntu札记 64位kubuntu札记 统计软件R Virtualbox stardict星际译王 Ubuntu重装windows系统后的grub引导修复 SSH服务及花生壳域名解析 采用cbp2make工具由code::blocks工程创建makefile文件 UBUNTU 札记

在Ubuntu 12.04下编译qtiplot

2013年07月11日

不在windows下,再加上不想用盗版,所以需要一个origin的替代品——qtiplot。虽然我非常抵抗用这种不停点来点去的软件,用R的ggplot2画图多好啊,高效、优雅、漂亮,但是终抵不过老板一句“这个图你用origin画”。

有公司编译出了qtiplot的deb包,但是缺少一些功能,比如不能导出数据,这太坑爹了!好吧,我只有自己来编译。哪儿知道它有太多的依赖,并且头文件包含还不能紧跟时代。 解压源代码后复制build.conf.example为build.conf,然后在里面把库的链接改成系统内的目录,不要用它那个3rdparty的目录。然后就是qmake产生Makefile,接着一边make一边看出现什么错误提示,比如找不到头文件啊,这一般是因为某些依赖的包没有安装,使用Ubuntu的包内容搜索功能找到包含这个头文件的包,然后apt-get安装上。

注意:安装好包过后还是提示找不到头文件,就是文件包含位置不对,要么手动更改源代码将头文件位置改对,要么在build.conf里面添加一个包含目录。

唯一需要修改源代码的地方就是在./3rdparty/qwtplot3d/include/qwt3d_openglhelper.h中包含#include <GL/glu.h>

对python脚本的支持实在是弄不好了,需要sip和pyqt来生成一个头文件sipAPIqti.h,这一步我没有成功。

应该是需要下面这些包依赖:

sudo apt-get install libqt4-opengl-dev libmuparser-dev libtamuanova-dev libalglib-dev libqtassistantclient-dev libqtexengine-dev python-dev

那个手册没有编译安装,为了装它得下个latex,太不值了,所以在生成makefile后直接把手册的那部分全部删掉。

最后,关于qtiplot的文件关联问题。在Ubuntu 12.04下,如果右键选取一个新的应用程序来打开该文件,必须要求该mime类型在/usr/share/applications/下有一个对应的desktop文件,同时,该desktop文件中Exec=一栏中命令后面需要带有参数%f以用来表示此程序后面可以跟文件名。同时,在/usr/share/mime/application/目录下会有一个xml文件标示该mime类型。

下面直接把我的build.conf传上来。

isEmpty( QTI_ROOT ) {
  message( "each file including this config 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 /usr/include/python2.7 /usr/include/muParser /usr/include/tamu_anova /usr/include/qt4/QtAssistant
# Global lib path and libs which is ls always added at the end of LIBS
SYS_LIBS = -L/opt/local/lib -lGLU

##########################################################
## 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 = $QTI_ROOT/3rdparty/muparser/include
# link statically against a copy in 3rdparty/
#MUPARSER_LIBS =  $QTI_ROOT/3rdparty/muparser/lib/libmuparser.a
# 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
GSL_INCLUDEPATH =
# 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/
# link locally against a copy in 3rdparty/
ALGLIB_LIBS = /usr/lib/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 = /usr/lib/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
}