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 04-09-2006, 05:38 AM   #1
binarybob0001
Member
 
Registered: Dec 2004
Distribution: Debian Wheezy
Posts: 444

Rep: Reputation: 30
Compiling for pentium4?


I'm trying to figure out how to compile for the pentium4. I think I just have to type:
export CFLAGS="-march=pentium4 -O3"
I'm turning on full optimization too. How do I make sure I'm really compiling for the pentium4? Is there a test, or do I just need to compile the app and run it?
 
Old 04-09-2006, 10:07 PM   #2
d0odman
Member
 
Registered: Sep 2004
Location: CA, USA
Distribution: Slackware 10.2
Posts: 132

Rep: Reputation: 15
The configure scripts, if the software package comes with them, take care of all that. There's usually no need to export a CFLAGS variable, unless the documentation of the software tells you to.
 
Old 04-09-2006, 11:57 PM   #3
binarybob0001
Member
 
Registered: Dec 2004
Distribution: Debian Wheezy
Posts: 444

Original Poster
Rep: Reputation: 30
OK... how would I check what architecture the files were compiled for? The reason I ask, is because I am making packages and wish to name them properly. Not to mention, optimized code for a processor runs faster than non-optimized code. I want to be able to compile for different architectures if necessary and check what architecture I actually got.
 
Old 04-10-2006, 12:05 AM   #4
Alien_Hominid
Senior Member
 
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
In Slackware packages architecture is mentioned in the packages names like i386, i686 and so on. Same tradition is often used in other package management systems like rpm.
 
Old 04-10-2006, 12:16 AM   #5
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
Quote:
Originally Posted by d0odman
The configure scripts, if the software package comes with them, take care of all that. There's usually no need to export a CFLAGS variable, unless the documentation of the software tells you to.
no this is not true the configure scripts use your CFLAGS and CXXFLAGS
or fall back on lame ass defaults.

i have done extensive benchmarking with my P4 and i use this
in my ~/.bash_profile
Code:
export CFLAGS='-march=pentium4 -O3 -funroll-loops -ftracer -momit-leaf-frame-pointer -fprefetch-loop-arrays'
export CXXFLAGS=$CFLAGS
for the rare instances when this causes runtime problems you just go back and
unset CFLAGS
unset CXXFLAGS
 
Old 04-10-2006, 12:48 AM   #6
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
I recommend leaving -momit-leaf-frame-pointer out unless you like scratching your head all day figuring out what is the problem. By leaving out -momit-leaf-frame-pointer you get descriptive debug messages that you can use to fix your setup. Also -O3 can break some programs. I suggest using- O2 as the highest optimize value because it minimize unusual problems.

A Pentium 4 is an 80786 or i786, so a 80686 will not be able to run the program.
 
Old 04-10-2006, 01:11 AM   #7
binarybob0001
Member
 
Registered: Dec 2004
Distribution: Debian Wheezy
Posts: 444

Original Poster
Rep: Reputation: 30
Thanks guys, this is getting much better. Well, I don't know how to debug yet, so I don't see how an error message would help me. I have done a lot of C++ in Windows but the projects I have seen for linux are so big, so complex that I have a time finding the starting point. I would love to learn to program in X or KDE. I know the difference between the two, but I don't know if there is a difference when you program in X versus programming in KDE. I can't find any documents for the strict C API of either really. I found some for X but KDE nothing.

Well, do you guys know of a way to test if the program was really compiled in 786 or not?
 
Old 04-10-2006, 01:54 AM   #8
d0odman
Member
 
Registered: Sep 2004
Location: CA, USA
Distribution: Slackware 10.2
Posts: 132

Rep: Reputation: 15
Quote:
Originally Posted by foo_bar_foo
no this is not true the configure scripts use your CFLAGS and CXXFLAGS
or fall back on lame ass defaults.
What I was trying to point out, was that it's optional to set both of these variables. A lot of the time, mere mortal users don't need to fool with these for a run of the mill compilation (lame ass defaults, as you say), unless they're doing something according to some howto they've seen somewhere or something.
 
