wiki:css/build

Version 16 (modified by michkawa, 10 years ago) (diff)

--

CSS 3.2.x のビルド方法

この文章を書き始めた2014/9/9現在、CSS の stable バージョンは 3.2.16 になっており、KEK内部で使用されている最新版 3.1.2 からかなりバージョンアップしている。
CSS 3.2.xでは色々な機能追加とバグフィックス、仕様変更がされていて、これを使ってみたいというユーザーも出てきているが、KEK版の正式リリースは色々な課題があり現時点では行われていない。
現バージョン 3.1.2 との相違点や機能検証、今後のバージョンアップへの追従や独自機能の追加等の問題に対処するためにはKEK版CSSのbuild方法の習得が必須なので、試しにやってみた。

今回 build した CSS 3.2.16 をbeta版として公開しますので、ご自由にお使いください。

CSS 3.2.xを使用する際には、必ずユーザディレクトリのCSS-Workspacesと以前作成したOPIファイル等のバックアップを作成してから行ってください。

  • Window Title修正版(20140919_133937)
Windows 32bit版 css_kek_3.2.16-win32.win32.x86_20140919_133937.zip
Windows 64bit版 css_kek_3.2.16-win32.win32.x86_64_20140919_133937.zip
Mac OSX 32bit版 css_kek_3.2.16-macosx.cocoa.x86_20140919_133937.zip
Mac OSX 64bit版 css_kek_3.2.16-macosx.cocoa.x86_64_20140919_133937.zip
Linux 32bit版 css_kek_3.2.16-linux.gtk.x86_20140919_133937.zip
Linux 64bit版 css_kek_3.2.16-linux.gtk.x86_64_20140919_133937.zip
Source css_kek_3.2.16-src_20140919_133937.zip
  • 初回版(20140912_131314)
Windows 32bit版 css_kek_3.2.16-win32.win32.x86_20140912_131314.zip
Windows 64bit版 css_kek_3.2.16-win32.win32.x86_64_20140912_131314.zip
Mac OSX 32bit版 css_kek_3.2.16-macosx.cocoa.x86_20140912_131314.zip
Mac OSX 64bit版 css_kek_3.2.16-macosx.cocoa.x86_64_20140912_131314.zip
Linux 32bit版 css_kek_3.2.16-linux.gtk.x86_20140912_131314.zip
Linux 64bit版 css_kek_3.2.16-linux.gtk.x86_64_20140912_131314.zip
Source css_kek_3.2.16-src_20140912_131314.zip

この CSS 3.2.16 で既存のCAにアクセスできない場合には、Edit->Preferences->CSS Core->EPICS->addr_listの内容がおかしいので、各自の環境に合わせて編集してください。

build環境整備

CSSをbuildする方法は、以前 Cosylabの中本さんが作成したCSS building from source, and construction of download site(ビルド手順書)に書いてあるので、そのまま実行してみることにする。

OS CentOS 6.5 x64 (vmware)
Eclipse Eclipse 3.7.2(Indigo SR2) RCP and RAP Developers 64bit
JAVA (linux_x64)
Delta Pack eclipse-3.7.2-delta-pack 64bit
CSS Source git から取得

vmware player 上にCentOS6.5をインストールして適当なユーザーを作成し、そこにCSSのbuild用ディレクトリを作成。

CSS ソースコードのダウンロード

CSS のソースコードは GitHub で管理されているので、gitを使ってダウンロード。ちなみにリポジトリを見るだけならここにアクセスすれば見える。

[michkawa@localhost css]$ git clone https://github.com/ControlSystemStudio/cs-studio.git

しばらく時間がかかる(今回は30分ぐらい)が、終了すると cs-studioというディレクトリが作成される。
gitはこのままでは使えないので、チェックアウトする。

[michkawa@localhost css]$ cd cs-studio
[michkawa@localhost cs-studio]$ git checkout --track origin/3.2.x
[michkawa@localhost cs-studio]$ cd ..

Eclipse 3.7.2(Indigo SR2) RCP and RAP Developers のダウンロード

ここからダウンロードして、展開。

[michkawa@localhost css]$ wget http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR2/eclipse-rcp-indigo-SR2-win32-x86_64.zip
[michkawa@localhost css]$ tar zxvf eclipse-rcp-indigo-SR2-win32-x86_64.zip

eclipse というディレクトリが作成される。

JDK1.7.0_u67 のダウンロード

JDK1.7.0_u67のtar.gz版をダウンロードしてくる。u67でなくてもいいので最新のJDK1.7を取ってくる。
wgetでは取ってこれないので、!Webブラウザ経由でここから。

ダウンロードしたファイルを展開。

[michkawa@localhost css]$ tar zxvf jdk-7u67-linux-x64.tar.gz

jdk1.7.0_67 というディレクトリが作成される。

