2

你能帮我弄清楚这里缺少什么吗?
我正在尝试使用 OTL 4 库编译 c++ 程序,但出现错误。

环境细节:

  • 我在 Ubuntu 11.04 VM 上安装了 Oracle DB XE 10G。
  • SQL*Plus 和服务器本身正在正常运行。

编译代码为:

g++ -o <output>.exe <source>.cpp -I$ORACLE_HOME/rdbms/public -I$ORACLE_HOME/rdbms/demo -L$ORACLE_HOME/lib -lclntsh

错误是:

/usr/bin/ld: warning: libnnz10.so, needed by /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/libclntsh.so, not found (try using -rpath or -rpath-link)  
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/libclntsh.so: undefined reference to `nztSetAppDefaultLocation'  
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/libclntsh.so: undefined reference to `nzos_DisableClientAuthentication'  
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/libclntsh.so: undefined reference to `nzos_Create_Ctx'  
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/libclntsh.so: undefined reference to `_intel_fast_memcpy'  
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/libclntsh.so: undefined reference to `nzgbllsm_location_shared_memory'  
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/libclntsh.so: undefined reference to `__intel_cpu_indicator'  
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/libclntsh.so: undefined reference to `nzosSCCS_SetCRLCacheSize'  
...a whole lot more undefined references...   
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/libclntsh.so: undefined reference to `nzssGSL_GetSecretLength'  
collect2: ld returned 1 exit status  

关于错误的注释:
当我检查时,libnnz10.so当我查看我的$ORACLE_HOME/lib目录时存在。

4

2 回答 2

2

I was able to figure it out this afternoon and I got it to compile now.
So in case someone stumbles with the same problem as I did here's the solution:

Add the $ORACLE_HOME/lib path to your $LD_LIBRARY_PATH

For convenience you may also add this to your .bashrc profile like so:

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH  

That's it!

PS:
I was trying to post this earlier but it seemed that I still lack in rep points
in order to answer my own question sooner than 8 hours.

于 2011-12-29T16:51:36.570 回答
0

不知道为什么有必要,但您可以尝试添加-lnnz10到您的命令中。

(谷歌向人们展示了使用那个额外的参数,但无法很快看到有人解释原因;其他选项似乎是设置LD_LIBRARY路径或添加$ORACLE_HOME/lib/etc/ld.so.conf......)

于 2011-12-29T11:38:29.113 回答