[关闭]
@maorongrong 2016-08-26T04:32:39.000000Z 字数 2655 阅读 1256

编译安装octave

Linux 机器学习


linux下软件编译与安装

编译安装最新版Octave

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

  1. cd /tmp && wget ftp://ftp.gnu.org/gnu/octave/octave-4.0.3.tar.gz
  2. 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

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

configure

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

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

  1. $ cd octave-4.0.2/
  2. $ ./configure --prefix=/opt/octave --enable-jit &> LOG_configure
  3. $ tail -50 LOG_configure
  4. configure: WARNING:
  5. I wasn't able to find a suitable style for declaring the api prefix
  6. in a bison input file so I'm disabling bison.
  7. configure: WARNING:
  8. I wasn't able to find a suitable style for declaring a push-pull
  9. parser in a bison input file so I'm disabling bison.
  10. configure: WARNING:
  11. I didn't find bison, or the version of bison that I found does not
  12. support all the features that are required, but it's only a problem
  13. if you need to reconstruct parse.cc, which is the case if you're
  14. building from VCS sources.
  15. configure: WARNING:
  16. I didn't find icotool, but it's only a problem if you need to
  17. reconstruct octave-logo.ico, which is the case if you're building from
  18. VCS sources.
  19. configure: WARNING:
  20. I didn't find rsvg-convert, but it's only a problem if you need to
  21. reconstruct octave-logo-*.png, which is the case if you're building
  22. from VCS sources.
  23. ***(bison忽略)***
  24. configure: WARNING: OSMesa library not found. Offscreen rendering with OpenGL will be disabled.***(息屏渲染,不需要)***
  25. ***(通过检查发现没有安装jdk,就没有JAVA_HOME)***
  26. configure: WARNING: JAVA_HOME environment variable not initialized. Auto-detection will proceed but is unreliable.
  27. configure:
  28. configure: NOTE: Libraries or auxiliary programs may be skipped if they are
  29. configure: NOTE: not found OR if they are missing required features on your
  30. configure: NOTE: system.
  31. 补安装JDK,参考https://www.zybuluo.com/maorongrong/note/463149
  32. 重新编译
  33. $ ./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'的所有输出日志,在日志里能够看得到到底安装了那些文件到那些位置,将其删除。

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注