Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
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.
Can an expert please tell me precisely where to place my compiling optimization flags. I've tried /etc/profile/, and etc/rpmrc (in Mandrake 8.2, rpmrc is in /usr/lib/rpm/). This works for my .src.rpm compiling, but I can't seem to get the /etc/profile/ optimization flags to work with source files (.tar.gz, extracted).
Do I need to add flags to the ./configure process, or edit them in to the resulting makefile after I do ./configure? Please give me the exact syntax, and where in the makefile I need to place them.
Also, how, and precisely where do I place the CFLAG optimization flags in /etc/profile, which I had understood would then be picked up and placed into every makefile that ./configure produced apparently, the syntax, and/or locations I have been using don't work. This wouldn't be a problem, if I could just place them in the makefile before I run "make install." I need the exact locations to place the opt flags in makefile, and the exact syntax to use- I'm obviously doing something wrong.I'd rather have them in /etc/profile, and work automatically, but I don't mind doing them individually on each compile. I really need some specific examples- I'm new at this and just a general "do this" or "do that" may not help me. I've followed many directions in the articles on this subject, but either they don't work in Mandrake 8.2, or I don't understand them.
Thanks,
wrc1944
/etc/profile is a good place. Remember that not every makefile uses CFLAGS. That's why some programs compile without your optimization flags. In such case, you need to edit Makefiles.
I need to see an actual example of where to place the opt flags in makefile. I also need somebody to copy their etc/profile file with the working flags, so I can know precisely where to place them. Can somebody who does this please post copies (or send me by email- flacycads@access4less.net) of your etc/profile, etc/rpmrc, and ./bash_profile files if you place the opt flags there, and also an optimized makefile produced by the optimizations. That way, there will be no misunderstanding as to what I need to do. I've been going around in circles all week trying to figure this out. Even though I carefully follow all the advice, nothing seems to work with tar.gz compiles. I can do srpms fine, but obviously I am not doing something correctly with the others.
Thanks again,
wrc1944
I imagine your problem is that C++ programs use CXXFLAGS rahter than CFLAGS. As for the location you set CFLAGS and CXXFLAGS in your /etc/profile, it doesn't matter. Here's the relevant bit of mine just as an example:
I need to see someone's actual file, with a few surrounding lines to give it context. As an example, here is mine, placed at the top of /etc/profile. These same flags work perfect every time in the rpmrc file with srpms, but I 've never gotten any combination of flags to work with compiling tar.gz files. This isn't the only style I've tried- I've tried at least 5 versions people have said work. In my case, nothing does. If there is something wrong with this file. please point it out, and give me an example of yours. Not just the correct lines, but a section of the file with the flag lines so I can see the context.
Thanks
wrc1944
---------------------------------------------------------------
# /etc/profile -*- Mode: shell-script -*-
# (c) MandrakeSoft, Chmouel Boudjnah <chmouel@mandrakesoft.com>
This file looks good. The only difference with mine is that I've got it at the end.
If you can see your variable correctly after running
echo $CFLAGS
it's set and should work.
I put it at the end, and it doesn't work. The only thing that does is the way a person told me on another forum, where I put in the flags like this, after I su and cd to the directory of the extracted tarball.
export CFLAGS=-O3 ......more flags
export CXXFLAGS=-O3 ........more flags
./configure && make && make install
The result is that it does a configure, and the flags show up correctly in the resulting makefile. Then make runs correctly. I haven't gotten through a complete make install yet, but that's due to a missing libperl.a file aborting the make install on ImageMagick-5.4.8. The opt flags are working OK.
Trying to put them in /etc/profile, or /root/bash_profile has not worked. Trying to edit them into the makefile manually does not work either. echo $CFLAGS gives nothing.
I've been searching for a copy of the libperl.a file for three hours, after installing perl and apache(everything in both). No luck. Can someone email me libperl.a? (flacycads@access4less.net)? The output in make install says it should be in user/lib/perl5/5.6.1/i386-linux/CORE, but it's not there.
Thanks,
wrc1944
I previously tried putting them in ~/.bash_profile, as another person suggested several days ago on another forum. That didn't work either, even as root.
In your post above, you said I should put them in /etc/profile, and now you say the problem is because they aren't read from /etc/profile. This seems contradictory, and the only way this makes sense is that some programs read from /etc/profile, and some don't.Is that correct? Newbies have no way of knowing that. I can say that I've tried countless times with many versions and configurations, as suggested by numerous experts. My conclusions, at least in my case, are:
1. /root/bash_profile doesn't work
2. ~./bash_profile doesn't work
3. /etc/profile doesn't work
4. manually editing flags into a makefile doesn't work
5. putting flags right before ./configure DOES work, only for that specific compile.
Since so many experts are saying 1-4 do work, I'm at a loss as to why in my experience, and after explicitly following all suggestions to the letter, they don't. I must still be doing something wrong, but after 20-30 posts to different forums asking someone to please post their files showing flags in context, nobody has done so. If I could see correct examples of those four relevant files, that would show me what's wrong with what I'm doing, and would have saved days of back and forth postings, and confusion.I really appreciate all the help, but one picture is worth a thousand words.
I guess I can live with doing it manually each time, but I'd really like to figure out why the other methods aren't working for me.
wrc1944
Individual programs don't read from /etc/profile, the shell does. I can only think that you might be running an shell which doesn't read from /etc/profile. Are you sure you're running bash? To find out, run:
ps ax | grep bash
and see if you get more than one line of output from that command.
I can't really give you an example /etc/profile, because I'm running FreeBSD which uses the c-shell, which uses different configuration files with a different syntax. But I still don't think it's an error in the way you are formatting the file, as long as you get the variable definitions in there somewhere, it should work. Btw, the file you posted had a typo:
CXXFLAGS=$CFAGS
where you had CFAGS instead of CFLAGS
Alex
Last edited by llama_meme; 08-13-2002 at 05:04 AM.
Originally posted by wrc1944
If I could see correct examples of those four relevant files, that would show me what's wrong with what I'm doing, and would have saved days of back and forth postings, and confusion.I really appreciate all the help, but one picture is worth a thousand words.
Seeing a file won't help much, but if you really wish it (not full, the last part):
Code:
# Mandrake-Security : if you remove this comment, remove the next line too.
SECURE_LEVEL=3
# Mandrake-Security : if you remove this comment, remove the next line too.
umask 022
# Mandrake-Security : if you remove this comment, remove the next line too.
PATH=$PATH:/usr/X11R6/bin:/usr/games:/usr/local/bin:/usr/local/sbin:/usr/local/kde/bin:/repository/kde/qt/bin:/usr/TeX/bin/i386-linux
QTDIR=/repository/kde/qt
KDEDIR=/usr/local/kde
# Mandrake-Security : if you remove this comment, remove the next line too.
export PATH SECURE_LEVEL QTDIR KDEDIR
CFLAGS="-O9 -march=athlon"
export CFLAGS
Also check if you don't have a spelling mistake as
llama_meme suggested. It's not a reason not having CFLAGS, it can only affect CXXFLAGS, but check it.
[wrc1944@localhost wrc1944]$ ps ax|grep bash
2357 pts/0 S 0:00 /bin/bash
2385 pts/0 R 0:00 grep bash
[root@localhost wrc1944]# ps ax|grep bash
2357 pts/0 S 0:00 /bin/bash
2392 pts/0 S 0:00 bash
2422 pts/0 S 0:00 grep bash
I had thought the default shell in Mandrake was bash, so I guess this output confirms that.
I had noticed that typo- it wasn't in the actual files, just in the post to the forum.
Mara,
I assume this is your /etc/profile file. I see you have the flags at the absolute end. In mine, I didn't want to put flags after "done" and unset i, as that didn't seem sensible. After umask 022, I see you only have path lines, but in mine I have a bunch of other stuff (see below) Could this make a difference?
---------------------------------------------------------------------------------------
umask 022
Hmm, '#' means a comment? Is it what you want?
You also have your pathes set inside 'for' loop. I'd move it somewhere else. The absolute end would be good.
Sorry- I copied the file after I had commented it out when I was installing some i586 packages- thus the #. I always uncommented it whenever I was trying to compile with i686 flags. OK- so I've set the flags inside something I shouldn't have. Maybe that is my problem.
Many thanks.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.