Old 04-10-2006, 08:03 PM   #9
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
Quote:
Originally Posted by binarybob0001
Thanks guys, this is getting much better. Well, I don't know how to debug yet, so I don't see how an error message would help me. I have done a lot of C++ in Windows but the projects I have seen for linux are so big, so complex that I have a time finding the starting point. I would love to learn to program in X or KDE. I know the difference between the two, but I don't know if there is a difference when you program in X versus programming in KDE. I can't find any documents for the strict C API of either really. I found some for X but KDE nothing.

Well, do you guys know of a way to test if the program was really compiled in 786 or not?
Read my previous post. An 80686 or lower will not run an 80786 program.

Configuring and compiling KDE programs takes different steps than compiling GTK or wxWidget programs. KDE programs use qmake (I think). I do not recommend making any KDE programs because it is way too bloated. Write either GTK or wxWidget programs.

You can try use Eclipse to help you oragnize a big program.
 
Old 04-11-2006, 12:18 AM   #10
binarybob0001
Member
 
Registered: Dec 2004
Distribution: Debian Wheezy
Posts: 444

Original Poster
Rep: Reputation: 30
Oh, I read your previous post, but I was hoping to test it without the need for an 80686 process. I don't have one test it on.

Thanks a lot, you have given me some excellent tips.
 
Old 04-11-2006, 01:13 AM   #11
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
Quote:
Originally Posted by Electro
Read my previous post. An 80686 or lower will not run an 80786 program.
I recommend leaving -momit-leaf-frame-pointer out unless you like scratching your head all day figuring out what is the problem.
Also -O3 can break some programs.
twilight zone again in LQ land (this has been the norm lately -- quite a shame really)
thus onward to the rebuttal in the reality matters wars.

why would we want to run code compiled for other than exactly the cpus we have ?
a processor feature is a terrible thing to waste.
next P4 is a class 80686 -- Itanium 64 bit is the first intell 80786 class processor
next from gcc docs
Quote:
-momit-leaf-frame-pointer
Don't keep the frame pointer in a register for leaf functions. This avoids the instructions to save, set up and restore frame pointers and makes an extra register available in leaf functions.
-fomit-frame-pointer
removes the frame pointer for all functions which might make debugging harder.
why people make assertions here about this kind of stuff when they don't know what they are talking about i will never understand.
yea my optimization flags broke at most 3 packages on my entire system which took all of 10 minutes to correct.
check out this extreem case of math overhead improvement
with -O2
Arithmetic Test (type = arithoh) 13439624.3 lps (10 secs, 6 samples)
with the flags i put earlier
Arithmetic Test (type = arithoh) 182031243.1 lps (10 secs, 6 samples)
thats over 1000% faster !
isn't that worth 10 minutes effort ?
can you make enough money in 10 minutes to buy a cpu thats 1000% faster than the one you have now ?
anyway i also really like Qt/KDE as a programming environment.
KDE might seem bloated however if you use an instruction set from 1983.
people often talk of wasting unused RAM. how about wasting unused cpu features.

here are the KDE docs

http://developer.kde.org/documentation/library/

Last edited by foo_bar_foo; 04-11-2006 at 01:16 AM.
 
Old 04-11-2006, 02:52 AM   #12
daihard
Member
 
Registered: Jul 2003
Location: Seattle, WA
Distribution: Kubuntu 14.04 LTS
Posts: 915

Rep: Reputation: 34
Quote:
Originally Posted by Electro
Configuring and compiling KDE programs takes different steps than compiling GTK or wxWidget programs. KDE programs use qmake (I think). I do not recommend making any KDE programs because it is way too bloated. Write either GTK or wxWidget programs.
"qmake" is one of the tools that come with Qt, the toolkit KDE is based upon. Running "qmake" will generate all the necessary project files and makefiles for your source files depending upon the platform. Qt is a multi-platform SDK, which means you can maintain a single source tree and create GUI applications for multiple platforms; i.e. Windows, Linux, UNIX and Mac OS X.

I don't know much about GTK, but I have written code for both Qt and wxWidget (and I still work with Qt). If you ask me, Qt is much cleaner and easier to work with. It is my opinion that Qt is very well designed. You can write either "barebone" Qt apps or KDE apps using Qt. KDE apps use KDE-specific components and therefore require the base KDE components to be installed; Qt apps only require the Qt library and is therefore much more lightweight.
 
