Monday, February 8, 2010

saprfc installation on centos 5


After hesitating for a while, I struggled to bring saprfc to live on a Centos 5 installation.
Ok, first, the people I'm helping already installed rfc sdk in /usr/sap/rfcsdk. I am using RFC SDK extracted from RFC_45-20000055.SAR that I've downloaded from SAP Service Marketplace Support links (http://service.sap.com/). The SAR file is suitable for Linux i386 architecture, you might want to use RFC_45-10003377.SAR for Linux x86_64 architecture.
Now i need to compile sap:rfc extension. I used saprfc-1.4.1 downloaded from http://saprfc.sourceforge.net/. But, no phpize in path, so i must install php-devel first
> yum install php-devel
but, because the proxy setup is not done (our server lives outside the DMZ), I must edit yum.conf :
> vi /etc/yum.conf
and add one line :
> proxy=http://....
Then I'm ready to try php-devel again.
> yum install php-devel
OK. now try to compile sap:rfc. R the INSTALL file in a flash, and tries these steps (the part b in the INSTALL file)
> cd /home/saprfc-1.4.1
> phpize
What? no phpize? I was mistaken thinking that php-devel contains the phpize executable..
Seems that my yum install php-devel failed. Retrying, now with php-xml and php-snmp (becuase yum seems complained that these are not compatible with the version of php-devel I tried to install)
> yum install php-devel php-xml php-snmp
Hurray.. install complete.
retries compiling sap:rfc
> cd /home/saprfc-1.4.1
> phpize
[root@localhost saprfc-1.4.1]# phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20050922
Zend Extension Api No: 220051025
config.m4:30: warning: AC_CANONICAL_HOST invoked multiple times
config.m4:30: warning: AC_CANONICAL_HOST invoked multiple times
I don't know about AC_CANONICAL_HOST, lets ignore them for now.
> ./configure
all seems OK. If there is an error about missing gcc you should
>yum install gcc
If not, just proceed to make..
> make install
it compiles a saprfc.so in /usr/lib/php/modules.
I took a liberty to write these ini /etc/php.d/saprfc.ini :
; Enable saprfc extension module
extension=saprfc.so
now restart apache and pray..
> /etc/init.d/httpd restart

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/librfccm.so' - /usr/lib/php/modules/librfccm.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/saprfc.so' - libstdc++-libc6.2-2.so.3: cannot open shared object file: Too many levels of symbolic links in Unknown on line 0
Wonderful. Things so complicated from this moment.

I think i found the problem:
[root@localhost lib]# ldd /usr/lib/librfccm.so
linux-gate.so.1 => (0x0035e000)
libdl.so.2 => /lib/libdl.so.2 (0x004ae000)
librt.so.1 => /lib/librt.so.1 (0x006de000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00110000)
libc.so.6 => /lib/libc.so.6 (0x00127000)
libstdc++-libc6.2-2.so.3 => not found
libm.so.6 => /lib/libm.so.6 (0x0026a000)
/lib/ld-linux.so.2 (0x00896000)
[root@localhost lib]# locate libstdc++-libc6.2-2.so.3
/usr/lib/libstdc++-libc6.2-2.so.3
[root@localhost lib]# ls -l /usr/lib/libstdc++-libc6.2-2.so.3
lrwxrwxrwx 1 root root 18 Jan 26 10:47 /usr/lib/libstdc++-libc6.2-2.so.3 -> libstdc++.so.5.0.5
[root@localhost lib]# locate libstdc++.so.5.0.5
/usr/lib/libstdc++.so.5.0.5
[root@localhost lib]# ls -l /usrlib/libstdc++.so.5.0.5
ls: /usrlib/libstdc++.so.5.0.5: No such file or directory
[root@localhost lib]# ls -l /usr/lib/libstdc++.so.5.0.5
lrwxrwxrwx 1 root root 18 Jan 26 10:50 /usr/lib/libstdc++.so.5.0.5 -> libstdc++.so.5.0.5

Yes. Endless link of links.
Tried to fix these with updating compat-libstdc++-33 and compat-libstdc++-296 (yes, I only know that the current version of stdc++ being installed is libstdc++so.6.x, and have no idea which of the compat packages contains the 5.0.5 version)

yum update compat-libstdc++-33 compat-libstdc++-296
...

[root@localhost ~]# ldd /usr/lib/librfccm.so
linux-gate.so.1 => (0x00854000)
libdl.so.2 => /lib/libdl.so.2 (0x00110000)
librt.so.1 => /lib/librt.so.1 (0x00114000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00811000)
libc.so.6 => /lib/libc.so.6 (0x00358000)
libstdc++-libc6.2-2.so.3 => /usr/lib/libstdc++-libc6.2-2.so.3 (0x0011d000)
libm.so.6 => /lib/libm.so.6 (0x0015f000)
/lib/ld-linux.so.2 (0x00896000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00186000)

everything seems in order.

> /etc/init.d/httpd restart

and now... drum roll please..

2 comments:

inquisitive said...

Thank you for your article,

i am facing trouble in last step, when php -v shows warning and not loading saprfc extension.

can you please guide.

-----
[root@localhost /]# php -v
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/saprfc.so' - libstdc++-libc6.2-2.so.3: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/saprfc.so' - libstdc++-libc6.2-2.so.3: cannot open shared object file: No such file or directory in Unknown on line 0
PHP 5.3.3 (cli) (built: Jul 22 2010 16:20:45)
------

Yudhi Widyatama said...

In my system, the file libstdc++-libc6.2-2.so.3 comes from the compat-libstdc++-296-2.96 package. Maybe you should try to install a package similar to mine (compat-libstdc++-296-2.96-138) ..