目次

FreeBSD/AMD64 8.0 RELEASEへのJDK導入

2009年12月30日 10時14分23秒

H2DBを試そうと目論んだらJavaの環境がいる。とりあえず導入までの手順を記録した。 Javaの環境に関しては、Windowsが一番構築ラクでいい。Linuxでは構築したって言う実感が湧かない。 そしてFreeBSDでは苦行と言っててもよいかもしれない。

Portsコレクションから導入をやってみる

FreeBSDのJava関係バイナリはFreeBSD Foundation Java Downloadsから入手可能なんだけど、8.0用はまだ無いので自前でコンパイルしなきゃいけない。

cd /usr/ports/java/jdk16 & make fetch

どうやら5つばかり手動でアーカイブを持ってこないといけないようだ。 少なくとも2009/12/27の時点ではそう。

amanda# make fetch
===>  Vulnerability check disabled, database not found

IMPORTANT: To build the JDK 1.6.0 port, you should have at least
2.5Gb of free disk space in the build area!


 Due to licensing restrictions, certain files must be fetched manually.

 Please download the Update 3 Source from
 http://www.java.net/download/jdk6/6u3/promoted/b05/jdk-6u3-fcs-src-b05-jrl-24_sep_2007.jar
 and the Source Binaries from
 http://www.java.net/download/jdk6/6u3/promoted/b05/jdk-6u3-fcs-bin-b05-jrl-24_sep_2007.jar
 and the Mozilla Headers from
 http://www.java.net/download/jdk6/6u3/promoted/b05/jdk-6u3-fcs-mozilla_headers-b05-unix-24_sep_2007.jar
 .

 Please open http://java.sun.com/javase/downloads/index.jsp
 in a web browser and follow the "Download" link for
 "JDK US DST Timezone Update Tool - 1_3_21" to obtain the
 time zone update file, tzupdater-1_3_21-2009p.zip.

 Please download the patchset, bsd-jdk16-patches-4.tar.bz2, from
 http://www.eyesbeyond.com/freebsddom/java/jdk16.html.

 Please place the downloaded file(s) in /usr/ports/distfiles
 and restart the build.

*** Error code 1

Stop in /usr/ports/java/jdk16.
amanda#

再度挑戦

amanda# cd /usr/ports/java/jdk16
amanda# make
===>  Vulnerability check disabled, database not found
===>  Found saved configuration for jdk-1.6.0.3p4_13

IMPORTANT: To build the JDK 1.6.0 port, you should have at least
2.5Gb of free disk space in the build area!

===>  Extracting for jdk-1.6.0.3p4_13
=> MD5 Checksum OK for jdk-6u3-fcs-src-b05-jrl-24_sep_2007.jar.
=> SHA256 Checksum OK for jdk-6u3-fcs-src-b05-jrl-24_sep_2007.jar.
=> MD5 Checksum OK for jdk-6u3-fcs-bin-b05-jrl-24_sep_2007.jar.
=> SHA256 Checksum OK for jdk-6u3-fcs-bin-b05-jrl-24_sep_2007.jar.
=> MD5 Checksum OK for jdk-6u3-fcs-mozilla_headers-b05-unix-24_sep_2007.jar.
=> SHA256 Checksum OK for jdk-6u3-fcs-mozilla_headers-b05-unix-24_sep_2007.jar.
=> MD5 Checksum OK for bsd-jdk16-patches-4.tar.bz2.
=> SHA256 Checksum OK for bsd-jdk16-patches-4.tar.bz2.
=> MD5 Checksum OK for tzupdater-1_3_21-2009p.zip.
=> SHA256 Checksum OK for tzupdater-1_3_21-2009p.zip.
===>   jdk-1.6.0.3p4_13 depends on executable: unzip - found
/bin/sh /usr/ports/java/jdk16/files/license.sh
JAVA RESEARCH LICENSE
Version 1.6


I.    DEFINITIONS.

"Licensee" means You and any other party that has entered into and has
in effect a version of this License.

"Modifications" means any change or addition to the Technology.

"Sun" means Sun Microsystems, Inc. and its successors and assignees.

"Research Use" means research, evaluation, or development for the
purpose of advancing knowledge, teaching, learning, or customizing the
Technology or Modifications for personal use. Research Use expressly
excludes use or distribution for direct or indirect commercial
(including strategic) gain or advantage.

"Technology" means the source code and object code of the technology
made available by Sun pursuant to this License.

"Technology Site" means the website designated by Sun for accessing
the Technology.

"You" means the individual executing this License or the legal entity
or entities represented by the individual executing this License.

