LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Solaris / OpenSolaris (https://www.linuxquestions.org/questions/solaris-opensolaris-20/)
-   -   GCC compiler check! (https://www.linuxquestions.org/questions/solaris-opensolaris-20/gcc-compiler-check-798580/)

r_titino 03-29-2010 03:05 AM

GCC compiler check!
 
Hi Every one,
can someone tell me how i can check whether there is a valid C compiler ! thanks

GrapefruiTgirl 03-29-2010 03:06 AM

Code:

shell# $(which gcc) --version
should get you some results if you have gcc installed.

Sasha

r_titino 03-30-2010 02:35 AM

thanks Sacha,
i 've run the cmd that u posted but i've got a command not found response ! Additional information i am facing the problem on Solaris !

GrapefruiTgirl 03-30-2010 04:41 AM

I have requested that this thread be moved to the /Solaris forum, so that it gets the attention it deserves.

Sasha

jlliagre 03-30-2010 06:30 AM

A common case with Solaris is that there is a valid C compiler installed (or even more) but none is available on the PATH.

Usual locations to look for are:
Code:

/opt/*/bin/cc
/usr/sfw/bin/gcc
/usr/gnu/bin/cc
/usr/local/bin/gcc


r_titino 03-30-2010 08:01 AM

thanks, i found the files at the Locations u suggested but when i am trying to run a C compiled script i get the"configure: error: no acceptable C compiler found in $PATH", Any Help ! thanks

jlliagre 03-30-2010 08:06 AM

Did you update your PATH before running "configure" ?

r_titino 04-05-2010 02:54 AM

hi , I am not able to find the "path= " in the configure file !any Idea? thans

jlliagre 04-05-2010 08:52 AM

PATH is not something you'll find in the configure script but an environment variable you set and export in your shell before running configure.

r_titino 04-05-2010 10:35 AM

hi , i updated the path but still i am not getting any success! Note: the added path were : /usr/sfw/bin/gcc and /usr/local/bin/gcc (there were only available) thanks!

Blinker_Fluid 04-05-2010 11:30 AM

So did you add the gcc path or the directory GCC is in?

PATH=$PATH:/usr/sfw/bin

r_titino 04-06-2010 01:31 AM

Thanks i found that i had add the whole path not the Directory is in ! after adding the "PATH=$PATH:/usr/sfw/bin" i was able to compile but later on when i run the commande make i got the resuldts bellow, thanks for your help !:
gcc: language strconst not recognized
gcc: check_mysql.c: linker input file unused because linking not done
mv -f .deps/check_mysql-check_mysql.Tpo .deps/check_mysql-check_mysql.Po
mv: cannot access .deps/check_mysql-check_mysql.Tpo
*** Error code 2
make: Fatal error: Command failed for target `check_mysql-check_mysql.o'
Current working directory /tmp/nagios-plugins-1.4.14/plugins
*** Error code 1
The following command caused the error:
failcom='exit 1'; \
for f in x $MAKEFLAGS; do \
case $f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo all-recursive | sed s/-recursive//`; \
list='gl tap lib plugins plugins-scripts plugins-root po'; for subdir in $list; do \
echo "Making $target in $subdir"; \
if test "$subdir" = "."; then \
dot_seen=yes; \
local_target="$target-am"; \
else \
local_target="$target"; \
fi; \
(cd $subdir && make $local_target) \
|| eval $failcom; \
done; \
if test "$dot_seen" = "no"; then \
make "$target-am" || exit 1; \
fi; test -z "$fail"
make: Fatal error: Command failed for target `all-recursive'
Current working directory /tmp/nagios-plugins-1.4.14
*** Error code 1
make: Fatal error: Command failed for target `all'

r_titino 04-06-2010 09:23 AM

Any i dea on how i can successful the command "make all" refering on the error i posted above! thanks

choogendyk 04-08-2010 08:39 PM

This is getting a bit complicated, because you aren't giving much detail at any given point, so the questions and answers are stretching out over many posts.

I would suggest a couple of things. First, tell us what it is that you are trying to do and why. Give us some background on where you are starting from -- the system you have and your own background.

Then, I would probably suggest that you go to http://www.sunfreeware.com and get packages from there unless you have some particular reason you want/need to build your own. If you do need to build your own, then you might start by getting all the build tools you need from Sunfreeware. This also has the advantage that the entries there will tell you all the dependencies so that you know what other things you have to get and install.

Finally, if you do get into building your own stuff from source, you will want to have a proper environment. This will depend on your particular system and needs. I have some E250s running Solaris 9, and I have a file /usr/local/src/env that contains the following:

Code:

#!/bin/ksh
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/ucb:/usr/ccs/bin
export PATH
LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/usr/sfw/lib
export LD_LIBRARY_PATH
CPPFLAGS="-I/usr/local/include"
export CPPFLAGS
CFLAGS="-L/usr/local/lib -R/usr/local/lib"
export CFLAGS
LDFLAGS="-L/usr/local/lib -R/usr/local/lib"
export LDFLAGS
CC=gcc
export CC

When I'm going to be building something, I start out by doing

$ . /usr/local/src/env

That syntax (note that there is a space after the dot) makes it execute that code in place in your current environment rather than making a subprocess. Thus, the environment variables are set.

I have some other systems that are T5220s running Solaris 10, and I'm using the Sun CoolTools gccfss compiler. That build environment is a bit more complex and the env file is different. I need to build things there that will tap the unique capabilities of the T2 chip and get me into the crypto accelerators if I'm building something that needs them.

Also, for whatever you are building, the Makefile should tell you what environment variables it respects -- for example, certain values for CPPFLAGS. Check that if you need to. But, be sure to look at the files README and/or INSTALL that come along with the source.

HTH

mn35 04-10-2010 03:44 AM

Dear r_titino,
I agree with choogendyk, and is this your code or is it a download in the first place?

and what are you checking on mysql ? if you want to check if it is running: # ptree | grep mysql
( I do this for sybase).

Jiliagre,
I am working on Solaris 8, and it was there when i came, i dont know its history, how can i know if gcc is installed (its is not found on the paths you mentioned above) # > man gcc doesn't give anything.

I have cc in /usr/ucb/cc

do i download gcc, compile it with cc then use it ?

choogendyk 04-10-2010 08:36 AM

mn35,

Simple, brute force:

# find / -type f -name gcc

If it isn't there, go to http://www.sunfreeware.com and get it. You should also get the gnu tools that go with it -- make (the gnu version), automake, autoconf, and whatever dependencies they call for.

jlliagre 04-10-2010 12:30 PM

Quote:

Originally Posted by mn35 (Post 3930732)
I am working on Solaris 8, and it was there when i came, i dont know its history, how can i know if gcc is installed (its is not found on the paths you mentioned above)

Then, it's probably not installed but choogendyk method will tell you for sure.
Quote:

man gcc doesn't give anything.
This isn't a reliable test as manual pages won't be in the MANPATH anyway.
Quote:

I have cc in /usr/ucb/cc

do i download gcc, compile it with cc then use it ?
No, forget about /usr/ucb/cc which is there for historical reason (BSD compatibility for SunOS 4 users in the nineties) and is then of no use for you.

mn35 04-12-2010 12:54 AM

I dont have it. :S

Thanks


All times are GMT -5. The time now is 12:15 AM.