LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-20-2015, 09:52 PM   #1
roLancaster01
LQ Newbie
 
Registered: Jun 2014
Location: Albuquerque, NM
Distribution: ArchLinux
Posts: 2

Rep: Reputation: Disabled
Post Discussion: GCC compilation and Questions


OS: Arch-Linux
Kernel: 4.2.5-1

GCC:5.3.0 & 5.1.0 <--(as of 20:11 MST 2015.12.20)

Processor: AMD A10-7300 Radeon R6, 10 compute cores 4c+6G

-------------------------------------------------------------

This post's purpose is to fill a gap for me and perhaps anyone out there that might have some of these questions but have had the difficulies in finding answers and information on the Internet: that is, compiling Gcc and its' various options. Hopefully, this could grow into something very useful for people like me that enjoy the challange and tend to do things the hard way.

This started with my need to install an earlier version of Gcc to suit the recommendations of the current LFS project; I have in working order Gcc-5.3.0 provided by my distrubtion-install. I have some experience from a couple of classes and hours of varied levels of success and failures with building from source.

A) Target
===========

I am attempting to build gcc-5.1.0 for a laptop that utilizes an AMD processor which I have listed above. My first attempt to build this compiler resulted in an output from 'uname -p' as unknown. I am certain that this is the target which the configure process provides by default, as per the GNU website https://gcc.gnu.org/install/configure.html which states the following under "Target Specification" :
Quote:
GCC has code to correctly determine the correct value for target for nearly all native systems.
Also, a comment found here at http://unix.stackexchange.com/questi...-in-arch-linux where user Wieland states
Quote:
it sounds like the information provided by that field is more of informational nature and unknown is just the default value GCC uses unless explicitly overwritten.
which supports the same.

However, therein are examples of output with specific and "complete" names of machines: x86_64-linux-gnu, x86_64-pc-linux-gnu, etc. Is the solution for disambiguation using the flag '--target'? I understand that the gcc.gnu.org specifically advises NOT to use this option:

Quote:
Therefore, we highly recommend you do not provide a configure target when configuring a native compiler.
Is there a way to use it safely? If the compiler has code to correctly identify the target, then why is my target listed as unknown? Would a valid designation, then, be '--target=x86_64-arch-linux-gnu', considering my distribution Arch-Linux?

If the solution is a simple as providing the option as above, then I have trouble reconciling the purpose of the list of target/host entries provided here for reference: https://gcc.gnu.org/install/specific.html. Regarding this list, which one of these entries referrs to my processor listed above? I supsect it is the x86_64 or amd64 entry because I know my machine is not solaris and when I execute 'uname -m, the output is 'x86_64'. Incidently, are there any other ways that can confirm this for me?

B) Options
===========

If the target name provides a vital purpose in distinguishing the kind of machine for which the compilier produces code, setting-up the compilation environment for that particular machine to ensure success in compilation, etc, what then is the difference between specifying '--target' and '--with-cpu'? Both flags relate to idnentifying systems with computer architecture in mind, but in implementation, what would sucessfully using '--with-cpu' flag do? If '--target ' and '--with-cpu' are interchangable, then which of these options would be better - for lack of a better word - to use?

Would I be correct to assume that a valid argument for option '--with-cpu' coud be '--with-cpu=amd64'? If it is not a valid argument, what the, could be a valid one given the processor listed above?; is ther a list that anyone knows of that provides this sort of information? My next guess would be x86)_64 simply because of the output provided by uname and because of this statement from https://gcc.gnu.org/install/configure.html:

Quote:
...these options are only supported for i386, x86-64 and PowerPC.
, to indicate a few of the possible arguments for the "--with-*" line of options listed on that page.

Please, anyone with any guidance, knowledge, experience: welcome; I am looking to learn and to be challanged.
 
Old 12-21-2015, 03:59 PM   #2
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
You need full names if you do cross-compiling. You do not want x86_64-pc-linux-gnu called when you build for ARM, for instance.
With GCC versions later than 4.3 you do not need to specify the CPU you are building for. All you need is -march=native in your CFLAGS (and CXXFLAGS). The code will be optimized for your CPU (it will not run on a different CPU).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
LXer: Compilation Times, Binary Sizes For GCC 4.2 To GCC 4.8 LXer Syndicated Linux News 0 03-17-2013 04:31 PM
gcc (GCC) 4.3.2 20081105 (Red Hat 4.3.2-7) compilation error adhesh_19 Red Hat 0 01-05-2010 05:34 AM
have gcc compilation error during gcc installtion in linuxfromscratch vbshanmugaprakash Linux - General 3 12-13-2006 05:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:59 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