Operating System - HP-UX
1752781 Members
5837 Online
108789 Solutions
New Discussion юеВ

Re: g++ with -static option can't compile

 
Andrew Lee_5
Occasional Advisor

g++ with -static option can't compile

I am running HP-UX 11i.
I want to compile my program and then run on another machine. So I need to use the "static" option and the command look like this:

% g++ -static -o test test.cpp

then it shows error as follows:

ld: Unsatified symbol "dlclose" in file /usr/lib/pa20_64/libc.a [setlocale.o]
ld: Unsatified symbol "dlsym" in file /usr/lib/pa20_64/libc.a [setlocale.o]
ld: Unsatified symbol "dlopen" in file /usr/lib/pa20_64/libc.a [setlocale.o]

Could anyone tell me what the problem is and how to solve this problem?
Any input is welcome and thanksful.

Andrew Lee
5 REPLIES 5
harry d brown jr
Honored Contributor

Re: g++ with -static option can't compile

What does test.cpp look like? Can you attach it??

live free or die
harry
Live Free or Die
Andrew Lee_5
Occasional Advisor

Re: g++ with -static option can't compile

Thanks for your reply
test.cpp is very simple.
Only included iostream.h, stdlib.h, stdio.h
and with only one printf statement in the main function.
That's all.
Any idea?

Andrew Lee
harry d brown jr
Honored Contributor

Re: g++ with -static option can't compile

Attach your program and I'll try to compile it.

Did you get the gcc from here

https://www.beepz.com/personal/merijn/#Gcc

??


live free or die
harry
Live Free or Die
Olav Baadsvik
Esteemed Contributor

Re: g++ with -static option can't compile


Hi,

I do not know g++ but I assume that -static
is the same as in HP-language would be
called archive (independant of shared libs)

The symbols you get unsatisfied are found
in libdld.sl.
The man-page for setlocale has a section
describing special considerations for linking
independant of shared libs.

See this section. It describes how
to link in libdld. You will there see what
has to be done when using cc. Try then to
find the appropriate otions for g++

Regards
Olav
Andrew Lee_5
Occasional Advisor

Re: g++ with -static option can't compile

No, the gcc was downloaded from hp's website:
http://h21007.www2.hp.com/dspp/tech/tech_TechSoftwareDetailPage_IDX/1,1703,547,00.html

The one I downloaded 3.0.2 64-bit binary (this version seems can't be download now)

Will it be different (apart from version) from that one on merjin's server?

I'd attached my test.cpp. Please tell me if you can compile it with -static or not. (P.S. it can be compiled without -static switch, but It can't be portable.)

Can anyone tell me how to use the "archive" switch in g++?
And how can I link with libdld.sl?

Thanks a lot!!

Andrew Lee