- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Runtime unsats with a simple aC++ shlib as Apa...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2014 01:51 AM - last edited on 07-16-2014 06:38 PM by Maiko-I
07-16-2014 01:51 AM - last edited on 07-16-2014 06:38 PM by Maiko-I
Linking issues while compiling a simple c++ module in HP-UX
We are trying to build a simple c++ module in hpux and deploy it in Apache httpd server.
Out tech stack consists of
HP-UX B.11.31 U ia64
aCC compiler for C++
Apache 2.2.27
We installed apache using the following steps
Step 1: export CFLAGS="+DD64"
Step 2: export CPPFLAGS="+DD64"
Step 3: ./configure CC=aCC --enable-mods-shared=most
Step 4: make
Step 5: make install
compilation command:
apxs -a -c -S cc=aCC -L/usr/lib/hpux64 -lstd_v2 -lCsup -lunwind -lm calculator.cpp
Then the ".so" is created in .libs directory.
Then we used the command:
nm calculator.cpp| grep UNDEF
we are getting undefined symbols mentioned below:
[0] | 0| 0|NOTYP|LOCAL|0| UNDEF|
[61] | 0| 0|FUNC |GLOB |0| UNDEF|_Unwind_Resume
[54] | 0| 0|FUNC |GLOB |0|UNDEF|_ZNSt8ios_base4InitC1Ev
[53] | 0| 0|FUNC |GLOB 0| UNDEF|_ZNSt8ios_base4InitD1Ev
[51] | 0| 0|FUNC |GLOB |0| UNDEF|_ZdlPv
[52] | 0| 0|FUNC |GLOB |0| UNDEF|_Znwm
[63] | 0| 0|FUNC |GLOB |0| UNDEF|__cxa_atexit
[57] | 0| 0|FUNC |GLOB |0| UNDEF|__cxa_finalize
[65] | 0| 0|FUNC |GLOB |0UNDEF|__cxa_personality_routine
[62] | 0| 0|FUNC |GLOB |0| UNDEF|ap_hook_handler
[60] | 0| 0|FUNC |GLOB |0| UNDEF|ap_rprintf
[55] | 0| 0|FUNC |GLOB |0| UNDEF|ap_rputs
[64] | 0| 0|FUNC |GLOB |0| UNDEF|strcmp
Hence we are unable to successfully deploy our service in apacheserver.
When we are trying to load the ".so" module in apache server we are geting these unsatisfied symbol and hence the apache server was unable to start.
The .so module that is created is not getting linked properly and hence we are facing these issues.
Any valuable help from your side would be highly appreciated.
Waiting for a reply soon,
Biswadeep Khan
P.S. This thread has been moved from General to HP-UX > languages. - Hp Forum Moderator
- Tags:
- unsat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2014 03:46 AM
07-16-2014 03:46 AM
Re: Linking issues while compiling a simple c++ module in HP-UX
I see several issues with your attempt.
First of all, you should not be setting 'CC' to point to the C++ compiler. You should instead point it to '/opt/ansic/bin/cc', which is the C compiler. You should instead set the 'CXX' variable to point to the C++ compiler '/opt/aCC/bin/aCC'.
Secondly, for generating shared libraries, you should be using the '-b' compiler option. I don't see this in the compilation command line you have provided.
Note that for C++ compilations, you must use the C++ compiler as the linker, and not directly use the linker. Typically, it is done by setting the 'LD' environment variable to point to the C++ compiler as well.
HP-UX Compilers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2014 04:23 AM
07-16-2014 04:23 AM
Re: Linking issues while compiling a simple c++ module in HP-UX
I tried specifying CXX=aCC but while building apache in the following confuguartion step
Lastly I could not clearly understand the last point that you mentioned regarding "LD environment path " and c++ linker and compiler.It would be really helpful if you could elaborate this point clearly with the help of an example?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2014 08:53 PM
07-16-2014 08:53 PM
Re: Linking issues while compiling a simple c++ module in HP-UX
Unfortunately, I don't have the apache package handy to be more precise.
BY 'LD', I meant if this also invokes the linker, then you must ensure that it does not invoke the linker directly. It must invoke the C++ compiler for the linking. Usually, this is controlled by the 'LD' environment variable (similar to the 'CC' environment variable).
Are you saying that you have manually inserted the options "-L/usr/lib/hpux64 -lstd_v2 -lCsup -lunwind -lm"? If so, you must remove them as these are automatically inserted by the compiler driver as required and in the correct order.
If you haven't already, you should go through the documentation on creating shared libraries at:
http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/HTML/libs.htm#createlib
HP-UX Compilers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2014 11:46 PM
07-16-2014 11:46 PM
Re: Linking issues while compiling a simple c++ module in HP-UX
I tried compiling a simple c++ code in aCC and build its ".so" without using apache.
The code is:
#include <float.h>
#include <string.h>
#include<iostream.h>
class calcService
{
public:
int add(double a, double b, double *result);
int sub(double a, double b, double *result);
};
int calcService::add(double a, double b, double *result)
{
*result = a + b;
return *result;
}
int calcService::sub(double a, double b, double *result)
{
*result = a - b;
return *result;
}
int main()
{
calcService calc;
return 0;
}
compilation command :
aCC -b +DD64 -AA -mt +z -L/usr/lib/hpux64 -o calc.so calculator.cpp
then we used the command
nm calc.so | grep UNDEF
[0] | 0| 0|NOTYP|LOCAL|0| UNDEF|
[48] | 0| 0|FUNC |GLOB |0| UNDEF|_Unwind_Resume
[45] | 0| 0|FUNC |GLOB |0| UNDEF|_ZNSt8ios_base4InitC1Ev
[44] | 0| 0|FUNC |GLOB |0| UNDEF|_ZNSt8ios_base4InitD1Ev
[50] | 0| 0|FUNC |GLOB |0| UNDEF|__cxa_atexit
[46] | 0| 0|FUNC |GLOB |0| UNDEF|__cxa_finalize
[51] | 0| 0|FUNC |GLOB |0| UNDEF|__cxa_personality_routine
Even in a simple c++ code without using any apache header I am getting these undefined symbol.
My environment variable is set as below:
CXX=aCC -mt +DD64
CXX_SLD=aCC -mt +DD64
CXX_EXELD=aCC -mt +DD64
CXX_EXELDFLAGS=-mt -Wl,+vshlibunsats -Wl,+s -Wl,-Bimmediate -Wl,-E -o
CC=/opt/aCC/bin/aCC
CC_ANSI_ORIG=cc -mt +DD64
CC_ANSI=aCC -mt +DD64
SLCC=cc -mt -Wl,+s +DD64 +W 474,2174,2177,2550 -Aa -c
EXELDLIBS=-lm
EXELDFLAGS=-Wl,+vshlibunsats,+s,+n,-Bimmediate,-Bnonfatal -o
EXELD=cc -mt -Wl,+s +DD64 +W 474,2174,2177,2550
LD_LIBRARY_PATH=/opt/oracle/product/11g_client/lib
SLD=ld
please help how to get rid of these undefined symbol
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2014 12:39 AM - edited 07-23-2014 09:13 AM
07-17-2014 12:39 AM - edited 07-23-2014 09:13 AM
Re: Runtime unsats with a simple aC++ shlib as Apache plugin
>how to get rid of these undefined symbol
These are defined in other shlibs. If you are dynamically loading from a C program, then you need to supply these shilbs on the link line:
-lstd_v2 -lCsup -lunwind
http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/HTML/distributing.htm#linking
>-L/usr/lib/hpux64
Leave this off, supplied by linker.
>these are automatically inserted by the compiler driver as required and in the correct order.
Not when you create shlibs with -b. See above for a better reference.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2014 02:15 AM - edited 07-17-2014 02:21 AM
07-17-2014 02:15 AM - edited 07-17-2014 02:21 AM
Re: Runtime unsats with a simple aC++ shlib on HP-UX
>Leave this off, supplied by linker
If I am not specifying lib path as "-L/usr/lib/hpux64" then by default it goes to the path "-L/usr/lib/hpux32". But we need to build it on 64 bit so we are specifying path as "-L/usr/lib/hpux64"
Secondly as per your instruction I tried running the following command
aCC -b +DD64 -AA +z -c -L/usr/lib/hpux64 -lstd_v2 -lCsup -lunwind calculator.cpp
aCC -b -o calc.so calculator.o
but then I checked with the ldd and nm command as follows:
ldd -d -r calc.so
calc.so:
symbol not found: _ZNSt8ios_base4InitD1Ev (./calc.so)
symbol not found: _ZNSt8ios_base4InitC1Ev (./calc.so)
symbol not found: __cxa_finalize (./calc.so)
symbol not found: _Unwind_Resume (./calc.so)
symbol not found: __cxa_atexit (./calc.so)
symbol not found: __cxa_personality_routine (./calc.so)
nm calc.so|grep UNDEF
[0] | 0| 0|NOTYP|LOCAL|0| UNDEF
| [48] | 0| 0|FUNC |GLOB |0| UNDEF|_Unwind_Resume
[45] | 0| 0|FUNC |GLOB |0| UNDEF|_ZNSt8ios_base4InitC1Ev
[44] | 0| 0|FUNC |GLOB |0| UNDEF|_ZNSt8ios_base4InitD1Ev
[50] | 0| 0|FUNC |GLOB |0| UNDEF|__cxa_atexit
[46] | 0| 0|FUNC |GLOB |0| UNDEF|__cxa_finalize
[51] | 0| 0|FUNC |GLOB |0| UNDEF|__cxa_personality_routine
I am still getting these same unsatsified symbols.
please help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2014 03:38 AM
07-17-2014 03:38 AM
Re: Runtime unsats with a simple aC++ shlib on HP-UX
As Dennis clarified, the unsatisfied symbols are defined in the system libraries, which will be resolved once you link your shared library into the main program. There's no need for the symbols to be available in your shared library.
As regards the linker search path, the compiler option +DD64 specifies a 64-bit build, so you need not specify the -L explicitly.
HP-UX Compilers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2014 04:06 AM
07-17-2014 04:06 AM
Re: Runtime unsats with a simple aC++ shlib on HP-UX
As per my understanding of your statement the unsatisfied symbol in the ".so" gets resolved when we link the ".so" with any main program.
But in our case as we trying to deploy the code in apache, so our next step is not linking the .so file with any main program but to load the ".so" in apache server as a module.
so we are loading the ".so" in apache httpd.conf file using
LoadModule calc_module modules/calculator.so
the unsatisfied symbol in the ".so" should be resolved by apache while deploying it in server but it does not get resolved and when we start the server using the command
apachectl start(command to start the server)
it fails to start and gives the error: unable to start the server because of the unsatisfied symbols present.
So please help what we should do now.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2014 06:30 AM - edited 07-23-2014 09:14 AM
07-17-2014 06:30 AM - edited 07-23-2014 09:14 AM
Re: Runtime unsats with a simple aC++ shlib as Apache plugin
> by default it goes to the path -L/usr/lib/hpux32.
Who are you going to believe? You or an expert? :-)
>aCC -b +DD64 -AA +z -c -lstd_v2 -lCsup -lunwind calculator.cpp
>aCC -b -o calc.so calculator.o
-c overrides -b. Put the libs on the second line:
aCC +DD64 -c -AA +z calculator.cpp
aCC +DD64 -b -o calc.so calculator.o -lstd_v2 -lCsup -lunwind -lm
> nm calc.so | grep UNDEF
nm(1) is not the proper tool with dealing with shlibs.
>I am still getting these same unsatsified symbols.
You didn't link with those shlibs. Did you read the webpage about:
Linking Your HP aC++ Libraries with Other Languages
>which will be resolved once you link your shared library into the main program.
This is being dynamically loaded so needs those dependent shlibs are linked into the shlib.
>next step is not linking the .so file ... but to load the ".so" in apache server as a module.
Right.
>what we should do now.
Follow the directions on:
http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/HTML/distributing.htm#linking
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2014 05:29 AM
07-23-2014 05:29 AM
Re: Runtime unsats with a simple aC++ shlib on HP-UX
Thanks for all the help provided by you.
It was really helpful.
I was able to build the webservice in C++ and generate the "calc.so" using the below steps and load it in apache server successfully and now facing some issue while calling it through the client.
aCC +DD64 -c -AA +z calculator.cpp----(1)
aCC +DD64 -b -o calc.so calculator.o -lstd_v2 -lCsup -lunwind -lm------(2)
We are using another shared library as a load module(example-abc.so) and that library is written in C.which is getting linked with the webservice shared library generated by us through (2) i.e calc.so (in C++ as described above) at run time.
The same webservice("calc.so") written and generated in C gets linked with the load module shared library(abc.so) is successfully deployed and tested using client.
can someone help me how to resolve this issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2014 09:18 AM
07-23-2014 09:18 AM
Re: Runtime unsats with a simple aC++ shlib as Apache plugin
>We are using another load module (abc.so) which is getting linked with ... calc.so at run time.
You are loading abc.so fron calc.so?
What's the error you're getting? What doesn't work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2014 10:34 PM
07-23-2014 10:34 PM
Re: Runtime unsats with a simple aC++ shlib as Apache plugin
Hi
I am building a C++ webservice using a C++ webservice toolkit called gSOAP.
For this, we have to build two shared libraries -
1. Shared library for our actual webservice (e.g. calculator.so) which is loaded into Apache server. I generated the "calculator.so" using the below steps and load it in apache server successfully.
aCC +DD64 -c -AA +z calculator.cpp soapC.cpp soapcalcService.cpp stdsoap2.cpp
aCC +DD64 -b -o calculator.so calculator.o soapC.o soapcalcService.o stdsoap2.o -lstd_v2 -lCsup -lunwind -lm
2. Shared library for a Apache module provided by the gSOAP toolkit called mod_gsoap.so. We need to build this shared library uisng the code (mod_gsoap.c written in pure C language) provided in the toolkit. mod_gsopa.so is generated using the following command (where apxs is a "C binary" of apache server)
apxs -a -i -c mod_gsoap.c
After building the the above two modules, we loaded the modules in Apache server. Then we started the Apache server and server was able to start.
We have also created a client (calcclient.cpp) to call the calculator webservice deployed in Apache.
But when we run the client:calcclient add 2 3
we are getting the following error.
Error -1 fault: SOAP-ENV:Client[no subcode]
"End of file or no input: Operation interrupted or timed out"
Detail: [no detail]
I then tried bulding the mod_gsoap.so through aCC compiler instead of apxs using the following command:
aCC +DD64 -c -AA +z mod_gsoap.c
aCC +DD64 -b -o mod_gsoap.so mod_gsoap.o
and loaded the mod_gsoap.so into Apache but I get the same error after running the calcclient.
But, when we build the same calculator.so and mod_gsoap.so shared libraries using C compilation, the calcclient runs successfully.
what is the reason that the code does not work in C++?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2014 10:40 PM
07-23-2014 10:40 PM
Re: Runtime unsats with a simple aC++ shlib as Apache plugin
Name mangling, perhaps?
You may want to verify that the symbols being crossed referenced do not get mangled, which would cause it to appear missing.
HP-UX Compilers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2014 11:37 PM
07-23-2014 11:37 PM
Re: Runtime unsats with a simple aC++ shlib as Apache plugin
Hi,
The following is our c++ calculator service code
calculator.cpp
extern "C"
{
#include "apache_gsoap.h"
} #include<iostream.h>
extern "C"
{
IMPLEMENT_GSOAP_SERVER()//Macro present in apache_gsoap.h
}
extern "C" int soap_serve(struct soap *soap) {
soap_init(soap);
calcService service(soap);
int err = service.serve();
service.destroy();
return err;
} int calcService::add(double a, double b, double *result)
{
*result = a + b;
return SOAP_OK;
}
int calcService::sub(double a, double b, double *result)
{
*result = a - b;
return SOAP_OK;
}
The apache_gsoap.h file is as folows:
#ifdef __cplusplus
extern "C"
{
#endif
--
--
--- IMPLEMENT_GSOAP_SERVER()/ ---//Code snnipet in "C" -- --
--
--
#ifdef __cplusplus
}
The mod_gsoap.c file needed to generate the other module mod_gsoap.so is as follows:
#ifdef __cplusplus
extern "C"
{
#endif
-
-
--- -- -- --
#ifdef __cplusplus
}
#endif
#endif
So i guess there is no issue with name mangling as the C code is written with extern "C" code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2014 11:35 AM
07-24-2014 11:35 AM
Re: Runtime unsats with a simple aC++ shlib as Apache plugin
>we are getting the following error.
Error -1 fault: SOAP-ENV:Client[no subcode]
"End of file or no input: Operation interrupted or timed out"
A particularly useless error.
>when we build the same calculator.so ... using C compilation
How can you do that when your source is C++?
>what is the reason that the code does not work in C++?
Have you tried setting breakpoints to trace the flow of code? You may have to use tusc.
>int err = service.serve();
I assume serve() is dispatching to your calcService member functions?
extern "C" {
#include "apache_gsoap.h"
}
Since apache_gsoap.h has already been C++ified, you shouldn't put it in another extern "C" block.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2014 04:55 AM
07-25-2014 04:55 AM
Re: Runtime unsats with a simple aC++ shlib as Apache plugin
Hi ,
Thanks for the updates and all the helps till now.
>when we build the same calculator.so ... using C compilation
How can you do that when your source is C++?
-->The source is in pure "C" ( not in C++) when we are using C compiler.
>what is the reason that the code does not work in C++?
Have you tried setting breakpoints to trace the flow of code? You may have to use tusc.
-->
we can not use tusc on a shared library , our service is .so so we have tried tusc with the client code (which is actually calling the service).
The output of tusc on client code is inconsistant on different executions.
We have tried the same tusc for the service written in "C" as well just to compare the output and below is the difference we observed at the end of the output generated by tusc:
In C:
send(4, "P O S T / s o a p H T T P / ".., 608, 0) ........................................................ = 608
recv(4, "H T T P / 1 . 1 2 0 0 O K \r".., 65536, 0) ...................................................... = 610
brk(0x6000000000034000) ...................................................................................... = 0
shutdown(4, SHUT_RDWR) ....................................................................................... = 0
close(4) ..................................................................................................... = 0
write(1, "a f t e r c a l l t o A d ".., 18) ........................................................... = 18
write(1, "\n", 1) ............................................................................................ = 1
brk(0x6000000000036000) ...................................................................................... = 0
ioctl(1, TCGETA, 0x87fffffffffcc410) ......................................................................... = 0
write(1, "r e s u l t a c t u a l = ".., 18) ........................................................... = 18
exit(0) ...............................
In C++
send(4, "P O S T / s o a p H T T P / ".., 608, 0) ........................................................ = 608
recv(4, "H T T P / 1 . 1 2 0 0 O K \r".., 65536, 0) ...................................................... = 894
recv(4, 0x87fffffffffd8680, 65536, 0) ........................................................................ = 0
write(1, "a f t e r c a l l t o A d ".., 18) ........................................................... = 18
write(1, "\n", 1) ............................................................................................ = 1
write(1, "S O A P E R R O R : ", 11) ....................................................................... = 11
write(1, "\n", 1) ............................................................................................ = 1
write(1, "R e s u l t 2 : ", 8) .............................................................................. = 8
write(1, "0 ", 1) ............................................................................................ = 1
write(1, "\n", 1) ............................................................................................ = 1
write(2, "E r r o r ", 6) .................................................................................. = 6
write(2, "- 1 ", 2) .......................................................................................... = 2
write(2, " f a u l t : ", 8) .............................................................................. = 8
write(2, "S O A P - E N V : C l i e n t ", 15) ............................................................... = 15
write(2, "[ ", 1) ............................................................................................ = 1
write(2, "n o s u b c o d e ", 10) ......................................................................... = 10
write(2, "] ", 1) ............................................................................................ = 1
write(2, "\n", 1) ............................................................................................ = 1
write(2, "" ", 1) ............................................................................................ = 1
write(2, "E n d o f f i l e o r n ".., 59) ........................................................... = 59
write(2, "" ", 1) ............................................................................................ = 1
write(2, "\n", 1) ............................................................................................ = 1
write(2, "D e t a i l : ", 8) .............................................................................. = 8
write(2, "[ n o d e t a i l ] ", 11) ....................................................................... = 11
write(2, "\n", 1) ............................................................................................ = 1
shutdown(4, SHUT_RDWR) ....................................................................................... = 0
close(4) ..................................................................................................... = 0
exit(0) ...................................................................................................... WIFEXITED(0)
>int err = service.serve();
I assume serve() is dispatching to your calcService member functions?
--> Yes this is correct
extern "C" {
#include "apache_gsoap.h"
}
Since apache_gsoap.h has already been C++ified, you shouldn't put it in another extern "C" block.
-->Yes this is correct but using extern "C" multiple times should not make any difference ?
Please help what else we can try.
Thanks,
Biswadeep.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2014 02:51 PM
07-25-2014 02:51 PM
Re: Runtime unsats with a simple aC++ shlib as Apache plugin
-->The source is in pure "C" ( not in C++) when we are using C compiler.
But calculator.cpp is C++. Or is that different than calc.so?
>we can not use tusc on a shared library
Yes, you use tusc on processes.
write(1, "a f t e r c a l l t o A d ".., 18)
It seems to go wrong here. Is this your message? You may have to ask tusc to print longer strings in the writes.
write(1, "S O A P E R R O R : ", 11)
write(1, "R e s u l t 2 : ", 8)
write(1, "0 ", 1)
-->using extern "C" multiple times should not make any difference?
It has caused compilation errors in the past and not a good idea to do.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2014 05:38 AM
07-28-2014 05:38 AM
Re: Runtime unsats with a simple aC++ shlib as Apache plugin
--->But calculator.cpp is C++. Or is that different than calc.so?
We are trying to build our webservice in two differnet language: i.e in C and C++ respectively.
The codes are in C and C++ respectively and the compiler is different for both the cases and the calc.so are also different in both the cases.
Both the webservices are distinct.
Our webservice is working fine with C code but in C++ we are facing issues as mentioned above.
Hope now its clear.Sorry for the confusion.
--->Yes, you use tusc on processes.
We tried running our code using the following command:
tusc -f -o calc.tusc -p 19174( 19174 is the main process id,after loading our calc.so(in C++) , mod_gsoap.so(in C) into the apache server and starting it)
tail -f calc.tusc
Here is our output file
[19174] select(0, NULL, NULL, NULL, 0x87ffffffffff65d0) ...................................................... [sleeping]
[19174] select(0, NULL, NULL, NULL, 0x87ffffffffff65d0) ...................................................... = 0
[19174] waitpid(-1, WIFEXITED(0), WNOHANG|WUNTRACED) ......................................................... = 0
[19174] select(0, NULL, NULL, NULL, 0x87ffffffffff65d0) ...................................................... = 0
[19174] waitpid(-1, WIFEXITED(0), WNOHANG|WUNTRACED) ......................................................... = 0
[19174] select(0, NULL, NULL, NULL, 0x87ffffffffff65d0) ...................................................... = 0
[19174] waitpid(-1, WIFEXITED(0), WNOHANG|WUNTRACED) ......................................................... = 0
[19174] select(0, NULL, NULL, NULL, 0x87ffffffffff65d0) ...................................................... = 0
[19174] waitpid(-1, WIFEXITED(0), WNOHANG|WUNTRACED) ......................................................... = 0
[19174] select(0, NULL, NULL, NULL, 0x87ffffffffff65d0) ...................................................... = 0
[19174] waitpid(-1, WIFEXITED(0), WNOHANG|WUNTRACED) ......................................................... = 0
When We tried tusc in C code thats working fine(for comaprison purpose) using the command:
tusc -f -o calc1.tusc -p 26841( 26841 is the main process id,after loading our calc.so(in C) ,mod_gsoap.so(in C)( into the apache server and starting it)
tail -f calc1.tusc
the output file is as follows:
[26841] select(0, NULL, NULL, NULL, 0x87ffffffffff65d0) ...................................................... [sleeping]
[26841] select(0, NULL, NULL, NULL, 0x87ffffffffff65d0) ...................................................... = 0
[26841] waitpid(-1, WIFEXITED(0), WNOHANG|WUNTRACED) ......................................................... = 0
[26841] select(0, NULL, NULL, NULL, 0x87ffffffffff65d0) ...................................................... = 0
[26841] waitpid(-1, WIFEXITED(0), WNOHANG|WUNTRACED) ......................................................... = 0
[26841] select(0, NULL, NULL, NULL, 0x87ffffffffff65d0) ...................................................... = 0
[26841] waitpid(-1, WIFEXITED(0), WNOHANG|WUNTRACED) ......................................................... = 0
[26841] select(0, NULL, NULL, NULL, 0x87ffffffffff65d0) ...................................................... = 0
[26841] waitpid(-1, WIFEXITED(0), WNOHANG|WUNTRACED) ......................................................... = 0
[26841] select(0, NULL, NULL, NULL, 0x87ffffffffff65d0) ...................................................... = 0
[26841] waitpid(-1, WIFEXITED(0), WNOHANG|WUNTRACED) ......................................................... = 0
The output file using tusc is same for process(using C) and process(using C++).
for c we are getting the correct result through client but for C++ it is not working.
---> using extern "C" multiple times has caused compilation errors in the past and not a good idea to do.
ok but we are not facing anny issues during compilation time.We have even removed the extern "C" line from our code and compiled the code again.
Please suggest what we should do next.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2014 10:39 AM
07-28-2014 10:39 AM
Re: Runtime unsats with a simple aC++ shlib as Apache plugin
>Here is our output file
Your two tusc output file fragments don't cover the error timeframe.
Your previous one did and included the error message.
Note: The -p option has nothing to do with the PID but with listing them. And so it should go next to the -f: -fp
>The output file using tusc is same for process (using C) and process (using C++).
>for C we are getting the correct result through client but for C++ it is not working.
This would imply it isn't the system calls but how you process the data that's going wrong.
All tusc can do is bracket the timeframes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2014 11:08 AM
07-28-2014 11:08 AM
Re: Runtime unsats with a simple aC++ shlib as Apache plugin
Can you please elaborate on the use of "tusc" command with context to our problem statement with the help of an example or what command I should use and how
I am new to using "tusc"command.So not fully aware of its usage.
So a little elaboration from your side would be more helpful in understanding the concepts.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2014 02:22 AM
07-29-2014 02:22 AM
Re: Runtime unsats with a simple aC++ shlib as Apache plugin
>Can you please elaborate on the use of "tusc" command with context to our problem statement
The generic tusc is something like: (you basically had that but in a strange order)
tusc -fp -o tusc.out PID
If you want more details on exec and other calls, add: -ea
To get larger buffers for stdout/stderr: -w1,2 -b 128
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2014 12:44 AM
07-31-2014 12:44 AM
Re: Runtime unsats with a simple aC++ shlib as Apache plugin
Can C process accept C++ Shared libraries?
Apache is written in purely C and in that we are trying to load a C++ module?
Is that the problem for these issues?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2014 02:21 AM
07-31-2014 02:21 AM
Re: Runtime unsats with a simple aC++ shlib as Apache plugin
>Can C process accept C++ Shared libraries?
Only if you follow the process on:
http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/HTML/distributing.htm#linking
>Is that the problem for these issues?
That was your initial problem you solved in:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2014 08:19 AM
08-04-2014 08:19 AM
Re: Runtime unsats with a simple aC++ shlib as Apache plugin
Hi,
Thanks for the help so far. As we have already mentioned we are trying our webservice in both C and C++ seperatley.
In C it is working fine but in c++ it is not(not able to call the service through client)
In C the call to the service is being done through soap_serve method but in C++ its is done through soap_serve method which calls the serve method.
The compilation process and the generated ".so" is different for both C and C++.
We tried the following command
In C code:
nm calc.so|grep soap_serve
the output is:
[515] | 4611686018427867104| 80|FUNC |GLOB |0| .text|apache_default_soap_serve
[428] | 4611686018427814096| 656|FUNC |GLOB |0| .text|soap_serve
[266] | 4611686018427815520| 1520|FUNC |GLOB |0| .text|soap_serve_ns__add
[274] | 4611686018427817488| 1520|FUNC |GLOB |0| .text|soap_serve_ns__sub
[249] | 4611686018427814848| 352|FUNC |GLOB |0| .text|soap_serve_request
The code works fine here.The client returns the desired results.
In C++ code:
nm calc.so|grep serve(since soap_serve calls the function serve)
the output is :
[124] | 4611686018427623904| 2768|FUNC |LOCAL|0| .text|_Z13serve_ns__addP11calcService
[125] | 4611686018427626864| 2768|FUNC |LOCAL|0| .text|_Z13serve_ns__subP11calcService
[729] | 4611686018427620992| 1024|FUNC |GLOB |0| .text|_ZN11calcService5serveEv
[623] | 4611686018427523808| 176|FUNC |GLOB |0| .text|apache_default_soap_serve
[570] | 4611686018427993376| 672|FUNC |GLOB |0| .text|soap_begin_serve
[516] | 4611686018427524016| 1280|FUNC |GLOB |0| .text|soap_serve
We can see that it contains both the function add and subtract and name mangling is also taken care of.
Bu in this case client still couldnot call the service and hence unable to get the desired result
What can be the reasons?.
Apache Server is build in pure C.
All the linking steps in building of c++ shared library is done as per the steps mentioned in the forum by the experts.
So the process of loading a C++ shared Library into a C process(i.e Apache) is taken care of by the steps mentioned in the forum.
So I dont think that is the issue.
What could be the issue now?
please help.