1836471 Members
1819 Online
110101 Solutions
New Discussion

Re: HP C/ANSI C?

 
Steve Heck_1
Advisor

HP C/ANSI C?

I have installed the HP C/ANSI C Developer's bundle on HPUX 11.11 but it appears to be still using the default version. /usr/ccs/bin/cc

How do I set the path for /opt/ansic/bin/cc?

I have removed /usr/ccs/bin from ect/PATH.

Thanks!

9 REPLIES 9
H.Merijn Brand (procura
Honored Contributor

Re: HP C/ANSI C?

Don't remove /usr/ccs/bin

# cat /etc/PATH
/usr/bin:/opt/ansic/bin:/usr/ccs/bin:/usr/contrib/bin:/opt/nettladm/bin:/opt/fc/bin:/opt/fcms/bin:/opt/upgrade/bin:/opt/pd/bin:/usr/bin/X11:/usr/contrib/bin/X11:/opt/resmon/bin:/usr/sbin/diag/contrib:/opt/pred/bin:/opt/hparray/bin:/pro/local/bin:/pro/bin:/opt/perf/bin:/opt/hpnp/bin:/opt/langtools/bin:/opt/imake/bin:/opt/cxperf/bin:/opt/ignite/bin:/opt/openssh2/bin:/opt/sec_mgmt/spc/bin:/usr/local/bin:/usr/local/sbin:/opt/java1.4/jre/bin:/opt/graphics/common/bin:/pro/local/libexec:/pro/local/sbin:/usr/local/mysql/bin:/pro/local/samba/bin:/pro/local/samba/sbin

and for one time use

(t)csh:
% setenv PATH /opt/ansic/bin:/usr/ccs/bin:$PATH

(k)sh:
> export PATH=/opt/ansic/bin:/usr/ccs/bin:$PATH

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Senthil Kumar .A_1
Honored Contributor

Re: HP C/ANSI C?

Though your question has answer..

I would say add the entry /opt/ansic/bin to ect/PATH file or you could append
/opt/ansic/bin to PATH defnition in /etc/profile file.

regards
Let your effort be such, the very words to define it, by a layman - would sound like a "POETRY" ;)
Steve Heck_1
Advisor

Re: HP C/ANSI C?

The installer did add /usr/bin:/opt/ansic/bin:/usr/ccs/bin to ect/PATH.

But how can I tell if it is using the ansic compiler?
Senthil Kumar .A_1
Honored Contributor

Re: HP C/ANSI C?

Hi Steve,

Try the following command..

which cc

this will tell you which cc will be used when you involke the command.

Regards.
Let your effort be such, the very words to define it, by a layman - would sound like a "POETRY" ;)
Steve Heck_1
Advisor

Re: HP C/ANSI C?

# cc
/usr/ccs/bin/ld: Unsatisfied symbols:
main
Senthil Kumar .A_1
Honored Contributor

Re: HP C/ANSI C?

Hi Steve,

Please type..

"which cc"

Without quotes.."Which" is a command.

Regards..
Let your effort be such, the very words to define it, by a layman - would sound like a "POETRY" ;)
Steve Heck_1
Advisor

Re: HP C/ANSI C?

