Page 1 of 1

Parallel Routine Object File

Posted: Wed Jan 06, 2010 3:41 pm
by chaks
Hello...i have written a parallel routine for the first time and i'm facing problem in running it. i want ur help in resolving the issue.

here are the details regarding the routine...
ObjectTesting.cpp:
#include <stdlib.h>
#include <stdio.h>
#include <iostream.h>
#include <stdcomp.h>
char * ObjectTestOne()
{
char * OutStr;
OutStr="Hello World - Object Testing";
return OutStr;
}

I compiled this C++ program with the compiler options from Administrator

compiler: /opt/SUNWspro/bin/CC
compileropt: -dalign -O -PIC -library=iostream -c
LD_LIBRARY_PATH: /usr/lib:/lib
Before compiling the program without main(), i tried it with main() and the program was running fine.after that i removed main() and compiled it.
command:
/opt/SUNWspro/bin/CC -dalign -O -PIC -library=iostream -c ObjectTesting.cpp

got the object file ObjectTesting.o

and linked the object file to the prallel routine as follows:

routine name: ObjectTesting
external subroutine name: ObjectTestOne
library path : /modl/apps/fold/dsdata/common/bin/ObjectTesting.o
object type : object


when i try to use this routine in a sample job i get the following error:

Transformer_3: Failed to load the library "V136S0_test_Transformer_3.so"; either the directory containing the library file
is not on the library search path, or the library was compiled on a system
that is incompatible with this system: Could not load "V136S0_test_Transformer_3": ld.so.1: osh: fatal: relocation error: file /modl/apps/fold/projects/nylim-GENEVA/RT_BP393.O/V136S0_test_Transformer_3.so: symbol __1cGObjOne6F_W_: referenced symbol not found. [transform/transform.C:1668]

do i have to place the object file in a specific folder or place it anywhere and provide the link in library path of routine.

I think the error has something to do with the object file linking, but don't know how to resolve it.


looked at similar posts but didn't get info regarding, where to place the object file? do we need to create any shared object? etc.

Posted: Wed Jan 06, 2010 3:58 pm
by ray.wurlod
Did you create a "parallel routine" entry in your Repository to allow DataStage to find your code at run time?

Posted: Wed Jan 06, 2010 4:05 pm
by chaks
Thank you very much for ur reply Ray...

Yes i did...
with options set as..
routine name: ObjectTesting
external subroutine name: ObjectTestOne
library path : /modl/apps/fold/dsdata/common/bin/ObjectTesting.o
object type : object

Posted: Sat Jan 09, 2010 12:46 am
by JoshGeorge
Put the object file in one of the 'library folders'; Provide that as lib path & recompile. That will give you an idea of what to do.

Posted: Fri Mar 05, 2010 4:49 pm
by Sreedhar
Hi,

The program name and the function name should match, in order to exectue that so...


either rename your program name or function.

either both should be ObjectTesting.cpp/ObjectTesting ()
or ObjectTestOne.cpp/ObjectTestOne()

Let know if it still causes you problem.

Regards,

Posted: Fri Mar 05, 2010 5:34 pm
by kduke
I don't think that is required. When you register the routine you have to tell it the name of object code and the CPP function name. You can have a main if you want as well but main is not the CPP function name.

You need to compile with the same options as the jobs. You can look those options up in Manager, I think. The link option is the only difference. I have a post where all this is explained in detail. Josh has a nice blog bout it as well.

If you have a main then you can test it at the UNIX prompt and by pass DataStage to see your results. Makes testing easier. You need to use args in main to call the CPP function. Hope this helps.

Posted: Sat Mar 06, 2010 12:40 am
by JoshGeorge
Need not be the same. I put the example in this blog: http://it.toolbox.com/blogs/dw-soa/data ... easy-20926 specifically to say that.
Sreedhar wrote:Hi,

The program name and the function name should match, in order to exectue that so...


either rename your program name or function.

either both should be ObjectTesting.cpp/ObjectTesting ()
or ObjectTestOne.cpp/ObjectTestOne()

Let know if it still causes you problem.

Regards,

Posted: Tue Mar 29, 2011 12:55 pm
by Rob4732
Hello All,

I found this post and it describes the same scenario I am facing. I have created the HelloWorld c++ code:

#include <stdlib.h>
#include <stdio.h>

char * ObjTestOne()
{
char* OutStr;
OutStr="Hello World - Object Testing";
return OutStr;
}

I tested the version with main() in it and it works.

Compiled(see below) creating the ObjTestOne.o object:

/opt/sunstudio12.1/bin/CC -dalign -O -PIC -library=iostream -c -xarch=v9 ObjTestOne.cpp

I created my parallel routine in ds as shown below:
routine name: HelloWorld
external subroutine name: ObjTestOne
library path : /home/user/ObjTestOne.o
object type : object

I don't think the location of the object file matters, as long as the routine points to it.

When I reference my routine in a parallel transformer, job aborts with following message:

xfm_patient: Failed to load the library "V0S20_job_stg_patient_xfm_patient.so"; either the directory containing the library file
is not on the library search path, or the library was compiled on a system
that is incompatible with this system: Could not load "V0S20_job_stg_patient_xfm_patient": ld.so.1: osh: fatal: relocation error: file /ibm/server/projects/CLARITY_TO_OHSUDW/RT_BP64.O/V0S20_job_stg_patient_xfm_patient.so: symbol __1cKObjTestOne6F_W_: referenced symbol not found.

Any help appreciated.

thx
Robert

Posted: Tue Mar 29, 2011 3:00 pm
by Rob4732
Found the problem.

The return type in my parallel routine was char . I should have selected char* . My bad.


thanks