启动程序和libocci.so.11.1:无法打开共享库文件:没有这样的文件或目录 [英] Startup program and libocci.so.11.1: cannot open shared object file: No such file or directory

查看:608
本文介绍了启动程序和libocci.so.11.1:无法打开共享库文件:没有这样的文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请任何一个节省我的时间.我的应用程序是用C ++编写的,我曾尝试在ubuntu linux上启动时启动,但是当程序尝试启动时会记录以下错误:- 加载共享库时出错:libocci.so.11.1:无法打开共享库文件:没有这样的文件或目录 我的程序使用oracle api: 我的启动服务脚本是在/etc/init.d/sistartup中编写的:-

please any one save my time .my application is written in c++ I was try to startup on boot in ubuntu linux,but when the program try to start it log error like:- error while loading shared libraries: libocci.so.11.1: cannot open shared object file: No such file or directory my program use oracle api:- my start service script which is written in /etc/init.d/sistartup:-

#!/bin/sh
# chkconfig: 345 99 10
OWNER=aki

case "$1" in
    'start')
        su $OWNER -c "/home/aki/sis_script/startsis.sh >> /home/aki/sis_script/sistartup.log 2>&1" &
       # touch /var/lock/subsys/sis_engine
        ;;
esac

在适当的用户上编写的

启动脚本是:- /home/aki/script/startsis.sh

startup script which is written on appropriate user is:- /home/aki/script/startsis.sh

  #!/bin/bash
    export TMP=/tmp
    export TMPDIR=$TMP
    export PATH=/usr/sbin:/usr/local/bin:$PATH
    # Start db_test
    ./home/aki/summ/db_test

我的c ++示例test_db.cpp应用程序编写如下:-

My c++ sample test_db.cpp application write below:-

    #include <iostream>
    #include <occi.h>
    #include <string>
    using namespace oracle::occi;
    using namespace std;
    Environment *env;
    Connection  *con;
    int main(){

            string user;
            string passwd;
            string db;
            user ="sis";
            passwd = "sis10";
            db = "localhost:1521/sisdba";
            env = Environment::createEnvironment((Environment::Mode)(Environment::OBJECT|Environment::THREADED_MUTEXED));
                    con = env->createConnection(user, passwd, db);
                    while(1){
                        cout<<"Here i have some business which is related to oracle database "<<endl;
                    }
                    return 0;
}

以这种方式编译文件后

g++ -o db_test test_db.cpp -I$ORACLE_HOME/rdbms/public -L$ORACLE_HOME/lib -locci -lclntsh

我看到此错误:- 加载共享库时出错:libocci.so.11.1:无法打开共享库文件:没有这样的文件或目录

I see this error :- error while loading shared libraries: libocci.so.11.1: cannot open shared object file: No such file or directory

推荐答案

如果必须在build命令行上提供-L$ORACLE_HOME/lib,这向我建议这些库不在系统的任何库路径中,因此在运行时不会自动找到它们.

If you have to provide -L$ORACLE_HOME/lib on the build command line, that suggests to me that the libraries aren't in any of the system's library paths, so they won't be found automatically at runtime.

您可以通过在运行程序之前设置LD_LIBRARY_PATH=$ORACLE_HOME/lib来确认该理论;然后它应该工作.但是,根据您的要求,这可能仅是一个临时解决方法(我假设$ORACLE_HOME可用!).更长远的解决方法可能是将此路径添加到/etc/ld.so.conf ,尽管这将影响您计算机上的所有可执行文件系统.

You can confirm this theory by setting LD_LIBRARY_PATH=$ORACLE_HOME/lib before running your program; it should then work. However, depending on your requirements, this may be only worth a temporary workaround (and I'm assuming the $ORACLE_HOME is available!). A more long-term fix might be to add this path to /etc/ld.so.conf, though this then will affect all executables on your system.

最终,您应该按照该库的安装说明进行操作.

Ultimately, you should follow the installation instructions for the library.

这篇关于启动程序和libocci.so.11.1:无法打开共享库文件:没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