GCC questions
Alejandro Aragon
alejandro.aragon at gmail.com
Fri Mar 21 09:49:06 PDT 2008
Hello everyone,
I have several questions about using a different version of GCC than
that provided by default:
$ gcc -v
Using built-in specs.
Target: i686-apple-darwin9
Configured with: /var/tmp/gcc/gcc-5465~16/src/configure --disable-
checking -enable-werror --prefix=/usr --mandir=/share/man --enable-
languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/
$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/
lib --build=i686-apple-darwin9 --with-arch=apple --with-tune=generic --
host=i686-apple-darwin9 --target=i686-apple-darwin9
Thread model: posix
gcc version 4.0.1 (Apple Inc. build 5465)
I built GCC43 and I have it under /opt/local/bin. I write code in C++
and I'm new to mac. I come from Ubuntu Linux, and it installs the
latest GNU compiler by default. Now the questions are:
1. I use autotools for a project, so I can specify in the configure
script that the compiler be different from the default found in /usr/
bin using compiler flags: $./configure CXX=/opt/include/bin/g++-
mp-4.3. Is there a better way to do this? I wonder what's usually
done. I see that g++ in /usr/bin is just a link to /usr/bin/g++-4.0.
If I change that link to point to the 4.3 version, I would probably
mess around with the system and I don't want to do that. Can anyone
give me suggestions on what to do here?
2. Every time you #include a C++ header, I guess it looks under the /
usr/include directory first. Even if I specify that I want the
directory as a compilation flag as -I/opt/local/include/gcc43/c++/, I
don't think that the file under that directory will be picked instead
of the one installed in the system by default (/usr/include/c++/
4.0.0). I'm worried that I am using a newer gcc compiler with older
header files.
3. When I type echo $PATH I get
/sw/bin:/sw/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/
sbin:/sbin:/usr/local/bin:/usr/texbin:/usr/X11/bin:/usr/X11R6/bin
so I guess whatever installed using macports will have priority over
anything else. Is there a way to accomplish the same with include paths?
Thank you all,
aa
More information about the macports-users
mailing list