- 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
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
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