cancel
Showing results for 
Search instead for 
Did you mean: 

Compiling HP-UX 11.23

 
SOLVED
Go to solution
Highlighted
Regular Advisor

Compiling HP-UX 11.23

I can't link archive or shared libraries that include STL (standard template library) code.
If I compile and link the code without making use of an archive library step, it works.
As soon as I include the STL code within the archive or shared library, the link step fails.

Here is my .mk file:

#--------------------------------------------------------------
# HP-UX C++ compiler
#--------------------------------------------------------------
COMPILE=/opt/aCC/bin/aCC
CCFLAGS= -AA -c -v +p +DA2.0 +DS2.0 \
-D_HPUX_SOURCE \
-D_POSIX_C_SOURCE=199506L \
-DRWSTD_MULTI_THREAD \
-DRW_MULTI_THREAD \
-D_REENTRANT \
-D_THREAD_SAFE

#--------------------------------------------------------------
# HP-UX C++ linker
#--------------------------------------------------------------
LINK=ld
LDFLAGS= \
/opt/langtools/lib/crt0.o \
/opt/aCC/lib/cpprt0.o \
-L /opt/aCC/lib \
-v \
+vallcompatwarnings \
+pd 16M \
-lstd_v2 \
-lCsup_v2 \
-lm \
-L$(ORACLE_HOME)/lib32 \
-lclntsh

#--------------------------------------------------------------
# excutable
#--------------------------------------------------------------
exe: main.o failing.a
$(LINK) $(LDFLAGS) main.o -o tester.exe

main.o : main.cpp
$(COMPILE) $(CCFLAGS) main.cpp

failing.a : failing.cpp
$(COMPILE) $(CCFLAGS) failing.cpp
ar r failing.a failing.o
#--------------------------------------------------------------


Any ideas please?

Thanks

Carlo
Live fast, die young - enjoy a good looking corpse!
6 REPLIES 6
Highlighted

Re: Compiling HP-UX 11.23

You didn't mention how the link step failed.

Generally you must NOT use ld to link aC++ applications. Use aCC instead.

You need to change your LDFLAGS to remove the default libs and then you need to add -AA. And change ld specific options to the -Wl form: -Wl,+pd,16M.
Highlighted
Regular Advisor

Re: Compiling HP-UX 11.23

This is the error I get:

ld: Unsatisfied symbols:
fxFailingToLink__Fv (first referenced in main.o) (code)
*** Error exit code 1

Carlo
Live fast, die young - enjoy a good looking corpse!
Highlighted
Solution

Re: Compiling HP-UX 11.23

Where have you defined fxFailingToLink(void), in failing.cpp?

I don't see failing.a added to your link line, after main.o
Highlighted
Regular Advisor

Re: Compiling HP-UX 11.23

Hi Dennis

I think the problem is with the creation of the archive file
"ar r failing.a failing.o"

If it is compiled with just the objects (failing.o) all is fine, but as soon as an archive is created, it is as if the archive file (failing.a) is not picked up?

Carlo
Live fast, die young - enjoy a good looking corpse!
Highlighted
Regular Advisor

Re: Compiling HP-UX 11.23

Dennis

Your comment got me on the right track...hence the points, thanks.

Carlo
Live fast, die young - enjoy a good looking corpse!
Highlighted
Regular Advisor

Re: Compiling HP-UX 11.23

PS: The problem was the link command:
$(LINK) $(LDFLAGS) main.o -o tester.exe
did not include the .a as follows:
$(LINK) $(LDFLAGS) main.o failing.a -o tester.exe

Cheers

Carlo
Live fast, die young - enjoy a good looking corpse!