Operating System - HP-UX
1753819 Members
9050 Online
108805 Solutions
New Discussion юеВ

Re: gcc on HPUX 11i. Question.

 
Andrew E. Malone
Occasional Contributor

gcc on HPUX 11i. Question.

I have a fairly simple program from a vendor that builds a Native Share Library for matching permission on replicated files. It uses Java libraries and pwd.h and grp.h of which are in place and I have tried different versions of gcc 2.9 and 3.2 but the errors are consistent. Any Ideas or insights would be appreciated.

Command executed:
/usr/local/bin/gcc -v -I . -I /opt/java1.4/include -I /opt/java1.4/include/hp-ux UnixIO.cc -o libfrpro3.so


The errors I get are:

UnixIO.cc: In function `int set_all(const char*, const char*, const char*,
int)':
UnixIO.cc:26: `getpwnam_r' undeclared (first use this function)
UnixIO.cc:26: (Each undeclared identifier is reported only once for each
function it appears in.)
UnixIO.cc:32: `getgrnam_r' undeclared (first use this function)
UnixIO.cc: In function `char* get_all(const char*)':
UnixIO.cc:60: `getpwuid_r' undeclared (first use this function)
UnixIO.cc:62: `getgrgid_r' undeclared (first use this function)
4 REPLIES 4
Ollie R
Respected Contributor

Re: gcc on HPUX 11i. Question.

Hi Andrew,

Seems the is either not found or the incorrect one is found.

I'm not too familiar with "gcc", but does it include the standard include paths during compilation?

Maybe you could add an explicit
"-I /usr/include"
at the front of the gcc command to test.

Alternatively, you could build a small C routine and compile it with the built-in "cc" command just to see that the functions are available.

Good luck,


Ollie.
To err is human but to not award points is unforgivable
H.Merijn Brand (procura
Honored Contributor

Re: gcc on HPUX 11i. Question.

Where did you get gcc-3.2?
Did you use it to *rebuild* it itself on your own system? (you should)

Read instructions on https://www.beepz.com/personal/merijn (but don't get the gcc from there for 11i, it's an 11.00 port that prooved not to work on 11i)
Enjoy, Have FUN! H.Merijn
Andrew E. Malone
Occasional Contributor

Re: gcc on HPUX 11i. Question.

Thanks Ollie and Procura,

I have verified the location of pwd.h. My search path finds it without issue.
Here is the full command line and its results. I have clean installed gcc 3.1 and 3.2 from both hp and the porting center from depot and compiled without changing the error. I tested a program using calls to the pwd.h library without issue. (Ran fine).
Thanks for any and all insights.

eg.
gcc -v -I . -I /opt/java1.4/include -I /opt/java1.4/include/hp-ux UnixIO.cc
Reading specs from /usr/local/pa20_64/lib/gcc-lib/hppa64-hp-hpux11.00/3.2/specs
Configured with: ../gcc/configure --prefix=/usr/local/pa20_64 --enable-languages=c,c++ --host=hppa64-hp-hpux11.00 --target=hppa64-hp-hpux11.00 --with-ld=/usr/ccs/bin/ld --with-gnu-as --enable-libstdcxx-v3 --disable-checking
Thread model: single
gcc version 3.2 20020708 (experimental)
/usr/local/pa20_64/lib/gcc-lib/hppa64-hp-hpux11.00/3.2/cc1plus -quiet -v -I . -I /opt/java1.4/include -I /opt/java1.4/include/hp-ux -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=0 -Dhppa -Dhp9000s800 -D__hp9000s800 -Dhp9k8 -DPWB -Dhpux -Dunix -D__hppa__ -D__hp9000s800__ -D__hp9000s800 -D__hp9k8__ -D__PWB__ -D__hpux__ -D__unix__ -D__hppa -D__hp9000s800 -D__hp9k8 -D__PWB -D__hpux -D__unix -Asystem=unix -Asystem=hpux -Acpu=hppa -Amachine=hppa -D_HPUX_SOURCE -D_HIUX_SOURCE -D__STDC_EXT__ -D_INCLUDE_LONGLONG -D_PA_RISC1_1 -D__hp9000s700 -D_PA_RISC2_0 -D__hp9000s800 -D__LP64__ UnixIO.cc -D__GNUG__=3 -D__DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -quiet -dumpbase UnixIO.cc -version -o /var/tmp//ccswuqjh.s
GNU C++ version 3.2 20020708 (experimental) (hppa64-hp-hpux11.00)
compiled by GNU C version 3.2 20020708 (experimental).
ignoring nonexistent directory "/usr/local/pa20_64/hppa64-hp-hpux11.00/include"
#include "..." search starts here:
#include <...> search starts here:
.
/opt/java1.4/include
/opt/java1.4/include/hp-ux
/usr/local/pa20_64/include/c++/3.2
/usr/local/pa20_64/include/c++/3.2/hppa64-hp-hpux11.00
/usr/local/pa20_64/include/c++/3.2/backward
/usr/local/include
/usr/local/pa20_64/include
/usr/local/pa20_64/lib/gcc-lib/hppa64-hp-hpux11.00/3.2/include
/usr/include
End of search list.
UnixIO.cc: In function `int set_all(const char*, const char*, const char*, int)
':
UnixIO.cc:25: error: `getpwnam_r' undeclared (first use this function)
UnixIO.cc:25: error: (Each undeclared identifier is reported only once for each
function it appears in.)
UnixIO.cc:31: error: `getgrnam_r' undeclared (first use this function)
UnixIO.cc: In function `char* get_all(const char*)':
UnixIO.cc:59: error: `getpwuid_r' undeclared (first use this function)
UnixIO.cc:61: error: `getgrgid_r' undeclared (first use this function)
H.Merijn Brand (procura
Honored Contributor

Re: gcc on HPUX 11i. Question.

Would

# gcc -L/usr/lib -lc_r ...

help? It's looking for *reentrant* versions of getpwnam (), getpwuid (), and such (which - of course - is only important if you have thread support.

If you do not need threads, or don't want them, just remove the _r parts of the function calls. Look at the man pages for the implications
Enjoy, Have FUN! H.Merijn