Maorongrong smile like sunshine

编译安装octave

2015-03-03

编译安装octave其实挺傻的,我记得他们家官网写的添加源的安装很方便的。

因为直接sudo apt-get update && sudo apt-get install octave版本老旧,选择编译安装最新版(today 16.8.9)4.0.3-octave

cd /tmp && wget ftp://ftp.gnu.org/gnu/octave/octave-4.0.3.tar.gz
tar xvf octave-4.0.3.tar.gz

## 安装构建依赖:(根据源上旧版本octave依赖关系安装依赖包) $ sudo apt-get build-dep octave

安装gui依赖包

为了使用GUI,还需要补充libportaudio-dev libqt4-opengl-dev,否则会在configure之后看到一个Warning“Qt libraries not found – disabling GUI”。继而导致编译出来的octave没有GUI。 如需要使用jit来加速循环,则需要安装llvm

sudo apt-get install libportaudio-dev libqt4-opengl-dev #for gui
sudo apt-get install llvm                               #for jit

configure

./configure 比较重要的一个参数是 --prefix ,用--prefix 参数,我们可以指定软件安装目录;当我们不需要这个软件时,直接删除软件的目录就行了,这里将octave安装在/opt/octave

– 如果需要jit,就加上–enable-jit – 设置安装位置为/opt/octave – 留意查看输出内容最后的摘要和警告信息,根据需要补齐相关的库(bison一些图标相关的库也可以不补,具体情况请看警告信息中的说明)。

$ cd octave-4.0.2/
$ ./configure --prefix=/opt/octave --enable-jit &> LOG_configure
$ tail -50 LOG_configure
configure: WARNING:

I wasn't able to find a suitable style for declaring the api prefix
in a bison input file so I'm disabling bison.


configure: WARNING:
I wasn't able to find a suitable style for declaring a push-pull
parser in a bison input file so I'm disabling bison.

configure: WARNING:

I didn't find bison, or the version of bison that I found does not
support all the features that are required, but it's only a problem
if you need to reconstruct parse.cc, which is the case if you're
building from VCS sources.

configure: WARNING:

I didn't find icotool, but it's only a problem if you need to
reconstruct octave-logo.ico, which is the case if you're building from
VCS sources.

configure: WARNING:

I didn't find rsvg-convert, but it's only a problem if you need to
reconstruct octave-logo-*.png, which is the case if you're building
from VCS sources.
***(bison忽略)***
configure: WARNING: OSMesa library not found.  Offscreen rendering with OpenGL will be disabled.***(息屏渲染,不需要)***
***(通过检查发现没有安装jdk,就没有JAVA_HOME)***
configure: WARNING: JAVA_HOME environment variable not initialized.  Auto-detection will proceed but is unreliable.
configure:
configure: NOTE: Libraries or auxiliary programs may be skipped if they are
configure: NOTE: not found OR if they are missing required features on your
configure: NOTE: system.


补安装JDK,参考https://www.zybuluo.com/maorongrong/note/463149
重新编译
$ ./configure --prefix=/opt/octave --enable-jit &> LOG_configure_1

make

用于保存安装信息日志,这样需要卸载的时候方便查看哪些文件安装在了系统目录中

sudo make &> LOG_makesudo make > LOG_make 2>&1 sudo make check(可以省略)

make install

用于保存安装信息日志,这样需要卸载的时候方便查看哪些文件安装在了系统目录中

$ sudo make install &> LOG_install

快捷启动命令

一般安装完成可以使用sudo octave 启动octave gui程序,但是有时候提示 command don't find,需要在系统路径中设置。 软件安装位置下的bin目录一般有启动文件,执行命令 sudo /opt/octave/bin/octave 即可以直接启动软件。

但是为了启动方便,需要建立系统路径软链接: sudo ln -s /opt/octave/bin/octave /usr/bin/octave

之后,命令sudo octave就可以启动程序了。

NOTE

在linux 中用 ./configure && make && make install 后,如果想删除这个软件我应该怎么删除呢? 常见的反安装target有: make uninstall/distclean/veryclean 等等。如果没有, 事先需要记录’make install’的所有输出日志,在日志里能够看得到到底安装了那些文件到那些位置,将其删除。


Similar Posts

Comments