SpiderMonkey 是 Mozilla 的 JavaScript 引擎,目前的版本是1.8.5,这里记录一下它在AIX上的编译过程。
下载地址:https://developer.mozilla.org/zh-CN/docs/SpiderMonkey
GCC等GNU软件的下载地址:http://www-03.ibm.com/systems/power/software/aix/linux/toolbox/ezinstall.html

1.修改configure和configure.in
参见:https://www.ibm.com/developerworks/aix/library/au-gnu.html

MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'

改为:

MOZ_FIX_LINK_PATHS=''

2.修改jsnativestack.cpp
参见:http://hg.mozilla.org/mozilla-central/rev/70d9c9f2c148

--- a/js/src/jsnativestack.cpp
+++ b/js/src/jsnativestack.cpp
@@ -155,40 +155,43 @@ JS_STATIC_ASSERT(JS_STACK_GROWTH_DIRECTI
void *
GetNativeStackBaseImpl()
{
  stack_t st;
  stack_getbounds(&st);
  return static_cast<char*>(st.ss_sp) + st.ss_size;
}

+#elif defined(AIX)
+
+#include <ucontext.h>
+
+JS_STATIC_ASSERT(JS_STACK_GROWTH_DIRECTION < 0);
+
+void *
+GetNativeStackBaseImpl()
+{
+    ucontext_t context;
+    getcontext(&context);
+    return static_cast<char*>(context.uc_stack.ss_sp) +
+        context.uc_stack.ss_size;
+}
+
#elif defined(XP_OS2)

void *
GetNativeStackBaseImpl()
{
  PTIB  ptib;
  PPIB  ppib;

  DosGetInfoBlocks(&ptib, &ppib);
  return ptib->tib_pstacklimit;
}

-#elif defined(SOLARIS)
-
-#include <ucontext.h>
-
-void *
-GetNativeStackBaseImpl()
-{
-    stack_t st;
-    stack_getbounds(&st);
-    return static_cast<char*>(st.ss_sp) + st.ss_size;
-}
-
#else /* XP_UNIX */

void *
GetNativeStackBaseImpl()
{
  pthread_t thread = pthread_self();
# if defined(XP_MACOSX) || defined(DARWIN)
  return pthread_get_stackaddr_np(thread);

3.编译安装

./configure --prefix=/home/usr1/SpiderMonkey-1.8.5 --with-pthreads --disable-shared-js
gmake
gmake install

4.测试

$ cd /home/usr1/SpiderMonkey-1.8.5/bin
$ ./js
js> var a = new Object;
js> a.s = "Test String!";
"Test String!"

 


本文链接地址: 在AIX上使用GCC编译SpiderMonkey-1.8.5
https://blog.qingfengju.com/index.asp?id=369

分类:Linux 查看次数:10547 发布时间:2014/4/20 22:42:20

系统基于ruby-1.9.3 + Rails 3.2.16开发,要求部署在HP-UX B.11.31 ia64上。
在http://hpux.connect.org.uk上能下载到的ruby安装包是ruby-1.8.4,不能满足我们的要求,所以需要编译安装ruby-1.9.3。

 
1.安装gcc及其依赖软件
swinstall -s $PWD/gettext-0.18.3.2-ia64-11.31.depot
swinstall -s $PWD/libiconv-1.14-ia64-11.31.depot
swinstall -s $PWD/zlib-1.2.8-ia64-11.31.depot
swinstall -s $PWD/gcc-4.2.3-ia64-11.31.depot
swinstall -s $PWD/make-4.0-ia64-11.31.depot
swinstall -s $PWD/m4-1.4.17-ia64-11.31.depot
swinstall -s $PWD/ncurses-5.9-ia64-11.31.depot
swinstall -s $PWD/readline-6.2.005-ia64-11.31.depot
swinstall -s $PWD/perl-5.10.1-ia64-11.31.depot
swinstall -s $PWD/autoconf-2.69-ia64-11.31.depot

2.编译ruby-1.8.7

export PATH=/usr/local/bin:$PATH
export CC=gcc
export CFLAGS="-O2 -g -pthread -milp32 -w -pipe -Wall -fexceptions"
export CPPFLAGS="-DHAVE_HMAC_CTX_COPY -DHAVE_EVP_CIPHER_CTX_COPY -DHAVE_LIBPTHREAD"

gunzip ruby-1.8.7-p334.tar.gz
tar -xvf ruby-1.8.7-p334.tar
cd ruby-1.8.7-p334
./configure --with-gcc --enable-pthread --enable-shared --disable-rpath --prefix=/opt/mcb/attendance/ruby-1.8.7-p334
gmake
gmake test
gmake install
编译ruby-1.9.3需要旧版本的ruby,所以首先编译ruby-1.8.7。
如果直接安装ruby-1.8.4,编译ruby-1.9.3时会提示找不到erb之类的错误。
 
3.编译ruby-1.9.3
3.1 编译yaml-0.1.6
gunzip yaml-0.1.6.tar.gz
tar -xvf yaml-0.1.6.tar
cd yaml-0.1.6
export CC=gcc
export CFLAGS="-O2 -g -pthread -milp32 -w -pipe -Wall -fexceptions"
unset CPPFLAGS
./configure --prefix=/opt/mcb/attendance/yaml-0.1.6
gmake
gmake install

3.2 编译bison-1.875

gunzip bison-1.875.tar.gz
tar -xvf bison-1.875.tar
cd bison-1.875
export CC=gcc
export LDFLAGS="-L/usr/local/lib/hpux32 -lintl"
./configure --prefix=/opt/mcb/attendance/bison-1.875
gmake
gmake install
测试发现:
bison-1.28不能解析.y文件中的部分语法
bison-2.7生成的.c文件语法与gcc4.2.3又不兼容
最终选择了bison-1.875
 
3.3 为ruby-1.9.3-p194安装patch
gunzip ruby-1.9.3-p194.tar.gz
tar -xvf ruby-1.9.3-p194.tar
gunzip ruby-1.9.3-p194.diff.tar.gz
tar -xf ruby-1.9.3-p194.diff.tar
patch -p1 -d ruby-1.9.3-p194 < ruby-1.9.3-p194.diff
参考:http://vouters.dyndns.org/tima/HP-UX-Installing_Ruby_On_Itanium.html
 
3.4 修改系统内核的栈大小限制
执行sam命令,修改配置maxssiz,maxssiz_64bit
k - Kernel Configuration 
t - Tunables
选择maxssiz,maxssiz_64bit
按下m,改为:33554432 【也就是stack(kbytes) = 32768】
 
不修改会报错:
stack level too deep

3.5 修改默认的线程栈大小
chmod +w /usr/include/limits.h
找到
#define PTHREAD_STACK_MIN             4096
改为:
#ifndef PTHREAD_STACK_MIN
#define PTHREAD_STACK_MIN             4096
#endif
3.6 修改autom4te中的perl路径
修改/usr/local/bin/autom4te
#! /usr/bin/perl -w
如果不修改,执行gmake会报错:
interpreter "/usr/local/bin/perl" not found
 
3.7 编译
cd ruby-1.9.3-p194
export CC=gcc
unset CFLAGS
export PATH=/opt/mcb/attendance/bison-1.875/bin:$PATH
export PATH=/opt/mcb/attendance/ruby-1.8.7-p334/bin:$PATH
export CPPFLAGS="-D_XOPEN_SOURCE_EXTENDED -DMAP_ANON=MAP_ANONYMOUS -DPTHREAD_STACK_MIN=512*1024 -I/usr/local/include -I/opt/mcb/attendance/yaml-0.1.6/include"
export LDFLAGS="-L/usr/local/lib/hpux32 -L/opt/mcb/attendance/yaml-0.1.6/lib"

./configure --disable-rpath --prefix=/opt/mcb/attendance/ruby-1.9.3-p194 --with-baseruby=/opt/mcb/attendance/ruby-1.8.7-p334/bin/ruby

gmake
gmake test
gmake install
3.8 测试ruby-1.9.3-p194
export PATH="/opt/mcb/attendance/ruby-1.9.3-p194/bin:/usr/local/bin:$PATH"
ruby -v
输出:ruby 1.9.3p194 (2012-04-20) [ia64-hpux11.31]
 
4.安装gems组件
export CC=gcc
export PATH="/opt/mcb/attendance/ruby-1.9.3-p194/bin:/usr/local/bin:$PATH"
4.1 安装rmagick等组件依赖的软件
swinstall -s $PWD/ImageMagick-6.8.6.9-ia64-11.31.depot
swinstall -s $PWD/fontconfig-2.11.0-ia64-11.31.depot.gz
swinstall -s $PWD/freetype-2.5.3-ia64-11.31.depot.gz
swinstall -s $PWD/glib2-2.34.3-ia64-11.31.depot
swinstall -s $PWD/jpeg-9.0.0-ia64-11.31.depot.gz
swinstall -s $PWD/lcms2-2.5-ia64-11.31.depot.gz
swinstall -s $PWD/libpng-1.6.10-ia64-11.31.depot.gz
swinstall -s $PWD/libtool-2.4.2-ia64-11.31.depot.gz
swinstall -s $PWD/pkgconfig-0.28-ia64-11.31.depot
swinstall -s $PWD/xz-5.0.5-ia64-11.31.depot
4.2 修改rbconfig.rb
ruby-1.9.3-p194/lib/ruby/1.9.1/ia64-hpux11.31/rbconfig.rb
CONFIG["RPATHFLAG"] = " +b %1$-s"
改为
CONFIG["RPATHFLAG"] = ""
否则会在安装native组件时,出现错误
checking for stdint.h... *** extconf.rb failed ***
 
4.3 离线安装常用gem组件
gem install actionmailer-3.2.16.gem --local
gem install actionpack-3.2.16.gem --local
gem install activemodel-3.2.16.gem --local
gem install activerecord-3.2.16.gem --local
gem install activeresource-3.2.16.gem --local
gem install activesupport-3.2.16.gem --local
gem install arel-3.0.3.gem --local
gem install builder-3.0.4.gem --local
gem install erubis-2.7.0.gem --local
gem install hike-1.2.3.gem --local
gem install i18n-0.6.9.gem --local
gem install journey-1.0.4.gem --local
gem install jquery-rails-3.1.0.gem --local
gem install json-1.8.1.gem --local
gem install mail-2.5.4.gem --local
gem install mime-types-1.25.1.gem --local
gem install multi_json-1.9.2.gem --local
gem install polyglot-0.3.4.gem --local
gem install rack-1.4.5.gem --local
gem install rack-cache-1.2.gem --local
gem install rack-ssl-1.3.4.gem --local
gem install rack-test-0.6.2.gem --local
gem install rails-3.2.16.gem --local
gem install railties-3.2.16.gem --local
gem install rake-10.2.2.gem --local
gem install rdoc-3.12.2.gem --local
gem install rmagick-2.13.2.gem --local
gem install sprockets-2.2.2.gem --local
gem install sqlite3-1.3.9.gem --local
gem install thor-0.19.1.gem --local
gem install tilt-1.4.1.gem --local
gem install treetop-1.4.15.gem --local
gem install tzinfo-0.3.39.gem --local
gem install will_paginate-3.0.5.gem --local
5.小结
因为实际环境的不同,可能出现不同的错误提示,具体问题具体对待。
 

本文链接地址: 在HP-UX上编译ruby1.9.3及其组件
https://blog.qingfengju.com/index.asp?id=372

分类:Linux 查看次数:8341 发布时间:2014/4/15 18:28:47