II.     PURPOSE.

Sun is licensing the Technology under this Java Research License (the
"License") to promote research, education, innovation, and development
using the Technology.  This License is not intended to permit or
enable access to the Technology for active consultation as part of
creating an independent implementation of the Technology.

COMMERCIAL USE AND DISTRIBUTION OF TECHNOLOGY AND MODIFICATIONS IS
PERMITTED ONLY UNDER A SUN COMMERCIAL LICENSE.

III.     RESEARCH USE RIGHTS.

A.    License Grant. Subject to the conditions contained herein, Sun
grants to You a non-exclusive, non-transferable, worldwide, and
royalty-free license to do the following for Your Research Use only:

1.    Reproduce, create Modifications of,  and use the Technology
alone, or with Modifications;

2.    Share source code of the Technology alone, or with
Modifications, with other Licensees; and

3.    Distribute object code of the Technology, alone, or with
Modifications, to any third parties for Research Use only, under a
license of Your choice that is consistent with this License; and
publish papers and books discussing the Technology which may include
relevant excerpts that do not in the aggregate constitute a
significant portion of the Technology.

B.     Residual Rights.  If You examine the Technology after accepting
this License and remember anything about it later, You are not
"tainted" in a way that would prevent You from creating or
contributing to an independent implementation, but this License grants
You no rights to Sun's copyrights or patents for use in such an
implementation.

C.    No Implied Licenses.  Other than the rights granted herein, Sun
retains all rights, title, and interest in Technology, and You retain
all rights, title, and interest in Your Modifications and associated
specifications, subject to the terms of this License.

D.    Third Party Software.  Portions of the Technology may be
provided with licenses or other notices from third parties that govern
the use of those portions. Any licenses granted hereunder do not alter
any rights and obligations You may have under such licenses, however,
the disclaimer of warranty and limitation of liability provisions in
this License will apply to all Technology in this distribution.

IV.    INTELLECTUAL PROPERTY REQUIREMENTS

As a condition to Your License, You agree to comply with the following
restrictions and responsibilities:

A.    License and Copyright Notices. You must include a copy of this
Java Research License in a Readme file for any Technology or
Modifications you distribute. You must also include the following
statement, "Use and distribution of this technology is subject to the
Java Research License included herein", (a) once prominently in the
source code tree and/or specifications for Your source code
distributions, and (b) once in the same file as Your copyright or
proprietary notices for Your binary code distributions. You must cause
any files containing Your Modification to carry prominent notice
stating that You changed the files. You must not remove or alter any
copyright or other proprietary notices in the Technology.

B.    Licensee Exchanges.    Any Technology and Modifications You
receive from any Licensee are governed by this License.

V.    GENERAL TERMS.

A.    Disclaimer Of Warranties.

THE TECHNOLOGY IS PROVIDED "AS IS", WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, WARRANTIES
THAT THE TECHNOLOGY IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A
PARTICULAR PURPOSE, OR NON-INFRINGING OF THIRD PARTY RIGHTS.  YOU
AGREE THAT YOU BEAR THE ENTIRE RISK IN CONNECTION WITH YOUR USE AND
DISTRIBUTION OF ANY AND ALL TECHNOLOGY  UNDER THIS LICENSE.

B.    Infringement; Limitation Of Liability.

1.    If any portion of, or functionality implemented by, the
Technology becomes the subject of a claim or threatened claim of
infringement ("Affected Materials"), Sun may, in its unrestricted
discretion, suspend Your rights to use and distribute the Affected
Materials under this License. Such suspension of rights will be
effective immediately upon Sun's posting of notice of suspension on
the Technology Site.

2.    IN NO EVENT WILL SUN BE LIABLE FOR ANY DIRECT, INDIRECT,
PUNITIVE, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES IN CONNECTION
WITH OR ARISING OUT OF THIS LICENSE (INCLUDING, WITHOUT LIMITATION,
LOSS OF PROFITS, USE, DATA, OR ECONOMIC ADVANTAGE OF ANY SORT),
HOWEVER IT ARISES AND ON ANY THEORY OF LIABILITY (including
negligence), WHETHER OR NOT SUN HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.  LIABILITY UNDER THIS SECTION V.B.2 SHALL BE SO LIMITED
AND EXCLUDED, NOTWITHSTANDING FAILURE OF THE ESSENTIAL PURPOSE OF ANY
REMEDY.

C.     Termination.

1.    You may terminate this License at any time by notifying Sun in a
writing addressed to Sun Microsystems, Inc., 4150 Network Circle,
Santa Clara, California 95054, Attn.: Legal Department/Products and
Technology Law.

