Solved compiler {mb small question}

Hallo, friends :)
sorry for my noob thread, but I didn't find answer in any manual... if you know where it is wrote please tell me )))
So if I have two compilers in my system (like clang & gcc in 9.0), how can I know what compiler using by default?
Code:
cc -v 
Using built-in specs.
Target: i386-undermydesk-freebsd
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 4.2.1 20070831 patched [FreeBSD]
does this command mean that default is gcc?
this knowlage don't conserned whit any practice... just interesting
 
Hi,

From your message it looks like gcc, I never used clang. I maybe give this a try:

which cc
which gcc
which clang (?)
(use type instead of which for sh/bash/ksh)
then then do ls -li against the results to see what you get.

for me:
which cc -- gives /usr/bin/cc
which gcc -- gives /usr/bin/gcc
ls -li /usr/bin/cc
returns:
Code:
942102 -r-xr-xr-x  2 root  wheel  415480 Feb 16  2011 /usr/bin/cc
942102 -r-xr-xr-x  2 root  wheel  415480 Feb 16  2011 /usr/bin/gcc
That tells that cc is gcc.

HTH
Jack
 
Thanks, but this didn't show for me nothing else cc, gcc, clang in /usr/bin/. Isn't there a simple way? Although like
Code:
make -bla
blalalalala ..... "there is compilation with clang" ...... blalalala
:e
 
Hi

From what I see above, seems you are using gcc.

Assuming cc, gcc and clang exist in /usr/bin on your system. The only ways I can think of to tell what cc points to is one of the following:

1. execute
$ cc --version
which is similar to what you did in your first post. I think arg '--version' is used by all GNU binaries. I get:
Code:
cc (GCC) 4.2.1 20070719  [FreeBSD]
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
So I am using gcc. should have posted this before but I was quite tired then :)

2. Or try:
$ cd /usr/bin
$ ls -li cc gcc clang
I get:
Code:
ls: clang: No such file or directory
942102 -r-xr-xr-x  2 root  wheel  415480 Feb 16  2011 cc
942102 -r-xr-xr-x  2 root  wheel  415480 Feb 16  2011 gcc
The # '942102' is the inode, it tells me gcc and cc are the same exact file.

Jack

PS: your english seems fine to me
 
thank you, jmccue, a lot )))
somehow nobody wonts help me =( just U and this man in facebook:
Alexander Necheff By default FreeBSD will use gcc. Try running this to see if anything is set as default: ~$ echo $CC

you can set a different C compiler as default by adding something like this to your shell's rc files (/home/user_name/.tcshrc for just you or for system wide /etc/profile and /etc/tcshrc):
set CC=clang;

then run: ~$ mv /usr/bin/cc /usr/bin/cc.OLD
~$ ls -s /usr/bin/cc /usr/bin/clang

this will ensure clang is preferred over gcc as the system's C compiler. though some poorly written make scripts will need to be manually edited to support other compilers.

I comes to the same conslution the day before when I decided to recompile my system with this strings in make.conf:
Code:
WITHOUT_GCC=yes
WITHOUT_GNU_SUPPORT=yes

So after a three hours of compilation i saw:
Code:
lint: cannot exec /usr/obj/usr/src/tmp/usr/bin/cc:
No such file or directory
*** Error code 1
Stop in /usr/src/usr.bin/xlint/llib
Error code 1
.....
Error code 1

yep! I read BuildingFreeBSDWithClang

urhhrhrhhr ((
can I have clang and any other compiler?
 
Back
Top