Eclipse Delta Pack のインストール

delta packをダウンロードして、展開。

[michkawa@localhost css]$ wget http://archive.eclipse.org/eclipse/downloads/drops/R-3.7.2-201202080800/download.php?dropFile=eclipse-SDK-3.7.2-linux-gtk-x86_64.tar.gz
[michkawa@localhost css]$ unzip eclipse-3.7.2-delta-pack.zip -D ./delta

build方法

環境が整ったら、buildを開始するための設定を変更する。
ビルド手順書ではcs-studio/products/KEK/plugins/org.csstudio.kek.buildの設定を変更することになっているが、これはHeadless-Build用の設定なので後で設定。

まずは、Eclipse上でbuildできるように設定を変更する。 CSSのbuild方法はkayさんが書いたControl System Studio Guide For installers and maintainers of CS-StudioChapter 4. Compiling, Running, Debugging CSSを参考にした。

CSSのimport

まず、eclipseを起動してbuildに必要なパッケージをEclipseのprojectに取り込む。

[michkawa@localhost ~]$ cd css/eclipse
[michkawa@localhost eclipse]$ ./eclipse

eclipseが起動したら適当なプロジェクトを作成し、そこにimportしていく。eclipseのメニューからfile->importで importダイアログが表示されたら、General->Existing Projects into Workspaceを選択し、ImportProjectを表示。 Select root directory の Browse... ボタンでファイルダイアログを表示し、パッケージディレクトリを指定していく。

この時、指定したディレクトリ内のパッケージを再帰的に検索してくれるが、パッケージ数が多くなりすぎると途中までしか表示されないので、featuresとpluginsが表示されるところを指定していくと大体大丈夫。
cs-studio/applicationsとcs-studio/coreを全部と必要に応じて、cs-studio/productsCOMMON,CS-STUDIO,Core以外の各研究所固有パッケージを追加していく。今回は全部入れた。

eclipse での build

eclipseでKEK版をbuildする場合には、org.csstudio.kek.productを使用する。
Package Explorerのorg.csstudio.kek.product内を表示し、css-kek.productを開くと以下のような画面が表示されるので、

Testing->Synchronizeを押下してから、Exporting->clipse Product export wizardを押下すると、Exportダイアログが表示される。

Destination->Directoryに出力先のディレクトリを設定して、Finishを押下するとbuildが始まるが、開始早々にエラーになる。

この時のエラーは、org.csstudio.kek.core.feature -> org.csstudio.kek.product_3.2.0.qualifier内でorg.csstudio.sns.startuphelperが見つからないというもので、実際にPackage Explorerにはorg.csstudio.sns.startuphelperがなくなっている。どうやら、org.csstudio.sns.startuphelperorg.csstudio.startup.helperに変わったらしい。
他の研究所にはまだ残骸が残っているが、KEK版はSNS版を元にしているのでそれに倣うとする。

Package Explorer -> org.csstudio.kek.product -> plugin.xmlをクリックすると、以下の画面が表示される。

赤×の箇所が問題なので、"Remove"で削除。"Add"を押下し、Plug-in Selectionダイアログが表示されたら、Select a Plug-in入力ボックスに"startup"と入力する。自動的に候補が絞り込まれるので、org.csstudio.startup.helperを選択して、"OK"することで、リストに追加される。
再度、buildを実行すると、またエラー。今度はorg.csstudio.core.feature -> org.csstudio.sns.startuphelper_0.0.0と言われる。

org.csstudio.core.feature -> feature.xml ->Plug-insを開いて同様に修正。

修正後、Dependenciesタブで"Compute"ボタンを押下。

再度、org.csstudio.kek.productcss-kek.productを開いて、buildを実行。

新規の機能追加等をしない場合には、エラーが出たら再度問題箇所を修正してbuildを繰り返すことで何とかなりそう。

またエラーが発生し、今度はorg.csstudio.display.pace -> org.csstudio.logbook.ui_3.0.0がないとのこと。
org.csstudio.display.pace -> plugin.xml -> Dependenciesをみてみると、org.csstudio.logbook.ui_3.0.0は登録されている。
試しにorg.csstudio.core.feature -> Plug-insorg.csstudio.logbook.ui_3.0.0を登録してbuildすると、org.csstudio.kek.productorg.csstudio.logbook.ui_3.0.0がないというエラーに変わった。
org.csstudio.kek.product -> plugin.xml -> Dependenciesorg.csstudio.logbook.ui_3.0.0してbuildすると、buildが通るようになり、../css_kek にbuildされたcssが作成された。

タイトルがなんかおかしいけど、動作することは確認できた。

Headless build

今回の設定では、eclipse上でlinux x64版のCSSしか生成していないが、他の環境(Windows,Mac OSX,Linux)のbuildをまとめて行うこともできる。
eclipse上でもできるらしいが、今回はビルド手順書の方法で行う。

