1833323 Members
3035 Online
110051 Solutions
New Discussion

The link error

 
SOLVED
Go to solution
Jack_27
Advisor

The link error

Hi,

I want to compile some code which work correctly on Linux but not go on HP_UX now.
The error message lists below:

ld -lc -o ../lib/libcom.so cLog.o
ld: (Warning) At least one PA 2.0 object file (cLog.o) was detected. The linked
output may not run on a PA 1.x system.
ld: Unsatisfied symbols:
__nw__FUi (code)
__dl__FPv (code)
__curStaticObject (data)
ld: Unsatisfied symbols:
$global$ (data)
*** Error exit code 1

Stop.

It looks like some c++ libraries are missed,right?
Could somebody give me some suggestion?
Thanks.
4 REPLIES 4
Steven Gillard_2
Honored Contributor

Re: The link error

For C++ code you must use aCC to perform the link step - do not call ld directly.

Regards,
Steve
Jack_27
Advisor

Re: The link error

Hi,Steven

Thanks for your suggestion firstly.
However I do use the aCC compiler,my Makefile is attached,Could you have a look on it?

The content of os.mk
#
# OS_HP: for hp operating system, HP-UX
#
OS_CC = aCC
OS_LD = ld
OS_AR = ar
OS_LEX = lex
OS_LEXFLAGS =
OS_YACC = yacc
OS_YACCFLAGS = -d
#OS_FLAGS = -g +w +a1 -Wl,+nocompatwarnings
OS_FLAGS = -g +w
OS_DYNALDFLAGS =

Cheers
Jack
OS_LLIB = -lc
Steven Gillard_2
Honored Contributor
Solution

Re: The link error

It certainly looks like you're invoking ld directly to perform the link step:

# build the libraries
$(LIB_PATH)/libcom.so: $(LIBCOMOBJS)
$(LD) $(OS_DYNALDFLAGS) -o $@ $(LIBCOMOBJS)


The correct command line for building a shared library is:

$ aCC -b -o ../lib/libcom.so cLog.o

See this link for more information:

http://docs.hp.com/hpux/onlinedocs/dev/aCC/a_03_33/libs.htm#shlib

Regards,
Steve
Jack_27
Advisor

Re: The link error

Hi,Stevens

I have fixed it with your great help,thank you very much.You really good.

Cheers
Jack