cancel
Showing results for 
Search instead for 
Did you mean: 

Error Linking rfcsdk sample program (linux)

0 Kudos

Hello,

I downloaded the Linux RFCSDK (RFC_linux_ia36_sdk.SAR, version info -> @(#)LIBRFC (c) SAP AG: Version: 640 Patch level: 0 Patch number: 129 thread-safe build 32 bit) onto my system today and am having trouble linking one of the sample programs (sapinfo.c). (This is the only one I tried.) Here are the first few error messages:

/opt/gcc-4.0.2/bin/gcc -I ../include -L ../lib sapinfo.c -o sapinfo -lrfc -lm -ldl

../lib/librfc.a(cpictlib.o)(.text+0x30cdb): In function `find_best_posix_clock':

: undefined reference to `clock_getcpuclockid'

../lib/librfc.a(cpictlib.o)(.text+0x30d5a): In function `find_best_posix_clock':

: undefined reference to `clock_gettime'

../lib/librfc.a(cpictlib.o)(.text+0x30dbe): In function `get_posix_nanoseconds':

: undefined reference to `clock_gettime'

../lib/librfc.a(cpictlib.o)(.text+0x4b467): In function `NiIInitSocket(int, SI_SOCK *)':

: undefined reference to `__throw'

../lib/librfc.a(cpictlib.o)(.text+0x4b471): In function `NiIInitSocket(int, SI_SOCK *)':

: undefined reference to `__start_cp_handler'

../lib/librfc.a(cpictlib.o)(.text+0x4b47e): In function `NiIInitSocket(int, SI_SOCK *)':

: undefined reference to `__check_eh_spec'

../lib/librfc.a(cpictlib.o)(.text+0x4b483): In function `NiIInitSocket(int, SI_SOCK *)':

: undefined reference to `__throw'

../lib/librfc.a(cpictlib.o)(.text+0x4b48c): In function `NiIInitSocket(int, SI_SOCK *)':

: undefined reference to `__cp_pop_exception'

../lib/librfc.a(cpictlib.o)(.text+0x4b498): In function `NiIInitSocket(int, SI_SOCK *)':

: undefined reference to `terminate(void)'

The linker eventually gives up with:

HSIMPL type_info function':

: undefined reference to `__rtti_user'

../lib/librfc.a(cpictlib.o)(.gnu.linkonce.t.__tf15NIHSIMPL_LINEAR+0x29): In function `NIHSIMPL_LINEAR type_info function':

: undefined reference to `__rtti_si'

../lib/librfc.a(cpictlib.o)(.gnu.linkonce.d.__vt_8NIHSIMPL+0x8): undefined reference to `__pure_virtual'

../lib/librfc.a(cpictlib.o)(.gnu.linkonce.d.__vt_8NIHSIMPL+0x10): undefined reference to `__pure_virtual'

../lib/librfc.a(cpictlib.o)(.gnu.linkonce.d.__vt_8NIHSIMPL+0x14): undefined reference to `__pure_virtual'

../lib/librfc.a(cpictlib.o)(.gnu.linkonce.d.__vt_8NIHSIMPL+0x18): undefined reference to `__pure_virtual'

../lib/librfc.a(cpictlib.o)(.gnu.linkonce.d.__vt_8NIHSIMPL+0x1c): undefined reference to `__pure_virtual'

../lib/librfc.a(cpictlib.o)(.gnu.linkonce.d.__vt_8NIHSIMPL+0x20): more undefined references to `__pure_virtual' follow

collect2: ld returned 1 exit status

I get the same issue if I try to compile with g++ or with version 3.4.5-2 of gcc/g++. My system is:

Linux version 2.6.9-34.ELsmp (bhcompile@hs20-bc1-7.build.redhat.com) (gcc version 3.4.5 20051201 (Red Hat 3.4.5-2)) #1 SMP Fri Feb 24 16:54:53 EST 2006

I appreciate any help on this matter. Several hours of searching via Google or on the SDN did not turn up any useful clues.

Regards,

Mike Davis.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I had a similar problem, that only happened on a particular system (Ubuntu 12.04):

undefined symbol: clock_getcpuclockid

I discovered that when the system where I compile the lib has libc6 version 2.15, I had to also tell the linker to include "librt" library ("-lrt").

In a system with libc6 version 2.17 (Ubuntu 14.04), this was not necessary.

I hope this helps you or anyone with a similar problem.