ubuntu14.04下编译安装Tora

阅读更多

需预先安装oracle客户端;以下类库,有的可能需要提前安装,有的则可能不必安装;总之多试几次,多看看log日志。
系统环境:ubuntu14.04

Tora版本:2.1.3

 下载QScintilla-gpl-2.9.1-snapshot-3ff05a0ef88d.tar.gz
 依次执行:
    $sudo cp ~/下载/QScintilla-gpl-2.9.1-snapshot-3ff05a0ef88d.tar.gz /usr/local/software/
    $sudo tar xzvf QScintilla-gpl-2.9.1-snapshot-3ff05a0ef88d.tar.gz
    $sudo mv QScintilla-gpl-2.9.1-snapshot-3ff05a0ef88d qscintilla2.9.1
    $cd qscintilla2.9.1/Qt4Qt5
    $/usr/local/software/qt-4.8.7/bin/qmake qscintilla.pro 
    $sudo make
    $sudo make isntall
  然后再执行:$sudo apt-get install libqscintilla*
  安装qscintilla在ubuntu下的相关类库。

 获取tora的源代码
    $sudo apt-get install dpkg-dev
    $sudo apt-get source tora
  要强调的是,在下载源码包前,必须确保安装了dpkg-dev(执行”apt-get install dpkg-dev”来安装),否则,
  只会下载源码包的3个文件,但不会解压缩源码包。当然你也可以自己用dpkg-source命令去解压缩源码包。
  安装具有依赖关系的相关软件包。使用”apt-get build-dep”命令可以主动获取并安装所有相关的软件包。
    $sudo apt-get build-dep tora
  之后,在/usr/local/software/tora-2.1.3下创建好可执行文件目录,进入下载的源码目录tora-2.1.3目录,
  先执行
$sudo ./configure -h

  --with-oracle=DIR       enable support for Oracle (default ORACLE_HOME)
  --with-oracle-includes=DIR
                          set oracle include dir (default ORACLE_HOME/subdirs)
  --with-oracle-libraries=DIR
                          set oracle lib dir (default ORACLE_HOME/lib)
  --with-instant-client=DIR
                          Path to your instant client. If you've unpacked
                          all the zip files to this folder, then this is
                          all you need to use an instant client.
                          Disables testing for ORACLE_HOME and tnsnames.
  --with-oci-version=[8, 8I, 9I, 10G, 10G_R2, 11G]
                          this is the version of the client, not the database.
  --with-qscintilla=DIR
                          Directory containing QScintilla 2
  --with-qscintilla-includes=DIR
                          QScintilla header file location
  --with-qscintilla-libraries=DIR
                          QScintilla library dir
  --with-pcre[=prefix]    compile xmlpcre part (via libpcre check)
  --with-cppunit-prefix=PFX   Prefix where CppUnit is installed (optional)
  --with-cppunit-exec-prefix=PFX  Exec prefix where CppUnit is installed (optional)

  之后,执行
    $sudo ./configure --prefix=/usr/local/software/tora-2.1.3 --with-oracle=$ORACLE_HOME --with-oracle-includes=/usr/include/oracle/12.1/client64  --enable-debug=ture
  有错误就得查config.log。上面的命令是经过多次尝试而来,系统环境不同,之前安装的软件或类库也不同,命令也不尽相同。这里没有指定QT的相关目录配置,因为之前已经安装了qt的类库:$ sudo apt-get install qt-sdk

  有一个没有找到QT LIB的警告,暂时不管。
  执行
    $sudo make
  报错:
----------------------------------------------------------------------------
    /tmp/packerbuild-0/tora/tora/src/tora-2.1.3/src/toextract.cpp: In member function ‘QString toExtract::generateHeading(const QString&, std::list >&)’:
    /tmp/packerbuild-0/tora/tora/src/tora-2.1.3/src/toextract.cpp:690:27: error: ‘gethostname’ was not declared in this scope
    make[2]: *** [src/CMakeFiles/tora.dir/toextract.o] Error 1
    make[2]: *** Waiting for unfinished jobs....
    make[1]: *** [src/CMakeFiles/tora.dir/all] Error 2
------------------------------------------------------------------------------
  解决:
    diff -aur tora-2.1.3/src/toextract.h tora-2.1.3patched/src/toextract.h
    --- tora-2.1.3/src/toextract.h    2010-02-02 10:25:43.000000000 -0800
    +++ tora-2.1.3patched/src/toextract.h    2012-06-22 21:58:45.026286147 -0700
    @@ -53,6 +53,7 @@
     #include
     //Added by qt3to4:
     #include
    +#include
     
     class QWidget;
     class toConnection;
  根据说明修改源文件,再编译。
    $ sudo make clean
    $ sudo ./autogen.sh
    $sudo ./configure --prefix=/usr/local/software/tora-2.1.3 --with-oracle=$ORACLE_HOME --with-oracle-includes=/usr/include/oracle/12.1/client64  --enable-debug=ture
    $ sudo make

  又报错:
    -----------------------------------------------------------------------------
    tora-toawr.o: In function `toAWR::~toAWR()':
    /home/jjl/tora-2.1.3/src/toawr.cpp:381: undefined reference to `vtable for toAWR'
    /home/jjl/tora-2.1.3/src/toawr.cpp:381: undefined reference to `vtable for toAWR'
    ---------------------------------------------------------------------------
  解决:
   修改源码src中的文件
    src/Makefile.am

    BUILT_SOURCES = \
    moc_toabout.cpp \
    moc_toalert.cpp \
    moc_toanalyze.cpp \
    moc_toawr.cpp \
    moc_tobackup.cpp \

    #其中moc_toawr.cpp \    这一行是需要添加的。

  修改完成后,再执行
    $ sudo make clean
    $ sudo ./autogen.sh
    $ sudo ./configure --prefix=/usr/local/software/tora-2.1.3 --with-oracle=$ORACLE_HOME --with-oracle-includes=/usr/include/oracle/12.1/client64  --enable-debug=ture
    $ sudo make
  编译通过后,执行
    $ sudo make install
最后,直接运行/usr/local/software/tora-2.1.3/bin/tora即可。

你可能感兴趣的:(ubuntu14.04下编译安装Tora)