There is gcc but doesn't work !!

gcc packages are installed as is seen.

# pkginfo | grep -i gcc
system      SUNWgcc                          gcc - The GNU C compiler
system      SUNWgccruntime                   GCC Runtime libraries
# 

There is gcc in /usr/sfw/bin but It doesn't work.

# gcc
bash: gcc: command not found

#

# pwd
/usr/sfw/bin
# ls -l gcc
-r-xr-xr-x   3 root     bin       106432 Jan 23  2005 gcc
#
# whereis gcc
gcc:
#
#whereis ssh
ssh: /etc/ssh  /usr/bin/ssh  /usr/lib/ssh  /usr/man/man1/ssh.1
#

I can run like below but I am trying install sudo-1.8.1 but it have given an error messages.

# /usr/sfw/bin/gcc
gcc: no input files

#

How can I do for properly working gcc.

# /sudo/sudo-1.8.1/./configure
configure: Configuring Sudo version 1.8.1
checking for gcc... no  
checking for cc... no
checking for cl.exe... no
configure: error: in `/usr/sfw/bin':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.

#

gcc no input files just means you did not give the compiler any files to compile :), but it proves your gcc is working, so nothing wrong with gcc.

Do this on your shell, once you login:

export PATH=$PATH:/usr/sfw/bin

once you set the path above, run configure again. It should work.

1 Like

Thanks dude gcc is working now.
Why command of whereis doesn't give properly output like ssh

# whereis ssh
ssh: /etc/ssh /usr/bin/ssh /usr/lib/ssh /usr/man/man1/ssh.1
bash-3.00# whereis gcc
gcc:
# 

And also I need package of ar which name is SUNWbtool.

configure: error: the "ar" utility is required to build sudo

because whereis is for finding things which aren't in the default PATH. From man whereis:

FILES
       /{bin,sbin,etc}

       /usr/{lib,bin,old,new,local,games,include,etc,src,man,sbin,
                           X386,TeX,g++-include}

       /usr/local/{X386,TeX,X11,include,lib,man,etc,bin,games,emacs}

It checks tons of weird places, but Sun is weird enough to defeat it.

Q1:
echo $PATH is restoration when I reboot the machine.

# echo $PATH
/usr/sbin:/usr/bin

How can I set as permanently.

Q2:
I have installed SUNWbtool for "ar" utility. But I have given same error messages when press to ./configure

configure: error: the "ar" utility is required to build sudo

What is ar utility?

Q1
Edit /etc/profile for general PATH for all users or the <homedir>/.profile for your current user.

The ar utility is used to build .a files in compilation, which contain several .o files.

see if you can find 'ar' under /usr/ccs/bin, that is where Solaris will have it.

To get both gcc and ar for your configure,

export PATH=$PATH:/usr/ccs/bin:/usr/sfw/bin
OR
Like Vidanez in a post above, to make it permanent Add it to /etc/profile.