Old 04-11-2006, 03:09 AM   #13
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
Quote:
Originally Posted by foo_bar_foo
twilight zone again in LQ land (this has been the norm lately -- quite a shame really)
thus onward to the rebuttal in the reality matters wars.

why would we want to run code compiled for other than exactly the cpus we have ?
a processor feature is a terrible thing to waste.
next P4 is a class 80686 -- Itanium 64 bit is the first intell 80786 class processor
next from gcc docs

why people make assertions here about this kind of stuff when they don't know what they are talking about i will never understand.
yea my optimization flags broke at most 3 packages on my entire system which took all of 10 minutes to correct.
check out this extreem case of math overhead improvement
with -O2
Arithmetic Test (type = arithoh) 13439624.3 lps (10 secs, 6 samples)
with the flags i put earlier
Arithmetic Test (type = arithoh) 182031243.1 lps (10 secs, 6 samples)
thats over 1000% faster !
isn't that worth 10 minutes effort ?
can you make enough money in 10 minutes to buy a cpu thats 1000% faster than the one you have now ?
anyway i also really like Qt/KDE as a programming environment.
KDE might seem bloated however if you use an instruction set from 1983.
people often talk of wasting unused RAM. how about wasting unused cpu features.

here are the KDE docs

http://developer.kde.org/documentation/library/
You are wrong that Pentium 4 are 80686. They are 80786. Go to http://en.wikipedia.org/wiki/80786

A smart programmer will revise his or her program to make it 10,000 times faster and still be able to use -O2. You can use -O3 but you will not be able to post reliable bug reports. I am going to use -O2 because I want to post bug reports and have a reliable setup.

What I mean KDE is bloated is because it loads too much junk that is not needed. It is like loading MS Office's DLL files even though I'm not going to use Word, Exel, Powerpoint, Access today. The DLL files are taking up CPU resources. wxWidgets and GTK are much better for GUI applications because they are several times quicker than KDE programs because they use less processor resources.

I do not know what you are talking about KDE uses features from the processor. That is load of bull.
 
Old 04-11-2006, 03:34 AM   #14
daihard
Member
 
Registered: Jul 2003
Location: Seattle, WA
Distribution: Kubuntu 14.04 LTS
Posts: 915

Rep: Reputation: 34
Quote:
Originally Posted by Electro
What I mean KDE is bloated is because it loads too much junk that is not needed. It is like loading MS Office's DLL files even though I'm not going to use Word, Exel, Powerpoint, Access today. The DLL files are taking up CPU resources. wxWidgets and GTK are much better for GUI applications because they are several times quicker than KDE programs because they use less processor resources.
Like I said above, wxWidgets is much harder to learn and use than Qt. To me, it is very important to provide a programming environment that is easy to learn and use - that will in turn reduce the number of bugs introduced. The only library (or "DLL") required by Qt is libqt-mt.so (or qt-mtxxx.dll for Windows, where xxx is the version number). If you do feel that KDE apps are bloated, try Qt without using the KDE-specific features.
 
Old 04-11-2006, 04:19 AM   #15
Alien_Hominid
Senior Member
 
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
Quote:
Originally Posted by foo_bar_foo
Itanium 64 bit is the first intell 80786 class processor
As I know Itanium is IA=64 and does not belong to x86 architecture.

EDIT: But it's strange that even I have Pentium 4 Prescott uname still shows i686 (pentium 4 support is compiled into the kernel).

Last edited by Alien_Hominid; 04-11-2006 at 04:29 AM.
 
  


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
Building new linux box: AMD 64 or Pentium4 GATTACA Linux - Hardware 4 10-18-2004 03:14 PM
gentoo: pentium4 smp support and kernel 2.6.7 problems iliah Linux - Hardware 0 08-01-2004 11:35 AM
Pentium4 / RH9 Peformance issue <full config listed> BiTurboMan Linux - Newbie 5 03-15-2004 11:11 PM
can't install redhat 8.0 on pentium4 machine pattarapongn Red Hat 3 09-16-2003 11:12 AM
Compiling Pentium4 Support Gives Kernel Panic activematrix Linux - Hardware 12 05-17-2003 07:12 AM

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

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