変更するファイルはcs-studio/products/KEK/plugins/org.csstudio.kek.buildにある。

setting.sh

setting.sh は主に build するためのディレクトリ設定をする。
今回は以下の設定をした。

export VERSION=3.2.16
export BASEDIR=${HOME}/css
export TOP=${BASEDIR}/cs-studio
export CYGDRIVE=
export BUILDDIR=${BASEDIR}/CSSBuild
export ECLIPSE_BASE=${BASEDIR}
export DELTAPACK=${BASEDIR}/delta/eclipse
export JAVA_HOME=${BASEDIR}/jdk1.7.0_67
PDE_VER=*

css/build.properties

css/build.properties はbuildする環境(OS等)を設定するが、今回は修正しない。

make.sh

make.sh は実際にbuildを行うためのスクリプト。
今回必要なのは CSS だけなので、それだけを build するように設定を変更。

#for prod in alarmconfig alarmserver archiveengine css engineconfig jms2rdb
for prod in css

plugins.list

build に必要な plug-in を設定するファイル。
eclipseでのbuildで変更が必要だった箇所を修正。

org.csstudio.logbook.ui/**
###org.csstudio.sns.startuphelper/**
org.csstudio.startup.helper/**

build実行

make.shを実行すると、Headless buildが始まる。

[michkawa@localhost org.csstudio.kek.build]$ ./make.sh
Buildfile: /home/michkawa/css/cs-studio/products/KEK/plugins/org.csstudio.kek.build/build.xml

clean:
   [delete] Deleting directory /home/michkawa/css/CSSBuild
BUILD SUCCESSFUL

BUILD SUCCESSFUL
Total time: 0 seconds
Fetching sources
Buildfile: /home/michkawa/css/cs-studio/products/KEK/plugins/org.csstudio.kek.build/build.xml

prepare:
    [mkdir] Created dir: /home/michkawa/css/CSSBuild/plugins
    [mkdir] Created dir: /home/michkawa/css/CSSBuild/features

get_sources:
     [echo] Core plugins
     [copy] Copying 1624 files to /home/michkawa/css/CSSBuild/plugins
     [echo] Application plugins
     [copy] Copying 7315 files to /home/michkawa/css/CSSBuild/plugins
     [copy] Copied 1289 empty directories to 1 empty directory under /home/michkawa/css/CSSBuild/plugins
     [echo] SNS plugins
     [echo] SNS product
     [echo] KEK plugins
     [copy] Copying 89 files to /home/michkawa/css/CSSBuild/plugins
     [echo] KEK Features
     [copy] Copying 12 files to /home/michkawa/css/CSSBuild/features
     [echo] Core Features
     [copy] Copying 9 files to /home/michkawa/css/CSSBuild/features
BUILD SUCCESSFUL

BUILD SUCCESSFUL
Total time: 4 seconds
Building css Product
Buildfile: /home/michkawa/css/eclipse/plugins/org.eclipse.pde.build_3.7.0.v20111116-2009/scripts/productBuild/productBuild.xml

main:

preBuild:

preSetup:

checkLocalMaps:

getMapFiles:

postSetup:

checkLocalBase:

getBaseComponents:

processRepos:

generateFeature:

fetch:

generateFeature:
[eclipse.generateFeature] Some inter-plug-in dependencies have not been satisfied.
[eclipse.generateFeature] Bundle org.eclipse.core.filesystem.linux.x86_64:
[eclipse.generateFeature]       Another singleton version selected: org.eclipse.core.filesystem.linux.x86_64_1.2.0.v20110423-0524
[eclipse.generateFeature] Bundle org.eclipse.swt.gtk.linux.x86_64:
[eclipse.generateFeature]       Another singleton version selected: org.eclipse.swt.gtk.linux.x86_64_3.7.2.v3740f
[eclipse.generateFeature] Bundle org.eclipse.core.net.linux.x86_64:
[eclipse.generateFeature]       Another singleton version selected: org.eclipse.core.net.linux.x86_64_1.1.0.I20110331-0827
[eclipse.generateFeature] Bundle org.eclipse.equinox.launcher.gtk.linux.x86_64:
[eclipse.generateFeature]       Another singleton version selected: org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505
[eclipse.generateFeature] Bundle org.csstudio.rap.core:
[eclipse.generateFeature]       Missing required plug-in org.eclipse.rap.ui_1.4.0.
[eclipse.generateFeature] Bundle org.csstudio.rap.ui.util:
[eclipse.generateFeature]       Missing required plug-in org.eclipse.rap.ui_1.4.0.
[eclipse.generateFeature]       Missing required plug-in org.csstudio.rap.core_1.0.0.

generate:

preGenerate:

allElements:

allElementsDelegator:

init:

generateScript:
[eclipse.buildScript] Some inter-plug-in dependencies have not been satisfied.
[eclipse.buildScript] Bundle org.eclipse.core.filesystem.linux.x86_64:
[eclipse.buildScript]   Another singleton version selected: org.eclipse.core.filesystem.linux.x86_64_1.2.0.v20110423-0524
[eclipse.buildScript] Bundle org.eclipse.swt.gtk.linux.x86_64:
[eclipse.buildScript]   Another singleton version selected: org.eclipse.swt.gtk.linux.x86_64_3.7.2.v3740f
[eclipse.buildScript] Bundle org.eclipse.core.net.linux.x86_64:
[eclipse.buildScript]   Another singleton version selected: org.eclipse.core.net.linux.x86_64_1.1.0.I20110331-0827
[eclipse.buildScript] Bundle org.eclipse.equinox.launcher.gtk.linux.x86_64:
[eclipse.buildScript]   Another singleton version selected: org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505
[eclipse.buildScript] Bundle org.csstudio.rap.core:
[eclipse.buildScript]   Missing required plug-in org.eclipse.rap.ui_1.4.0.
[eclipse.buildScript] Bundle org.csstudio.rap.ui.util:
[eclipse.buildScript]   Missing required plug-in org.eclipse.rap.ui_1.4.0.
[eclipse.buildScript]   Missing required plug-in org.csstudio.rap.core_1.0.0.

BUILD FAILED
/home/michkawa/css/eclipse/plugins/org.eclipse.pde.build_3.7.0.v20111116-2009/scripts/productBuild/productBuild.xml:42: The following error occurred while executing this line:
/home/michkawa/css/eclipse/plugins/org.eclipse.pde.build_3.7.0.v20111116-2009/scripts/build.xml:91: The following error occurred while executing this line:
/home/michkawa/css/eclipse/plugins/org.eclipse.pde.build_3.7.0.v20111116-2009/templates/headless-build/customTargets.xml:12: The following error occurred while executing this line:
/home/michkawa/css/eclipse/plugins/org.eclipse.pde.build_3.7.0.v20111116-2009/scripts/productBuild/allElements.xml:20: The following error occurred while executing this line:
/home/michkawa/css/eclipse/plugins/org.eclipse.pde.build_3.7.0.v20111116-2009/scripts/genericTargets.xml:111: Processing inclusion from feature org.csstudio.kek.core.feature: Unable to find plug-in: org.csstudio.autocomplete.pvmanager.formula_0.0.0. Please check the error log for more details.

Total time: 6 seconds
An error has occurred. See the log file
/home/michkawa/workspace/.metadata/.log.
Buildfile: /home/michkawa/css/cs-studio/products/KEK/plugins/org.csstudio.kek.build/build.xml

check_vars:

zip_sources:
      [zip] Building zip: /home/michkawa/css/CSSBuild/css_kek_3.2.16-src.zip

エラーの最後でorg.csstudio.autocomplete.pvmanager.formula_0.0.0がないとのことなので、関連のパッケージを追加。

org.csstudio.autocomplete.pvmanager.formula/**
org.csstudio.autocomplete.pvmanager.loc/**
org.csstudio.autocomplete.pvmanager.sim/**
org.csstudio.autocomplete.pvmanager.loc/**
org.csstudio.autocomplete.ui/**
org.csstudio.autocomplete.ui.rcp/**

再度、make.shを実行。
今度は build 成功。

css/CSSBuild/I.css_kek_3.2.16 にcss_kek_3.2.16-*.zipという各環境に対応したパッケージが作成された。

publish.sh

このスクリプトを実行すると、各パッケージに起動スクリプトをつけてくれて、webページまで作ってくれるらしい。
今回は設定は何もいじらず、そのまま実行した。webページは要らないけど、特定のディレクトリにファイルを作成するだけのようなので、そのまま実行。 スクリプトの設定等詳細はビルド手順書を参照。

CSS の Window Title がおかしい状態の解決法

  • eclipseでのbuild

buildしたCSS 3.2.16を起動するとWindow Titleが "NLS missing message: Window Title in: org.csstudio.utility.product.messages"となっていた。動作には支障がないようだが気持ち悪いので対処する方法を調べた。
SNS版を起動してみると CS-Studioとなっていたので、その文字列を検索するとorg.csstudio.utiliy.product.defaultにあった。
まず、eclipseでのbuildをするため、このクラスをorg.csstudio.kek.core.feature->feature.xml->Plug-insに追加してbuildしてみたところ、正しいWindow TitleのCSSが作成された。

  • Headless build

Headless build はorg.csstudio.kek.build -> plugins.listorg.csstudio.utiliy.product.defaultを追加してbuildすればOK