从头说吧。起初是想装TensorFlow,但是装完后发现有个警告,提示SSE4.1的指令没有编译,但是仍然能凑合用。运行的hello world也正常。但问题是,我是能忍下凑合用的人吗?
于是上网搜,注意,我没用x度,而是用sogou,x度没底线。
说是解决弹出警告有2种方法,1是调整警告的等级,就是仍然会有这个警告,但是不让它显示出来了;2是重新下载TensorFlow的源码重新编译,修改编译参数就能解决,因为我使用pip 安装的,那是人家已经编译好的,默认没有使能SSE4.1的指令,所以才会出错。我一看这两个选择,那肯定不能选1啊。于是开始下载准备编译。要编译TensorFlow需要先装个bazel,那就装吧,也是下载了源码准备编译,它又提示JAVA_HOME没有设置。直到此时,遇到了JAVA的东西,我就开始抵触了,因为十分抵触它,总觉得它过于臃肿,当然了,这也能怪,对于以一个只会C/C++/Python的人来说,java的那一大堆环境设置就够烦的。什么jre,jvm,jdk,都是什么玩意儿,而且使用android手机的那几年给我的直观感觉就是,java就是慢腾腾的。以上这些都是我的个人愚见,因为如果它真相我说的那么不堪也不会有今天的地位,但是,我仍然抵触它,一直不想碰仍和跟他有关的东西。今天这又是冤家路窄了,没办法,来吧。
进入正题。
使用locate jdk 看了看都哪里有jdk的关键字。
详细的输出我就不贴了。
总之,看到了在 /usr/lib/jvm下面有一坨。部分摘录如下:
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-5.b14.fc23.x86_64
/usr/lib/jvm/jre-1.8.0-openjdk
/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.91-5.b14.fc23.x86_64
/usr/lib/jvm/jre-openjdk
/usr/lib/jvm-exports/java-1.8.0-openjdk-1.8.0.91-5.b14.fc23.x86_64
/usr/lib/jvm-exports/jre-1.8.0-openjdk-1.8.0.91-5.b14.fc23.x86_64
/usr/lib/jvm-exports/jre-openjdk
/usr/lib/jvm-private/java-1.8.0-openjdk-1.8.0.91-5.b14.fc23.x86_64
/usr/lib/jvm-private/java-1.8.0-openjdk-1.8.0.91-5.b14.fc23.x86_64-debug
/usr/lib64/perl5/vendor_perl/XML/Parser/Encodings/x-sjis-jdk117.enc
于是我就想把/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.91-5.b14.fc23.x86_64 赋值给JAVA_HOME,然后在~/.bashrc里面也添加export ,再去编译 bazel提示用这个路径找不到JDK。
[zz@zwfedora23 bazel]$ bash ./compile.sh
INFO: You can skip this first step by providing a path to the bazel binary as second argument:
INFO: ./compile.sh compile /path/to/bazel
Building Bazel from scratch
ERROR: JAVA_HOME (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-5.b14.fc23.x86_64) is not a path to a working JDK.
[zz@zwfedora23 bazel]$
就是这样的提示。
于是又去查了一下,说的就是这样设置。
我也不知道哪里错了。
此时,啥也不了解jdk的我开始瞎想,是不是换个jdk会管用,又去下载了sun的jdk安装后还是同样的问题,当时系统中使用java -version显示的版本号还是openjdk,而不是sun的jdk,就想把openjdk卸载了,但是卸到最后只剩一个headless的包就不能再卸了,因为有其他的系统应用依赖它。此时sun的包也卸载不了了,我猜想肯定也是被依赖着。
此时,到了这一步,想了一下,还是重装一下openjdk吧:
[zz@zwfedora23 my_tools]$ sudo dnf install java-1.8.0-openjdk
Repository fzug-free is listed more than once in the configuration
Repository fzug-free-source is listed more than once in the configuration
Repository fzug-nonfree is listed more than once in the configuration
Repository fzug-nonfree-source is listed more than once in the configuration
上次元数据过期检查:0:05:15 前,执行于 Fri Aug 25 15:26:33 2017。
依赖关系解决。
=============================================================================================================================================================================
Package 架构 版本 仓库 大小
=============================================================================================================================================================================
安装:
java-1.8.0-openjdk x86_64 1:1.8.0.111-1.b16.fc23 updates 227 k
事务概要
=============================================================================================================================================================================
安装 1 软件包
总下载:227 k
安装大小:504 k
确定吗?[y/N]: y
下载软件包:
java-1.8.0-openjdk-1.8.0.111-1.b16.fc23.x86_64.rpm 160 kB/s | 227 kB 00:01
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 59 kB/s | 227 kB 00:03
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
安装: java-1.8.0-openjdk-1:1.8.0.111-1.b16.fc23.x86_64 1/1
验证: java-1.8.0-openjdk-1:1.8.0.111-1.b16.fc23.x86_64 1/1
已安装:
java-1.8.0-openjdk.x86_64 1:1.8.0.111-1.b16.fc23
完毕!
接着又顺手把其他相关的也装上了:
[zz@zwfedora23 my_tools]$ sudo dnf install java-1.8.0-openjdk*
Repository fzug-free is listed more than once in the configuration
Repository fzug-free-source is listed more than once in the configuration
Repository fzug-nonfree is listed more than once in the configuration
Repository fzug-nonfree-source is listed more than once in the configuration
上次元数据过期检查:0:05:57 前,执行于 Fri Aug 25 15:26:33 2017。
软件包 java-1.8.0-openjdk-1:1.8.0.111-1.b16.fc23.x86_64 已安装,跳过
软件包 java-1.8.0-openjdk-headless-1:1.8.0.111-1.b16.fc23.x86_64 已安装,跳过
依赖关系解决。
=============================================================================================================================================================================
Package 架构 版本 仓库 大小
=============================================================================================================================================================================
安装:
java-1.8.0-openjdk-accessibility x86_64 1:1.8.0.111-1.b16.fc23 updates 35 k
java-1.8.0-openjdk-accessibility-debug x86_64 1:1.8.0.111-1.b16.fc23 updates 35 k
java-1.8.0-openjdk-debug x86_64 1:1.8.0.111-1.b16.fc23 updates 229 k
java-1.8.0-openjdk-demo x86_64 1:1.8.0.111-1.b16.fc23 updates 1.9 M
java-1.8.0-openjdk-demo-debug x86_64 1:1.8.0.111-1.b16.fc23 updates 2.0 M
java-1.8.0-openjdk-devel x86_64 1:1.8.0.111-1.b16.fc23 updates 9.8 M
java-1.8.0-openjdk-devel-debug x86_64 1:1.8.0.111-1.b16.fc23 updates 9.8 M
java-1.8.0-openjdk-headless-debug x86_64 1:1.8.0.111-1.b16.fc23 updates 32 M
java-1.8.0-openjdk-javadoc noarch 1:1.8.0.111-1.b16.fc23 updates 15 M
java-1.8.0-openjdk-javadoc-debug noarch 1:1.8.0.111-1.b16.fc23 updates 15 M
java-1.8.0-openjdk-javadoc-zip noarch 1:1.8.0.111-1.b16.fc23 updates 42 M
java-1.8.0-openjdk-javadoc-zip-debug noarch 1:1.8.0.111-1.b16.fc23 updates 42 M
java-1.8.0-openjdk-src x86_64 1:1.8.0.111-1.b16.fc23 updates 45 M
java-1.8.0-openjdk-src-debug x86_64 1:1.8.0.111-1.b16.fc23 updates 45 M
java-atk-wrapper x86_64 0.33.2-1.fc23 updates 83 k
事务概要
=============================================================================================================================================================================
安装 15 软件包
总下载:260 M
安装大小:929 M
确定吗?[y/N]: y
下载软件包:
^F(1-3/15): java-1.8.0-openjdk-javadoc-zip-debug-1.8.0.111-1.b16.fc23 4% [==- ] 481 kB/s | 10 MB 08:50 ET(1/15): java-1.8.0-openjdk-javadoc-debug-1.8.0.111-1.b16.fc23.noarch.rpm 206 kB/s | 15 MB 01:15 A
(2/15): java-1.8.0-openjdk-devel-1.8.0.111-1.b16.fc23.x86_64.rpm 90 kB/s | 9.8 MB 01:51
(3/15): java-1.8.0-openjdk-javadoc-zip-1.8.0.111-1.b16.fc23.noarch.rpm 201 kB/s | 42 MB 03:33
(4/15): java-1.8.0-openjdk-accessibility-1.8.0.111-1.b16.fc23.x86_64.rpm 12 kB/s | 35 kB 00:02
(5/15): java-1.8.0-openjdk-demo-1.8.0.111-1.b16.fc23.x86_64.rpm 51 kB/s | 1.9 MB 00:38
(6/15): java-1.8.0-openjdk-debug-1.8.0.111-1.b16.fc23.x86_64.rpm 13 kB/s | 229 kB 00:17
(7/15): java-1.8.0-openjdk-devel-debug-1.8.0.111-1.b16.fc23.x86_64.rpm 106 kB/s | 9.8 MB 01:34
(8/15): java-1.8.0-openjdk-demo-debug-1.8.0.111-1.b16.fc23.x86_64.rpm 56 kB/s | 2.0 MB 00:35
(9/15): java-1.8.0-openjdk-accessibility-debug-1.8.0.111-1.b16.fc23.x86_64.rpm 2.5 kB/s | 35 kB 00:13
(10/15): java-1.8.0-openjdk-javadoc-zip-debug-1.8.0.111-1.b16.fc23.noarch.rpm 116 kB/s | 42 MB 06:06
(11/15): java-1.8.0-openjdk-headless-debug-1.8.0.111-1.b16.fc23.x86_64.rpm 164 kB/s | 32 MB 03:22
(12/15): java-1.8.0-openjdk-javadoc-1.8.0.111-1.b16.fc23.noarch.rpm 123 kB/s | 15 MB 02:06
(13/15): java-atk-wrapper-0.33.2-1.fc23.x86_64.rpm 16 kB/s | 83 kB 00:05
(14/15): java-1.8.0-openjdk-src-debug-1.8.0.111-1.b16.fc23.x86_64.rpm 143 kB/s | 45 MB 05:19
^H^H(15/15): java-1.8.0-openjdk-src-1.8.0.111-1.b16.fc23.x86_64.rpm 99% [=================================================================-] 478 kB/s | 259 MB 00:02 (15/15): java-1.8.0-openjdk-src-1.8.0.111-1.b16.fc23.x86_64.rpm 187 kB/s | 45 MB 04:04
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 383 kB/s | 260 MB 11:34
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
安装: java-1.8.0-openjdk-headless-debug-1:1.8.0.111-1.b16.fc23.x86_64 1/15
安装: java-atk-wrapper-0.33.2-1.fc23.x86_64 2/15
安装: java-1.8.0-openjdk-debug-1:1.8.0.111-1.b16.fc23.x86_64 3/15
安装: java-1.8.0-openjdk-devel-1:1.8.0.111-1.b16.fc23.x86_64 4/15
安装: java-1.8.0-openjdk-devel-debug-1:1.8.0.111-1.b16.fc23.x86_64 5/15
安装: java-1.8.0-openjdk-demo-debug-1:1.8.0.111-1.b16.fc23.x86_64 6/15
安装: java-1.8.0-openjdk-accessibility-debug-1:1.8.0.111-1.b16.fc23.x86_64 7/15
安装: java-1.8.0-openjdk-accessibility-1:1.8.0.111-1.b16.fc23.x86_64 8/15
安装: java-1.8.0-openjdk-javadoc-zip-debug-1:1.8.0.111-1.b16.fc23.noarch 9/15
安装: java-1.8.0-openjdk-javadoc-debug-1:1.8.0.111-1.b16.fc23.noarch 10/15
安装: java-1.8.0-openjdk-src-debug-1:1.8.0.111-1.b16.fc23.x86_64 11/15
安装: java-1.8.0-openjdk-src-1:1.8.0.111-1.b16.fc23.x86_64 12/15
安装: java-1.8.0-openjdk-javadoc-1:1.8.0.111-1.b16.fc23.noarch 13/15
安装: java-1.8.0-openjdk-demo-1:1.8.0.111-1.b16.fc23.x86_64 14/15
安装: java-1.8.0-openjdk-javadoc-zip-1:1.8.0.111-1.b16.fc23.noarch 15/15
验证: java-1.8.0-openjdk-javadoc-zip-1:1.8.0.111-1.b16.fc23.noarch 1/15
验证: java-1.8.0-openjdk-javadoc-zip-debug-1:1.8.0.111-1.b16.fc23.noarch 2/15
验证: java-1.8.0-openjdk-javadoc-debug-1:1.8.0.111-1.b16.fc23.noarch 3/15
验证: java-1.8.0-openjdk-devel-1:1.8.0.111-1.b16.fc23.x86_64 4/15
验证: java-1.8.0-openjdk-demo-1:1.8.0.111-1.b16.fc23.x86_64 5/15
验证: java-1.8.0-openjdk-accessibility-1:1.8.0.111-1.b16.fc23.x86_64 6/15
验证: java-1.8.0-openjdk-devel-debug-1:1.8.0.111-1.b16.fc23.x86_64 7/15
验证: java-1.8.0-openjdk-debug-1:1.8.0.111-1.b16.fc23.x86_64 8/15
验证: java-1.8.0-openjdk-headless-debug-1:1.8.0.111-1.b16.fc23.x86_64 9/15
验证: java-1.8.0-openjdk-demo-debug-1:1.8.0.111-1.b16.fc23.x86_64 10/15
验证: java-1.8.0-openjdk-accessibility-debug-1:1.8.0.111-1.b16.fc23.x86_64 11/15
验证: java-1.8.0-openjdk-src-debug-1:1.8.0.111-1.b16.fc23.x86_64 12/15
验证: java-1.8.0-openjdk-javadoc-1:1.8.0.111-1.b16.fc23.noarch 13/15
验证: java-1.8.0-openjdk-src-1:1.8.0.111-1.b16.fc23.x86_64 14/15
验证: java-atk-wrapper-0.33.2-1.fc23.x86_64 15/15
已安装:
java-1.8.0-openjdk-accessibility.x86_64 1:1.8.0.111-1.b16.fc23 java-1.8.0-openjdk-accessibility-debug.x86_64 1:1.8.0.111-1.b16.fc23
java-1.8.0-openjdk-debug.x86_64 1:1.8.0.111-1.b16.fc23 java-1.8.0-openjdk-demo.x86_64 1:1.8.0.111-1.b16.fc23
java-1.8.0-openjdk-demo-debug.x86_64 1:1.8.0.111-1.b16.fc23 java-1.8.0-openjdk-devel.x86_64 1:1.8.0.111-1.b16.fc23
java-1.8.0-openjdk-devel-debug.x86_64 1:1.8.0.111-1.b16.fc23 java-1.8.0-openjdk-headless-debug.x86_64 1:1.8.0.111-1.b16.fc23
java-1.8.0-openjdk-javadoc.noarch 1:1.8.0.111-1.b16.fc23 java-1.8.0-openjdk-javadoc-debug.noarch 1:1.8.0.111-1.b16.fc23
java-1.8.0-openjdk-javadoc-zip.noarch 1:1.8.0.111-1.b16.fc23 java-1.8.0-openjdk-javadoc-zip-debug.noarch 1:1.8.0.111-1.b16.fc23
java-1.8.0-openjdk-src.x86_64 1:1.8.0.111-1.b16.fc23 java-1.8.0-openjdk-src-debug.x86_64 1:1.8.0.111-1.b16.fc23
java-atk-wrapper.x86_64 0.33.2-1.fc23
完毕!
此时,系统中有2个jdk了。刚才卸载sun的jdk被系统拒绝,现在再试试:
[zz@zwfedora23 ~]$ rpm -qa | grep jdk
java-1.8.0-openjdk-headless-1.8.0.111-1.b16.fc23.x86_64
java-1.8.0-openjdk-1.8.0.111-1.b16.fc23.x86_64
copy-jdk-configs-1.1-3.fc23.noarch
jdk1.8.0_144-1.8.0_144-fcs.x86_64
[zz@zwfedora23 ~]$ sudo rpm -e jdk1.8.0_144-1.8.0_144-fcs
[sudo] zz 的密码:
对不起,请重试。
[sudo] zz的密码:
[zz@zwfedora23 ~]$ rpm -qa | grep jdk
java-1.8.0-openjdk-headless-1.8.0.111-1.b16.fc23.x86_64
java-1.8.0-openjdk-1.8.0.111-1.b16.fc23.x86_64
copy-jdk-configs-1.1-3.fc23.noarch
[zz@zwfedora23 ~]$
这次卸载成功了。
然后看了一下它的安装目录,原本系统自带的openjdk是在/usr/lib/jvm下的,重装后应该也在那里:
[zz@zwfedora23 my_tools]$ ls /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-1.b16.fc23.x86_64
bin demo include jre lib sample src.zip tapset
[zz@zwfedora23 my_tools]$ ls /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-1.b16.fc23.x86_64/bin/
appletviewer jar javac javap jconsole jhat jmap jsadebugd jstatd orbd rmic schemagen tnameserv wsimport
extcheck jarsigner javadoc java-rmi.cgi jdb jinfo jps jstack keytool pack200 rmid serialver unpack200 xjc
idlj java javah jcmd jdeps jjs jrunscript jstat native2ascii policytool rmiregistry servertool wsgen
[zz@zwfedora23 my_tools]$
然后重新设置JAVA_HOME的值,把它加到~/.bashrc中:
23 export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-1.b16.fc23.x86_64
24 export PATH=$PATH:$JAVA_HOME/bin
退出后source ~/.bashrc 或者关闭当前的状态,重新打开一下。
再次编译bazel 就可以了,此时bazel正在编译呢,从我开始写这篇日志开始还没完呢。
我在另一篇日志中记录如何编译bazel.