Operating System - HP-UX
1833866 Members
2717 Online
110063 Solutions
New Discussion

Re: static library problem

 
satyach
Advisor

static library problem

Hi,

When I run a statically built (archive) executable on HPUX 11.0 with aCC: HP ANSI C++ B3910B A.03.25 I see the following error message:
$ a.out aCC runtime: ERROR: Unexpected use of shared libraries
aCC runtime: ERROR: Read aCC manpage, +A option
/usr/lib/libnss_files.1 Abort(coredump)

The +A option is used during compile and it seems to make no difference i/ ensure a static archive executable.

please suggest me, how to create static library version with out above problem

Thanks
satya
5 REPLIES 5
satyach
Advisor

Re: static library problem

since nobody responding to this message. i am adding traced path during core


#0 0x5001d0 in kill ()
#1 0x50e6b8 in raise ()
#2 0x50958c in abort_C ()
#3 0x4f3568 in abort ()
#4 0x5150c4 in shl_load ()
#5 0x50b004 in SO_per_src_lookup ()
#6 0x4f6e58 in nss_get_backend_u ()
#7 0x4f7828 in nss_search ()
#8 0x4a837c in __gethostbyname_r ()
#9 0x4a84d0 in gethostbyname ()
#10 0x4516a8 in _X11TransSocketINETConnect ()
#11 0x4524a4 in _X11TransConnect ()
#12 0x44ce18 in _X11TransConnectDisplay ()
#13 0x432204 in XOpenDisplay ()
#14 0x3e4e64 in XtOpenDisplay ()
#15 0x3e505c in _XtAppInit ()
#16 0x3ee9dc in XtOpenApplication ()

By seeing the above trace, getHostbyName() internaly calls shl_load().
because of usage os shl_load() function. system throughs the error message

but why getHostbyName calls shl_load. Then How i can create the version by using A++(because aCC manual shows we can not use +A for shl_load call used any where)

is there any wrong with HP system. do we need any patch?

please respond to this, this is very critical to me.

satya
Santosh Nair_1
Honored Contributor

Re: static library problem

It looks like its trying to figure out which method it should use to resolve the hostname, i.e. NIS, DNS or local file. The libnss_files implements lookups for local files. Unfortunately, I couldn't find a archived version of this libarary. Your program is puking because its trying to pull in a shared library and that's not allowed when you use the +A option. Can you try relinking with the -Wl,a archived_shared option? This would instruct the linker to compile against archived library as much as possible and then fall back to using shared libraries. Not sure if this would be an option for you though.

-Santosh
Life is what's happening while you're busy making other plans
satyach
Advisor

Re: static library problem

Hi Santosh

good to see your reply. as per ur suggestions. i tried following options.

-Wl,a archived_shared (it gave error during linking about the syntax).

I tried the following option

-Wl,-a,archive

it created the executable. it gives the following error during execution.

Error: Can't open display: XX100:0.0

even though DISPLAY env and xhost defined properly(i tested by invoking xclock)

thanks
satya
Santosh Nair_1
Honored Contributor

Re: static library problem

Sorry about the typo, that should have read archive, not archived.

As for the display problem, what is tha application trying to do? Is the display that its trying to use your workstation/PC and what is the DISPLAY environment variable set to?

Also, just out of curiosity, what is this app if you don't mind me asking?

-Santosh
Life is what's happening while you're busy making other plans
satyach
Advisor

Re: static library problem

Hi Santhosh

I am working on SUN workstion and remote login to HP machine.

i used setenv DISPLAY HP_IP:0.0
in login xterm window.

and i gave xhost HP_IP in my xterm(SUN).

i tested by invoking the xterm and xclock .

Even if i am sitting in front of the HP machine and i am using same work station(executable lies on the same machine). it gave same error.

I am developing a GUI, which contains tree object and other common moti objects.

Thanks
Satya