Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
07-08-2003, 12:53 AM
|
#1
|
Senior Member
Registered: May 2003
Location: Malaysia
Distribution: Slackware, LFS, CentOS
Posts: 1,307
Rep:
|
binutils: from the book 4.1
There is something stated regarding binutils which goes like this:
Quote:
This package is known to behave badly when you have changed its default optimization flags (including the -march and -mcpu options). Therefore, if you have defined any environment variables that override default optimizations, such as CFLAGS and CXXFLAGS, we recommend unsetting or modifying them when building binutils.
|
I'm having problems compiling binutils, I can't recall the error right now because I'm at work.
But can someone explain to me what CFLAGS and CXXFLAGS are and how do I go about unsetting their default values (and setting them back again after successfully compiling binutils)?
Thanks in advance.
|
|
|
07-08-2003, 01:23 PM
|
#2
|
Senior Member
Registered: Jan 2003
Posts: 2,786
|
I'm afraid I don't know what CFLAGS and CXXFLAGS control except that they influence how a package is compiled.
You can find out what they contain just like any other environment variable. Just type:
echo $CFLAGS
echo $CXXFLAGS
If you don't get any output or get an 'undefined' message, they aren't set to anything. If they do have something in them, then write it down. To remove their contents, type:
unset CFLAGS CXXFLAGS
After you compile, you can put them back by typing this:
export CFLAGS=old_cflags_value
export CXXFLAGS=old_cxxflags_value
What's the text of the error you're getting?
|
|
|
07-08-2003, 11:03 PM
|
#3
|
Member
Registered: Nov 2002
Location: Melbourne, Australia
Distribution: (C)LFS (x86_64, ix86, sparcv9, ppc)
Posts: 122
Rep:
|
Those flags are used to supply additional options to the compilers pre-processor linker etc.
CFLAGS is used by the c compiler
CXXFLAGS is used by the c++ compiler
LDFLAGS are passed to the linker
CPPFLAGS are passed to the c preprocessor
Anything set in these environment variables will be added to the gcc command line during compilation.
Best check the gcc doco for the myriad of options you can use.
Most common for CFLAGS/CXXFLAGS is specifying an optimisation level ( -O2 ), forcing gcc to comunicate via a pipe instead of creating files ( -pipe ) setting architecture ( -march=blah ) setting cpu ( -mcpu=blah ) specifying locations to search for headers ( -I/opt/include )
LDFLAGS is used to pass options when the linker is invoked, commonly used are stripping debugging symbols ( -s ), compiling statically ( -static ) and many many more.
Binutils CFLAGS ARE best left alone, but you are pretty safe if you only use CFLAGS="-O2 -pipe"
Most likely you won't have any CFLAGS etc set in your environment anyway if you have a relatively standard .profile/.bash_profile/.cshrc
|
|
|
07-09-2003, 09:53 PM
|
#4
|
Senior Member
Registered: May 2003
Location: Malaysia
Distribution: Slackware, LFS, CentOS
Posts: 1,307
Original Poster
Rep:
|
Thanks guys... anyway, I restarted from my LFS attempt again. But again, I'm thankful that you explained to me the meaning of these flags.
Much appreciated.
So far everything is working out much better than my first attempt.
|
|
|
All times are GMT -5. The time now is 04:40 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|