2.    All Your rights will terminate under this License if You fail to
comply with any of its material terms or conditions and do not cure
such failure within thirty (30) days after becoming aware of such
noncompliance.

3.    Upon termination, You must discontinue all uses and distribution
under this agreement, and all provisions of this Section V ("General
Terms") shall survive termination.

D.     Miscellaneous.


1.    Trademark.  You agree to comply with Sun's Trademark & Logo
Usage Requirements, as modified from time to time, available at
http://www.sun.com/policies/trademarks/.  Except as expressly provided
in this License, You are granted no rights in or to any Sun trademarks
now or hereafter used or licensed by Sun.

2.    Integration.  This License represents the complete agreement of
the parties concerning the subject matter hereof.

3.    Severability.  If any provision of this License is held
unenforceable, such provision shall be reformed to the extent
necessary to make it enforceable unless to do so would defeat the
intent of the parties, in which case, this License shall terminate.

4.    Governing Law.  This License is governed by the laws of the
United States and the State of California, as applied to contracts
entered into and performed in California between California residents.
In no event shall this License be construed against the drafter.

5.    Export Control.   As further described at
http://www.sun.com/its, you agree to comply with the U.S. export
controls and trade laws of other countries that apply to Technology
and Modifications.


Do you agree to the above license terms? [yes or no]
yes

yesと答えるとがらがら処理が始まる。 …でもやっぱり途中で止められる。最初から必要な物を全部言ってくれれば良いのに…

Patching file j2se/src/solaris/transport/socket/socket_md.c using Plan A...
Hunk #1 succeeded at 18.
Hunk #2 succeeded at 265.
done
===>  Applying FreeBSD patches for jdk-1.6.0.3p4_13
===>   jdk-1.6.0.3p4_13 depends on executable: zip - found
===>   jdk-1.6.0.3p4_13 depends on executable: unzip - found
===>   jdk-1.6.0.3p4_13 depends on file: /usr/local/lib/libXm.so - found
===>   jdk-1.6.0.3p4_13 depends on file: /usr/local/include/cups/cups.h - found
===>   jdk-1.6.0.3p4_13 depends on file: /usr/local/diablo-jdk1.6.0/bin/javac - not found
===>    Verifying install for /usr/local/diablo-jdk1.6.0/bin/javac in /usr/ports/java/diablo-jdk16
===>  Vulnerability check disabled, database not found
===>  Found saved configuration for diablo-jdk-1.6.0.07.02_7

 Because of licensing restrictions, you must fetch the distribution
 manually.

 Please access

     http://www.FreeBSDFoundation.org/cgi-bin/download?download=diablo-caffe-freebsd7-amd64-1.6.0_07-b02.tar.bz2

 with a web browser and "Accept" the End User License Agreement for
 "Caffe Diablo 1.6.0".

 Please place the downloaded file(s) in /usr/ports/distfiles.

*** Error code 1

Stop in /usr/ports/java/diablo-jdk16.
*** Error code 1

Stop in /usr/ports/java/diablo-jdk16.
*** Error code 1

Stop in /usr/ports/java/jdk16.
*** Error code 1

Stop in /usr/ports/java/jdk16.
amanda#

と言う事なので diablo-caffe-freebsd7-amd64-1.6.0_07-b02.tar.bz2 も入手して /usr/ports/distfiles へ格納します。 再度 make を実行すると….

gmake[4]: Entering directory `/usr/ports/java/jdk16/work/install/make/installer/binaries/bsd'
gmake[4]: Nothing to be done for `all'.
gmake[4]: Leaving directory `/usr/ports/java/jdk16/work/install/make/installer/binaries/bsd'
gmake[3]: Leaving directory `/usr/ports/java/jdk16/work/install/make/installer/binaries'
<<<Finished Recursively making binaries all @ Sun Dec 27 04:16:36 JST 2009.
>>>Recursively making bundles all @ Sun Dec 27 04:16:36 JST 2009 ...
gmake[3]: Entering directory `/usr/ports/java/jdk16/work/install/make/installer/bundles'
if [ -r bsd ]; then \
           ( cd  bsd ; gmake all ); \
        fi
gmake[4]: Entering directory `/usr/ports/java/jdk16/work/install/make/installer/bundles/bsd'
gmake[4]: Nothing to be done for `all'.
gmake[4]: Leaving directory `/usr/ports/java/jdk16/work/install/make/installer/bundles/bsd'
gmake[3]: Leaving directory `/usr/ports/java/jdk16/work/install/make/installer/bundles'
<<<Finished Recursively making bundles all @ Sun Dec 27 04:16:37 JST 2009.
amd64 Installer Build finished:   1.6.0_03-p4-b00
gmake[2]: Leaving directory `/usr/ports/java/jdk16/work/install/make/installer'
<<<Finished Recursively making installer all @ Sun Dec 27 04:16:37 JST 2009.
amd64 Install Build finished:   1.6.0_03-p4-b00
gmake[1]: Leaving directory `/usr/ports/java/jdk16/work/install/make'
Control workspace build finished: 09-12-27 04:16
amanda#

できたっぽい。

make install

さて、インストールする。

amanda# make install
===>  Installing for jdk-1.6.0.3p4_13
===>   jdk-1.6.0.3p4_13 depends on executable: javavm - found
===>   jdk-1.6.0.3p4_13 depends on file: /usr/local/libdata/pkgconfig/x11.pc - found
===>   jdk-1.6.0.3p4_13 depends on file: /usr/local/libdata/pkgconfig/xext.pc - found
===>   jdk-1.6.0.3p4_13 depends on file: /usr/local/libdata/pkgconfig/xi.pc - found
===>   jdk-1.6.0.3p4_13 depends on file: /usr/local/libdata/pkgconfig/xtst.pc - found
===>   jdk-1.6.0.3p4_13 depends on executable: pkg-config - found
===>   jdk-1.6.0.3p4_13 depends on executable: update-desktop-database - found
===>   jdk-1.6.0.3p4_13 depends on file: /usr/local/lib/gio/modules/libgiofam.so - found
===>   jdk-1.6.0.3p4_13 depends on shared library: iconv.3 - found
===>   jdk-1.6.0.3p4_13 depends on shared library: glib-2.0.0 - found
===>   Generating temporary packing list
===>  Checking if java/jdk16 already installed
/bin/mkdir -p /usr/local/jdk1.6.0
cd /usr/ports/java/jdk16/work/control/make/../build/bsd-amd64/j2sdk-image && /usr/bin/find .  | /usr/bin/cpio -pdmu -R root:wheel /usr/local/jdk1.6.0
309757 blocks
/bin/mkdir -p /usr/local/share/applications
install  -o root -g wheel -m 444 /usr/ports/java/jdk16/work/control/make/../build/bsd-amd64/j2sdk-image/jre/lib/desktop/applications/sun-java.desktop  /usr/local/share/applications/sun-java16.desktop
install  -o root -g wheel -m 444 /usr/ports/java/jdk16/work/control/make/../build/bsd-amd64/j2sdk-image/jre/lib/desktop/applications/sun-javaws.desktop  /usr/local/share/applications/sun-javaws16.desktop
install  -o root -g wheel -m 444 /usr/ports/java/jdk16/work/control/make/../build/bsd-amd64/j2sdk-image/jre/lib/desktop/applications/sun_java.desktop  /usr/local/share/applications/sun-jcontrol16.desktop
install  -o root -g wheel -m 444 /usr/ports/java/jdk16/files/cacerts  /usr/local/jdk1.6.0/jre/lib/security/cacerts
===>   Registering installation for jdk-1.6.0.3p4_13
===> SECURITY REPORT:
      This port has installed the following files which may act as network
      servers and may therefore pose a remote security risk to the system.
/usr/local/jdk1.6.0/jre/bin/javaws
/usr/local/jdk1.6.0/jre/lib/amd64/server/libjvm.so
/usr/local/jdk1.6.0/jre/lib/amd64/libnio.so
/usr/local/jdk1.6.0/jre/lib/amd64/libdt_socket.so
/usr/local/jdk1.6.0/jre/lib/amd64/native_threads/libhpi.so
/usr/local/jdk1.6.0/bin/javaws
/usr/local/jdk1.6.0/jre/lib/amd64/libnet.so

      If there are vulnerabilities in these programs there may be a security
      risk to the system. FreeBSD makes no guarantee about the security of
      ports included in the Ports Collection. Please type 'make deinstall'
      to deinstall the port if this is a concern.

      For more information, and contact details about the security
      status of this software, see the following webpage:
http://www.freebsd.org/java/
amanda# rehash
amanda# java -version
java version "1.6.0_03-p4"
Java(TM) SE Runtime Environment (build 1.6.0_03-p4-k896951_27_dec_2009_03_49-b00)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_03-p4-k896951_27_dec_2009_03_49-b00, mixed mode)
amanda#

インストール終了。

make packeage

Jailにもインストールしたりするので、コンパイルしたものを package にしておく。

amanda#
amanda# make package
===>  Building package for jdk-1.6.0.3p4_13
Creating package /usr/ports/java/jdk16/jdk-1.6.0.3p4_13.tbz
Registering depends: desktop-file-utils-0.15_1 gio-fam-backend-2.22.2 gamin-0.1.10_3 glib-2.22.2 gettext-0.17_1 libiconv-1.13.1 libXi-1.2.1,1 libXtst-1.0.3_1 libXext-1.0.5,1 libX11-1.2.1_1,1 libxcb-1.4 libpthread-stubs-0.3_3 pcre-8.00 libXau-1.0.4 libXdmcp-1.0.2_1 xproto-7.0.15 xtrans-1.2.3 pkg-config-0.23_1 javavmwrapper-2.3.3 perl-5.8.9_3 xcb-proto-1.5 python26-2.6.4 inputproto-1.5.0 kbproto-1.0.3 recordproto-1.13.2 xextproto-7.0.5.
Creating bzip'd tar ball in '/usr/ports/java/jdk16/jdk-1.6.0.3p4_13.tbz'
amanda#

出来上がったパッケージ jdk-1.6.0.3p4_13.tbz は pkg_add コマンドで利用可能になる。

jdk16の前提ソフトウエア

新規にJailインスタンスをつくり、pkg_add やろうとしたら。

amanda# jexec 6 su
h2dbcluster1# df
Filesystem  1K-blocks    Used    Avail Capacity  Mounted on
/dev/ad6s1d 101554150 7544694 85885124     8%    /
h2dbcluster1# cd /usr/ports
h2dbcluster1# cd java
h2dbcluster1# cd jdk16
h2dbcluster1# ll
total 59338
-rw-r--r--   1 root  wheel     14385 11 29 00:27 Makefile
-rw-r--r--   1 root  wheel      1416 11 29 00:27 distinfo
drwxr-xr-x   2 root  wheel      2560  5 28  2009 files
-rw-r--r--   1 root  wheel  60670750 12 26 21:57 jdk-1.6.0.3p4_13.tbz
-rw-r--r--   1 root  wheel       540  8  5  2007 pkg-descr
drwxr-xr-x  11 root  wheel      1536 12 26 21:57 work
h2dbcluster1# pkg_add jdk-1.6.0.3p4_13.tbz
pkg_add: could not find package xextproto-7.0.5 !
pkg_add: could not find package recordproto-1.13.2 !
pkg_add: could not find package kbproto-1.0.3 !
pkg_add: could not find package inputproto-1.5.0 !
pkg_add: could not find package python26-2.6.4 !
pkg_add: could not find package xcb-proto-1.5 !
pkg_add: could not find package perl-5.8.9_3 !
pkg_add: could not find package javavmwrapper-2.3.3 !
pkg_add: could not find package pkg-config-0.23_1 !
pkg_add: could not find package xtrans-1.2.3 !
pkg_add: could not find package xproto-7.0.15 !
pkg_add: could not find package libXdmcp-1.0.2_1 !
pkg_add: could not find package libXau-1.0.4 !
pkg_add: could not find package pcre-8.00 !
pkg_add: could not find package libpthread-stubs-0.3_3 !
pkg_add: could not find package libxcb-1.4 !
pkg_add: could not find package libX11-1.2.1_1,1 !
pkg_add: could not find package libXext-1.0.5,1 !
pkg_add: could not find package libXtst-1.0.3_1 !
pkg_add: could not find package libXi-1.2.1,1 !
pkg_add: could not find package libiconv-1.13.1 !
pkg_add: could not find package gettext-0.17_1 !
pkg_add: could not find package glib-2.22.2 !
pkg_add: could not find package gamin-0.1.10_3 !
pkg_add: could not find package gio-fam-backend-2.22.2 !
pkg_add: could not find package desktop-file-utils-0.15_1 !
h2dbcluster1#

結構依存関係が大量発生するのね。 面倒なので portupgrade を導入して一気にコンパイル&インストールを行う。 注意点としては、 portupgrade-develのPorts はエラー多発な状態なので portupgrade のPortsを導入してくださいな。気付かず時間を無駄にしてしまった。

あとはこんなコマンドでおk

  portinstall xextproto recordproto kbproto inputproto python26 xcb-proto javavmwrapper pkg-config xtrans xproto libXdmcp libXau pcre libpthread-stubs libxcb libX11 libXext libXtst libXi glib gamin gio-fam-backend desktop-file-utils