Posted 29 July 2004 - 02:40 AM
I guess this means that I'm missing something out. I just ran the .configure, make and make install.
Can anyone help me understanding this?
Also, I want to be able to specify a particular CPU when compiling (athlon-xp). How should I accomplish this?
Any help would be much appreciated.
Posted 29 July 2004 - 04:41 AM
CFLAGS="-march=athlon-xp -pipe -O2"
Those variable should be in make.conf, just change their values. Non-Gentoo users please correct me if I'm wrong about make.conf.
Posted 29 July 2004 - 11:07 AM
So either I'm missing one that I should have, the make config is handled elsewhere or I'm just looking in the wrong place. Would a fellow FC2 user be able to point the way?
Posted 30 July 2004 - 03:00 PM
re "strip": In short, this little program deletes all symbols from executable files. What does this mean?
During the development of an application you have to go through certain stages:
a) Writing source code: In this step you write functions, declare variables and constants, create or import external modules and do a whole lot more stuff.
b) Compiling: During this step the compiler program transforms the written source code into machine readable code (called "object code"). For the next step (linking, see below), and if you want to do some debugging later on, the compiler will add symbols and/or additional debugging information to the translated source code. E.g. if you declared some variable like "int a;", the additional debug info would read like this: "<a> is a 4 byte wide integer value to be found at memory address <module start address> + <offset of variable storage section> + <offset to a>". Of course, compilers and linkers (see ©) won't write stuff like that into any object code file. But what they actually write can be later be evaluated to the above.
c) Linking/binding: After the steps (a) and (b) you have a machine-readable thingie, but this is still no executable. For this to happen you will need to launch the linker. A linker (nomen est omen) "links" together all the pieces of object-code and creates program file that can be launched from the shell.
"Relocatable" means that the operating system can load the program to any place in the memory and it will still work (that was not always the case, and programmers at my age will still remember the days of "absolute" start-code . The linker uses the additional infos from the compiler to achieve this.
As you can see, a whole lot more is done in such a cycle than just to bring some code-lines into machine readable form. In the object code and also the final executable many symbols are still included. And this is where strip comes in ...
Strip removes such additional information (e.g. line numbers, unnecessary relocation info etc.etc.) thus reducing the size of the binary file.
And to answer another one of your questions in brief: No, you don't have to do a strip on every program you compile, unless the size of the executable would suggest it.
Besides: The size of executables also depends on your optimization settings (e.g. "-O3", the best optimazation, or "-O1" for medium optimization; just check the CFLAGS/CXXFLAGS settings in your environment by doing an "env | sort" on the shell). Highly optimized binaries will always be noticably bigger than less optimized executables. It is also a thing which compiler you are using. The intel compilers for instance are legendary for their fast code, but also for their enormous executable-sizes if all optimizations are activated.
hope this helps
Posted 30 July 2004 - 06:00 PM
I did use -O3 to compile xmms - just for fun and to see the results!
I don't have the enivronment variables you mention (ie they don't show in an 'env | sort' either as a user or root). Is that default behaviour for FC2?
Thanks to all for the assistance.
[Edited by anthonyi on 2004-07-30 11:39:38]
Posted 30 July 2004 - 10:30 PM
re:CFLAGS/CXXFLAGS. That was in fact my bad there. It's basically not common to set those environment variables during OS installation, at least they are not set to anything very specific that one might consider "tweaked".
As you use these flags to globally tweak the compiler optimizations to your needs and also to your machine's specs most OS installers - if they set the env-vars at all - will stick to rather basic CFLAGS-settings that would not compromise the stability of the app or the system.
But you can of course add those entries to one of the files that define your environment. /etc/profile or /etc/bash_profile are such files where you can add the entries globally (= for all users). Other options would be the file .bashrc in your home directory.
About what to set the CFLAGS/CXXFLAGS to I can only refer to Google. An example setting for a highly optimizing setting on an AthlonXP machine would look like this ...
export CFLAGS="-march=athlon-xp -pipe -O3 -fomit-frame-pointer"
(last line means "use value of variable $CFLAGS")
hope this helps
Posted 30 July 2004 - 10:36 PM
Almost forgot to mention that many "make"-files contain compiler directives for optimizations ... so generally in most cases some form of optimization option is always given to the compiler regardless if you have set CFLAGS/CXXFLAGS or not.
Posted 31 July 2004 - 02:22 AM
a more concise and concrete answer to "what does strip do?" is it strips out
all helpful debugging information embedded in the program image.
If all your programs are bug-free, then you can go ahead and strip them all. 8)
Either that, or when you are certain you won't be doing a postmortem on the program
even if it does crash, then you strip it.