Re: Disabling optimization
On Fri, Nov 19, 2004 at 12:42:43AM -0700, Bob Proulx wrote: Bob Friesenhahn wrote: Andrew Suffield wrote: What you're all trying to say is this: CXXFLAGS=-g -O0 ${CXXFLAGS} Nope, this prevents overriding CXXFLAGS from the environment. It does not. I do it all the time. On HP-UX: aCC -O0 aCC: warning 901: unknown option: `-0': use +help for online documentation. I don't remember the last time I wrote anything that worked on HP-UX; it's certainly not a platform I have any interest in supporting. I mean, geez, next you'll be complaining that it doesn't work on VMS. If you're going to deal with freakish systems like this, then yes, you're going to have to go to the lowest-common-denominator. But that's no reason why those of us not stuck in the 1980s should care. For any feature you care to consider, ABSOLUTELY ANY FEATURE YOU HAVE EVER USED, there exists a platform on which it does not work. That does not mean you should not write any code. -- .''`. ** Debian GNU/Linux ** | Andrew Suffield : :' : http://www.debian.org/ | `. `' | `- -- | signature.asc Description: Digital signature
Re: Disabling optimization
On Fri, 19 Nov 2004, Andrew Suffield wrote: For any feature you care to consider, ABSOLUTELY ANY FEATURE YOU HAVE EVER USED, there exists a platform on which it does not work. That does not mean you should not write any code. Perhaps you don't choose to do good work, but don't try to persuade others to do less. -- Thomas E. Dickey http://invisible-island.net ftp://invisible-island.net
Re: Disabling optimization
On Fri, Nov 19, 2004 at 07:00:43AM -0500, Thomas Dickey wrote: On Fri, 19 Nov 2004, Andrew Suffield wrote: For any feature you care to consider, ABSOLUTELY ANY FEATURE YOU HAVE EVER USED, there exists a platform on which it does not work. That does not mean you should not write any code. Perhaps you don't choose to do good work, but don't try to persuade others to do less. Uh, that made no sense at all. Are you saying that you should not write code, because it's not possible to write code that works on every platform? -- .''`. ** Debian GNU/Linux ** | Andrew Suffield : :' : http://www.debian.org/ | `. `' | `- -- | signature.asc Description: Digital signature
Re: Disabling optimization
On Fri, Nov 19, 2004 at 08:49:29AM -0500, Thomas Dickey wrote: On Fri, 19 Nov 2004, Andrew Suffield wrote: Uh, that made no sense at all. Are you saying that you should not write code, because it's not possible to write code that works on every platform? That was the message one would infer from the remainder of your comment. Did you not read it? Everything I said was arguing *against* this. I think you have me confused with the parent message. -- .''`. ** Debian GNU/Linux ** | Andrew Suffield : :' : http://www.debian.org/ | `. `' | `- -- | signature.asc Description: Digital signature
Re: Disabling optimization
On Fri, 19 Nov 2004, Andrew Suffield wrote: aCC: warning 901: unknown option: `-0': use +help for online documentation. I don't remember the last time I wrote anything that worked on HP-UX; it's certainly not a platform I have any interest in supporting. I mean, geez, next you'll be complaining that it doesn't work on VMS. If you're going to deal with freakish systems like this, then yes, you're going to have to go to the lowest-common-denominator. But that's no reason why those of us not stuck in the 1980s should care. For any feature you care to consider, ABSOLUTELY ANY FEATURE YOU HAVE EVER USED, there exists a platform on which it does not work. That does not mean you should not write any code. While I agree that from certain programming standpoints HP-UX leaves much to be desired it also happens to be one of the current dominant OSs of choice for big-iron Unix systems, and is therefore not an obscure freakish system. My software works fine under HP-UX. You software should work under HP-UX as well. Bob == Bob Friesenhahn [EMAIL PROTECTED] http://www.simplesystems.org/users/bfriesen
Re: Disabling optimization
Andrew == Andrew Suffield [EMAIL PROTECTED] writes: Andrew On Fri, Nov 19, 2004 at 07:00:43AM -0500, Thomas Dickey wrote: On Fri, 19 Nov 2004, Andrew Suffield wrote: For any feature you care to consider, ABSOLUTELY ANY FEATURE YOU HAVE EVER USED, there exists a platform on which it does not work. That does not mean you should not write any code. Perhaps you don't choose to do good work, but don't try to persuade others to do less. Andrew Uh, that made no sense at all. Are you saying that you should not Andrew write code, because it's not possible to write code that works on Andrew every platform? What he is trying to say (I believe) is that it is not a good habit to write nonportable code because you are too lazy to even think about portability, and to try to persuade other to do so as well. The former is your own problem, while the latter is not. Joerg
Re: Disabling optimization
On Fri, 19 Nov 2004, Bob Friesenhahn wrote: My software works fine under HP-UX. You software should work under HP-UX as well. judging by the clues which google provides, Andrew's scope of experience is rather limited (hence the disparaging remarks). -- Thomas E. Dickey http://invisible-island.net ftp://invisible-island.net
Re: Disabling optimization
On Fri, Nov 19, 2004 at 05:07:48PM +0100, [EMAIL PROTECTED] wrote: Andrew == Andrew Suffield [EMAIL PROTECTED] writes: Andrew On Fri, Nov 19, 2004 at 07:00:43AM -0500, Thomas Dickey wrote: On Fri, 19 Nov 2004, Andrew Suffield wrote: For any feature you care to consider, ABSOLUTELY ANY FEATURE YOU HAVE EVER USED, there exists a platform on which it does not work. That does not mean you should not write any code. Perhaps you don't choose to do good work, but don't try to persuade others to do less. Andrew Uh, that made no sense at all. Are you saying that you should not Andrew write code, because it's not possible to write code that works on Andrew every platform? What he is trying to say (I believe) is that it is not a good habit to write nonportable code because you are too lazy to even think about portability, and to try to persuade other to do so as well. The former is your own problem, while the latter is not. It's certainly not a good habit to write lousy code because you're too lazy to consider which platforms your application is going to run on, or to persuade other people to write lousy code because your platform is crippled. -- .''`. ** Debian GNU/Linux ** | Andrew Suffield : :' : http://www.debian.org/ | `. `' | `- -- | signature.asc Description: Digital signature
Re: Disabling optimization
On Fri, Nov 19, 2004 at 09:43:30AM -0600, Bob Friesenhahn wrote: On Fri, 19 Nov 2004, Andrew Suffield wrote: aCC: warning 901: unknown option: `-0': use +help for online documentation. I don't remember the last time I wrote anything that worked on HP-UX; it's certainly not a platform I have any interest in supporting. I mean, geez, next you'll be complaining that it doesn't work on VMS. If you're going to deal with freakish systems like this, then yes, you're going to have to go to the lowest-common-denominator. But that's no reason why those of us not stuck in the 1980s should care. For any feature you care to consider, ABSOLUTELY ANY FEATURE YOU HAVE EVER USED, there exists a platform on which it does not work. That does not mean you should not write any code. While I agree that from certain programming standpoints HP-UX leaves much to be desired it also happens to be one of the current dominant OSs of choice for big-iron Unix systems, and is therefore not an obscure freakish system. All the HP-UX sysadmins I've encountered disagree with you on both points (although 'dominant OSs of choice for arbitrary undefined group' can mean just about anything). They generally only use it because either (a) they can't afford a hardware upgrade, or (b) they have some weird proprietary application that won't run on anything else. My software works fine under HP-UX. You software should work under HP-UX as well. What for? Nobody wants to use it there. It's a far better use of time to do things people actually want. -- .''`. ** Debian GNU/Linux ** | Andrew Suffield : :' : http://www.debian.org/ | `. `' | `- -- | signature.asc Description: Digital signature
Re: Disabling optimization
Andrew == Andrew Suffield [EMAIL PROTECTED] writes: Andrew Uh, that made no sense at all. Are you saying that you should not Andrew write code, because it's not possible to write code that works on Andrew every platform? What he is trying to say (I believe) is that it is not a good habit to write nonportable code because you are too lazy to even think about portability, and to try to persuade other to do so as well. The former is your own problem, while the latter is not. Andrew It's certainly not a good habit to write lousy code because you're too Andrew lazy to consider which platforms your application is going to run on, Andrew or to persuade other people to write lousy code because your platform Andrew is crippled. I'm not a particular fan of HP-UX, but I still don't see why the lack of the native compiler's -O0 option would render a platform crippled. Joerg
Re: Disabling optimization
On Fri, 19 Nov 2004, Andrew Suffield wrote: All the HP-UX sysadmins I've encountered disagree with you on both points (although 'dominant OSs of choice for arbitrary undefined group' can mean just about anything). They generally only use it because either (a) they can't afford a hardware upgrade, or (b) they have some weird proprietary application that won't run on anything else. When I say dominant OS of choice what I mean that in terms of dollars spent on new and existing systems, last year more money was spent on systems that run HP-UX than all Linux systems combined. This is the nature of the big-iron Unix market. 5% of the systems consume over 90% of all dollars spent on Unix-related systems. You should be happy that these systems bring in big money since they confirm that if Linux stays on its current path, eventually Linux will be the OS of choice on big-iron systems (IBM is a major promoter of this). I am happy to know that software I support is used on million dollar systems as well as PCs. It is one of the joys of open systems. Bob == Bob Friesenhahn [EMAIL PROTECTED] http://www.simplesystems.org/users/bfriesen
Re: Disabling optimization
On Fri, Nov 19, 2004 at 05:58:58PM +0100, [EMAIL PROTECTED] wrote: Andrew == Andrew Suffield [EMAIL PROTECTED] writes: Andrew Uh, that made no sense at all. Are you saying that you should not Andrew write code, because it's not possible to write code that works on Andrew every platform? What he is trying to say (I believe) is that it is not a good habit to write nonportable code because you are too lazy to even think about portability, and to try to persuade other to do so as well. The former is your own problem, while the latter is not. Andrew It's certainly not a good habit to write lousy code because you're too Andrew lazy to consider which platforms your application is going to run on, Andrew or to persuade other people to write lousy code because your platform Andrew is crippled. I'm not a particular fan of HP-UX, but I still don't see why the lack of the native compiler's -O0 option would render a platform crippled. It makes fine-grained control of compiler options somewhere between difficult and impossible. Without properly negatable options, the best you can do is cheap all-or-nothing hacks (see earlier in this thread for several examples), where the user can only deactivate all the logic in the configure script and do it by hand. -- .''`. ** Debian GNU/Linux ** | Andrew Suffield : :' : http://www.debian.org/ | `. `' | `- -- | signature.asc Description: Digital signature
Re: Disabling optimization
Stepan Kasal [EMAIL PROTECTED] writes: out of curiosity, what would be wrong with the following? if test -n ${CXXFLAGS}; then CXXFLAGS=-g fi AC_PROG_CXX I think you got it backwards. This makes it impossible to override CXXFLAGS. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 And now for something completely different.
Re: Disabling optimization
On Thu, 2004-11-18 at 11:55 +0100, Andreas Schwab wrote: Stepan Kasal [EMAIL PROTECTED] writes: out of curiosity, what would be wrong with the following? if test -n ${CXXFLAGS}; then CXXFLAGS=-g fi AC_PROG_CXX I think you got it backwards. This makes it impossible to override CXXFLAGS. Isn't the snippet below sufficient? CXXFLAGS=${CXXFLAGS--g} AC_PROG_CXX Ralf
Re: Disabling optimization
On Thu, Nov 18, 2004 at 12:41:37PM +0100, Ralf Corsepius wrote: On Thu, 2004-11-18 at 11:55 +0100, Andreas Schwab wrote: Stepan Kasal [EMAIL PROTECTED] writes: out of curiosity, what would be wrong with the following? if test -n ${CXXFLAGS}; then CXXFLAGS=-g fi AC_PROG_CXX I think you got it backwards. This makes it impossible to override CXXFLAGS. Isn't the snippet below sufficient? CXXFLAGS=${CXXFLAGS--g} AC_PROG_CXX What you're all trying to say is this: CXXFLAGS=-g -O0 ${CXXFLAGS} -- .''`. ** Debian GNU/Linux ** | Andrew Suffield : :' : http://www.debian.org/ | `. `' | `- -- | signature.asc Description: Digital signature
Re: Disabling optimization
On Thu, 2004-11-18 at 11:56 +, Andrew Suffield wrote: On Thu, Nov 18, 2004 at 12:41:37PM +0100, Ralf Corsepius wrote: On Thu, 2004-11-18 at 11:55 +0100, Andreas Schwab wrote: Stepan Kasal [EMAIL PROTECTED] writes: out of curiosity, what would be wrong with the following? if test -n ${CXXFLAGS}; then CXXFLAGS=-g fi AC_PROG_CXX I think you got it backwards. This makes it impossible to override CXXFLAGS. Isn't the snippet below sufficient? CXXFLAGS=${CXXFLAGS--g} AC_PROG_CXX What you're all trying to say is this: CXXFLAGS=-g -O0 ${CXXFLAGS} Nope, this prevents overriding CXXFLAGS from the environment. Ralf
Re: Disabling optimization
Hello, On Thu, 2004-11-18 at 11:55 +0100, Andreas Schwab wrote: Stepan Kasal [EMAIL PROTECTED] writes: if test -n ${CXXFLAGS}; then CXXFLAGS=-g fi AC_PROG_CXX I think you got it backwards. This makes it impossible to override CXXFLAGS. yes, I meant ``test -z'', sorry. On Thu, Nov 18, 2004 at 12:41:37PM +0100, Ralf Corsepius wrote: Isn't the snippet below sufficient? CXXFLAGS=${CXXFLAGS--g} AC_PROG_CXX or : ${CXXFLAGS=-g} AC_PROG_CXX But my question was whether there was a reason for setting the variable _after_ AC_PROG_CXX, as the original suggestion proposed. Thanks, Stepan Kasal
Re: Disabling optimization
On Thu, 2004-11-18 at 14:04 +0100, Stepan Kasal wrote: [snip] But my question was whether there was a reason for setting the variable _after_ AC_PROG_CXX, as the original suggestion proposed. In retrospect, I can't think of one. -- Braden McDaniel e-mail: [EMAIL PROTECTED] http://endoframe.comJabber: [EMAIL PROTECTED]
Re: Disabling optimization
On Thu, Nov 18, 2004 at 01:42:39PM +0100, Ralf Corsepius wrote: On Thu, 2004-11-18 at 11:56 +, Andrew Suffield wrote: On Thu, Nov 18, 2004 at 12:41:37PM +0100, Ralf Corsepius wrote: On Thu, 2004-11-18 at 11:55 +0100, Andreas Schwab wrote: Stepan Kasal [EMAIL PROTECTED] writes: out of curiosity, what would be wrong with the following? if test -n ${CXXFLAGS}; then CXXFLAGS=-g fi AC_PROG_CXX I think you got it backwards. This makes it impossible to override CXXFLAGS. Isn't the snippet below sufficient? CXXFLAGS=${CXXFLAGS--g} AC_PROG_CXX What you're all trying to say is this: CXXFLAGS=-g -O0 ${CXXFLAGS} Nope, this prevents overriding CXXFLAGS from the environment. It does not. I do it all the time. -- .''`. ** Debian GNU/Linux ** | Andrew Suffield : :' : http://www.debian.org/ | `. `' | `- -- | signature.asc Description: Digital signature
Re: Disabling optimization
On Thu, 18 Nov 2004, Andrew Suffield wrote: What you're all trying to say is this: CXXFLAGS=-g -O0 ${CXXFLAGS} Nope, this prevents overriding CXXFLAGS from the environment. It does not. I do it all the time. How does the user portably remove/override the -g and -O0 options? It seems that you are depending on the user's compiler to support a way to subtract from existing options. You are also expecting that the user's compiler supports -O0 and doesn't simply exit. Bob == Bob Friesenhahn [EMAIL PROTECTED] http://www.simplesystems.org/users/bfriesen
Re: Disabling optimization
On Thu, Nov 18, 2004 at 03:44:46PM -0600, Bob Friesenhahn wrote: On Thu, 18 Nov 2004, Andrew Suffield wrote: What you're all trying to say is this: CXXFLAGS=-g -O0 ${CXXFLAGS} Nope, this prevents overriding CXXFLAGS from the environment. It does not. I do it all the time. How does the user portably remove/override the -g and -O0 options? It seems that you are depending on the user's compiler to support a way to subtract from existing options. You are also expecting that the user's compiler supports -O0 and doesn't simply exit. You appear to be expecting the user's compiler to compile C++. That's a pretty poor expectation from the outset (it might be g++ 2.95 or something). You can't do *anything* without expecting stuff from the compiler. Pick some real goals and some realistic expectations, don't just handwave about vague notions of 'portability' to unnamed systems which are broken in unspecified ways. -- .''`. ** Debian GNU/Linux ** | Andrew Suffield : :' : http://www.debian.org/ | `. `' | `- -- | signature.asc Description: Digital signature
Re: Disabling optimization
On Thu, 18 Nov 2004, Andrew Suffield wrote: On Thu, Nov 18, 2004 at 03:44:46PM -0600, Bob Friesenhahn wrote: On Thu, 18 Nov 2004, Andrew Suffield wrote: What you're all trying to say is this: CXXFLAGS=-g -O0 ${CXXFLAGS} Nope, this prevents overriding CXXFLAGS from the environment. It does not. I do it all the time. How does the user portably remove/override the -g and -O0 options? It seems that you are depending on the user's compiler to support a way to subtract from existing options. You are also expecting that the user's compiler supports -O0 and doesn't simply exit. You appear to be expecting the user's compiler to compile C++. That's a pretty poor expectation from the outset (it might be g++ 2.95 or something). CXXFLAGS is only used to compile C++ so I don't think I was stretching my imagination too far. Bob == Bob Friesenhahn [EMAIL PROTECTED] http://www.simplesystems.org/users/bfriesen
Re: Disabling optimization
CXXFLAGS=`echo $CXXFLAGS | sed -e 's|-O2||'` On Nov 18, 2004, at 1:44 PM, Bob Friesenhahn wrote: On Thu, 18 Nov 2004, Andrew Suffield wrote: What you're all trying to say is this: CXXFLAGS=-g -O0 ${CXXFLAGS} Nope, this prevents overriding CXXFLAGS from the environment. It does not. I do it all the time. How does the user portably remove/override the -g and -O0 options? It seems that you are depending on the user's compiler to support a way to subtract from existing options. You are also expecting that the user's compiler supports -O0 and doesn't simply exit. Bob == Bob Friesenhahn [EMAIL PROTECTED] http://www.simplesystems.org/users/bfriesen -- Thomas R. Treadway Computer Scientist Lawrence Livermore Nat'l Lab 7000 East Avenue, L-365 Livermore, CA 94550-0611
Re: Disabling optimization
Thomas 'Tom' R. Treadway III [EMAIL PROTECTED] writes: CXXFLAGS=`echo $CXXFLAGS | sed -e 's|-O2||'` This assumes that CXXFLAGS does not contain -frob-O2any. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 And now for something completely different.
Re: Disabling optimization
How do I disable the -O2 flag in the most portable way possible? I am just learning, I am no authority. But, I would do it at configure time: 'CXXFLAGS=-O0' 'CFLAGS=-O0' If you have some *file* that needs some specific flag, you could set it in your Makefile.am. I think it would be something like that (not sure): execname_SOURCES = cannot_opt.cpp cannot_opt.h can_opt.cpp can_opt.h cannot_opt_o_CXXFLAGS = -O0 Andre Caldas.
Re: Disabling optimization
On Wed, 2004-11-17 at 18:48 -0500, Jonathan wrote: My autoconf/automake project is optimizing by default with -g -O2. Unfortunately, we have verified that this is causing a run-time error by overriding CXXFLAGS in Makefile.am with just -g. With the -O2 flag removed, everything works great. I have been trying to find out where this -O2 is coming from so I can disable it at the configure.ac level, but my attempts have been fruitless. -g -O2 is what AC_PROG_CC/AC_PROG_CXX sets CFLAGS/CXXFLAGS to if it isn't already set to something. How do I disable the -O2 flag in the most portable way possible? I would do something like this (in configure.ac): if test -n ${CXXFLAGS}; then user_set_cxxflags=yes fi AC_PROG_CXX if test X$user_set_cxxflags != Xyes; then CXXFLAGS=-g fi Really you should probably be a little more clever and also check to see if the compiler in use is the one you have a problem with. But this approach allows someone who really *wants* to use -O2 (to experiment, perhaps) to do so. -- Braden McDaniel e-mail: [EMAIL PROTECTED] http://endoframe.comJabber: [EMAIL PROTECTED]
Re: Disabling optimization
Hello, On Wed, Nov 17, 2004 at 08:01:45PM -0500, Braden McDaniel wrote: if test -n ${CXXFLAGS}; then user_set_cxxflags=yes fi AC_PROG_CXX if test X$user_set_cxxflags != Xyes; then CXXFLAGS=-g fi out of curiosity, what would be wrong with the following? if test -n ${CXXFLAGS}; then CXXFLAGS=-g fi AC_PROG_CXX Thanks, Stepan Kasal