# which cc
/bin/cc
H.Merijn Brand (procura
Honored Contributor

Re: HP C/ANSI C?

If the installer did the right thing, your /usr/bin/cc (or the depricated /bin/cc), is now a symbolic link:

10223 100555 -r-x 1 bin 618496 25 Jan 2005 06:26 /usr/bin/cc -> /opt/ansic/bin/cc
10223 100555 -r-x 1 bin 618496 25 Jan 2005 06:26 /opt/ansic/bin/cc
8405 100555 -r-x 1 bin 225280 7 Nov 1997 09:00 /usr/ccs/bin/cc -> ./cc_bundled

This is the ANSI-C C compiler:
a5:/u/usr/merijn 102 > what `which cc`
/usr/bin/cc:
$Revision: 92453-07 linker linker crt0.o B.11.37 040218 $
LINT B.11.X.32509-32512.GP CXREF B.11.X.32509-32512.GP
HP92453-01 B.11.X.32509-32512.GP HP C Compiler
$ PATCH/11.00:PHCO_27774 Oct 3 2002 09:45:59 $
a5:/u/usr/merijn 103 >

And this is the bundled braindead compiler:
a5:/u/usr/merijn 103 > what `which cc_bundled`
/usr/ccs/bin/cc_bundled:
HP92453-01 A.11.00.00 HP C (Bundled) Compiler
CUPROS_IC23B //1
/ux/core/libs/libc/archive_pa1/libc.a_ID
Oct 21 1997 13:07:38
a5:/u/usr/merijn 104 >

You can also pass -v to the compile phase:
a5:/tmp 108 > cat >xx.c
#include

int main (int argc, char *argv[])
{
return (0);
} /* main */
a5:/tmp 109 > cc -v -o xx xx.c
cc: informational note 404: NLSPATH is /opt/ansic/lib/nls/msg/%L/%N.cat:/opt/ansic/lib/nls/msg/C/%N.cat:
cc: informational note 404: INCLUDIR is INCLUDIR=/usr/include
cc: informational note 404: CCOPTS is not set.
/opt/langtools/lbin/cpp.ansi xx.c /tmp/ctmAAAa14252 -$ -D__hp9000s800 -D__hppa -D__hpux -D__unix -D_ILP32 -e -D_PA_RISC2_0 -D_HPUX_SOURCE -D__STDC_EXT__ -D__HP_cc=111108
cc: informational note 411: Entering Preprocessor.
/opt/ansic/lbin/ccom /tmp/ctmAAAa14252 xx.o -Fxx.c -Oq00,al,ag,cn,Lm,sz,Ic,vo,lc,mf,Po,es,rs,sp,in,vc,pi,fa,pe,Rr,Fl,pv,pa,nf,cp,lx,st,ap,Pg,ug,lu,lb,uj,dp,fs,bp,wp,cl,mo,xn,Ex,mp,rp,ap,dn,Sg,pt,kt,Em,pc,np! -ESconstlit -Ae
cc: informational note 404: LPATH is /usr/lib:/opt/langtools/lib:
/usr/ccs/bin/ld /opt/langtools/lib/crt0.o -o xx xx.o -u main -lc
cc: informational note 413: Entering Link editor.
a5:/tmp 110 >

There the difference with the braindead bundled compiler is obvious:
a5:/tmp 110 > cc_bundled -v -o xx xx.c
(Bundled) cc: NLSPATH is /usr/lib/nls/msg/%L/%N.cat:/usr/lib/nls/msg/C/%N.cat:
(Bundled) cc: CCOPTS is not set.
(Bundled) cc: INCLUDIR is INCLUDIR=/usr/include
/usr/ccs/lbin/cpp xx.c /tmp/ctmAAAa14300 -$ -D__hp9000s800 -D__hppa -D__hpux -D__unix -D_PA_RISC1_1 -D__CLASSIC_C__ -j
(Bundled) cc: Entering Preprocessor.
/usr/ccs/lbin/ccom /tmp/ctmAAAa14300 xx.o
(Bundled) cc: "xx.c", line 3: error 1705: Function prototypes are an ANSI feature.
Exit 1
a5:/tmp 111 >

And finally you can check the generated object:

a5:/tmp 112 > odump -compunit xx

Compilation Unit Dictionary from xx:

Index Chunk Language Name
Product_id ; Version_id
Compile time ; Source time

0 0 PA-RISC 2.0 Assembler crt0.o

HP92453-03; UX.11.01.24
Compile Time: Thu Dec 04 2003 22:54:57.000000000 MET
Source Time: Thu Dec 04 2003 22:55:07.000000000 MET

1 0 HPC ../mapdld.c
/CLO/Components/LINKER/Src/csu/CRT_RELEASE
ccom options = -ESlit -DA1.1 -DS1.1 -Oq02,al,ag,cn,Lm,sz,Ic,vo,lc,Mf,Po,es,rs,s
p,in,vc,Pi,fa,pe,Rr,Fl,pv,pa,nf,cp,lx,st,ap,Pg,ug,Lu,lb,uj,dp,Fs,bp,wp,Ex,mp,rp,
ap,dn,Sg,pt,kt,Em,pc,np! +k -Ae

HP92453-01 ; W111107
Compile Time: Thu Dec 04 2003 22:55:35.000000000 MET
Source Time: Thu Jan 23 2003 11:17:33.000000000 MET

2 0 PA-RISC 2.0 Assembler

HP92453-03; UX.11.01.24
Compile Time: Thu Dec 04 2003 22:55:02.000000000 MET
Source Time: None

3 0 HPC ../maptsd.c
/CLO/Components/LINKER/Src/csu/CRT_RELEASE
ccom options = -ESlit -DA1.1 -DS1.1 -Oq02,al,ag,cn,Lm,sz,Ic,vo,lc,Mf,Po,es,rs,s
p,in,vc,Pi,fa,pe,Rr,Fl,pv,pa,nf,cp,lx,st,ap,Pg,ug,Lu,lb,uj,dp,Fs,bp,wp,Ex,mp,rp,
ap,dn,Sg,pt,kt,Em,pc,np! +k -Ae

HP92453-01 ; W111107
Compile Time: Thu Dec 04 2003 22:55:15.000000000 MET
Source Time: Thu Jan 23 2003 11:17:35.000000000 MET

4 0 PA-RISC 2.0 Assembler set_tp

HP92453-03; UX.11.01.24
Compile Time: Thu Dec 04 2003 22:55:07.000000000 MET
Source Time: Sat Oct 04 1997 05:02:46.000000000 METDST

5 0 HPC xx.c
/tmp
ccom options = -Oq00,al,ag,cn,Lm,sz,Ic,vo,lc,mf,Po,es,rs,sp,in,vc,pi,fa,pe,Rr,F
l,pv,pa,nf,cp,lx,st,ap,Pg,ug,lu,lb,uj,dp,fs,bp,wp,cl,mo,xn,Ex,mp,rp,ap,dn,Sg,pt,
kt,Em,pc,np! -ESconstlit -Ae

HP92453-01 ; B11X.25
Compile Time: Tue Jun 14 2005 08:30:19.000000000 METDST
Source Time: Tue Jun 14 2005 08:28:44.000000000 METDST

6 0 PA-RISC 2.0 Assembler dyncallU

HP92453-03; UX.11.01.06 (ROSE)
Compile Time: Fri Jan 08 1999 01:46:03.000000000 MET
Source Time: Fri Jan 08 1999 01:46:03.000000000 MET


a5:/tmp 113 >

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Amit Agarwal_1
Trusted Contributor

Re: HP C/ANSI C?

Check the link /bin/cc and /usr/bin/cc, wheteher they are poiting to /opt/ansic/bin/cc or not. I suspect they are still poiting to native c compiler.

On my system they look like
$ ll /bin/cc
lr-xr-xr-t 1 root sys 17 Oct 14 2004 /bin/cc -> /opt/ansic/bin/cc
$ ll /usr/bin/cc
lr-xr-xr-t 1 root sys 17 Oct 14 2004 /usr/bin/cc -> /opt/ansic/bin/cc