LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
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


Reply
  Search this Thread
Old 07-08-2003, 12:53 AM   #1
Azmeen
Senior Member
 
Registered: May 2003
Location: Malaysia
Distribution: Slackware, LFS, CentOS
Posts: 1,307

Rep: Reputation: 47
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.
 
Old 07-08-2003, 01:23 PM   #2
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
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?
 
Old 07-08-2003, 11:03 PM   #3
mdh
Member
 
Registered: Nov 2002
Location: Melbourne, Australia
Distribution: (C)LFS (x86_64, ix86, sparcv9, ppc)
Posts: 122

Rep: Reputation: 16
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
 
Old 07-09-2003, 09:53 PM   #4
Azmeen
Senior Member
 
Registered: May 2003
Location: Malaysia
Distribution: Slackware, LFS, CentOS
Posts: 1,307

Original Poster
Rep: Reputation: 47
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Slackware book purchase vs. URL: http://www.slackware.org/book/ jtp51 Slackware 5 11-28-2004 04:30 PM
Installation of binutils....can't mkdir...../binutils-build hmonster Linux From Scratch 6 08-22-2004 04:07 AM
Binutils Scratchit Linux - Newbie 11 06-30-2004 01:19 AM
beyond lfs book not available??? or no such book?? tuxfood Linux From Scratch 2 04-17-2004 04:12 PM
Contents of Binutils, Book 4.1, Ch 5.8, missing .so files itsjustme Linux From Scratch 1 07-22-2003 07:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration