jvandal / modwsgi

Automatically exported from code.google.com/p/modwsgi
0 stars 0 forks source link

mod_wsgi fails to build when CFLAGS are set #166

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
$ ./configure --with-python=python3.2 CFLAGS="-march=core2 -O2 -pipe"
checking for apxs2... /usr/sbin/apxs2
checking Apache version... 2.3.3-dev
configure: creating ./config.status
config.status: creating Makefile
$ make
/usr/sbin/apxs2 -c -I/usr/include/python3.2 -DNDEBUG  -march=core2 -O2 -
lpthread -ldl  -lutil -lm
apxs:Error: Unknown option: m.
apxs:Error: Unknown option: r.
apxs:Error: Unknown option: h.
apxs:Error: Unknown option: =.
apxs:Error: Unknown option: O.
apxs:Error: Unknown option: 2.
Usage: apxs -g [-S <var>=<val>] -n <modname>
       apxs -q [-v] [-S <var>=<val>] [<query> ...]
       apxs -c [-S <var>=<val>] [-o <dsofile>] [-D <name>[=<value>]]
               [-I <incdir>] [-L <libdir>] [-l <libname>] [-Wc,<flags>]
               [-Wl,<flags>] [-p] <files> ...
       apxs -i [-S <var>=<val>] [-a] [-A] [-n <modname>] <dsofile> ...
       apxs -e [-S <var>=<val>] [-a] [-A] [-n <modname>] <dsofile> ...
make: *** [mod_wsgi.la] Error 1

CFLAGS are supposed to contain flags passed directly to compiler.
The following patch fixes this issue:

Index: posix-ap2X.mk.in
===================================================================
--- posix-ap2X.mk.in    (revision 1468)
+++ posix-ap2X.mk.in    (working copy)
@@ -19,7 +19,7 @@
 LIBEXECDIR = @LIBEXECDIR@

 CPPFLAGS = @CPPFLAGS@
-CFLAGS = @CFLAGS@
+CFLAGS = `for flag in @CFLAGS@; do echo -Wc,$$flag; done`
 LDFLAGS = @LDFLAGS@
 LDLIBS = @LDLIBS@

Original issue reported on code.google.com by Arfrever...@gmail.com on 8 Nov 2009 at 3:47

GoogleCodeExporter commented 8 years ago
You will have to add the -Wc, prefix to the arguments on the command line when 
running configure.

./configure --with-python=python3.2 CFLAGS="-Wc,-march=core2 -Wc,-O2 -Wc,-pipe"

I have tried those games of trying to add -W?, prefixes automatically before 
and it is a nightmare and prone to 
causing more problems than were there originally. This is because flags sourced 
from places such as Python 
configuration may or may not already have -W?, prefixes. Options with 
additional arguments inline also are lots 
of fun.

I do concede that documentation should mention the requirement to use prefixes. 
That -W?, prefix shouldn't 
cause issue where options being passed to compilers direct rather than via apxs 
as compiler understand that 
prefix anyway.

That said, I will once again think about whether there is a sane way to do this 
which always works.

Original comment by Graham.Dumpleton@gmail.com on 8 Nov 2009 at 10:34

GoogleCodeExporter commented 8 years ago
Affecting people using final release of mod_wsgi 3.0 where build scripts for 
binary distributions force setting 
CFLAGS  in environment when builds being done. Any configure script which sees 
CFLAGS set in this way 
would get them. The mod_wsgi build being picky about needing -Wc, prefix is 
going to have problem.

Am probably going to have to find a reliable way of fixing this which doesn't 
simply involve ignoring CFLAGS 
as did previously.

Workaround if CFLAGS variables in environment don't matter is to do:

  CFLAGS='' ./configure

or prefix all with -Wc, as described above.

Original comment by Graham.Dumpleton@gmail.com on 22 Nov 2009 at 3:07

GoogleCodeExporter commented 8 years ago

Original comment by Graham.Dumpleton@gmail.com on 22 Nov 2009 at 3:18

GoogleCodeExporter commented 8 years ago
Fixed in configure instead of makefile, but committed in subversion trunk at 
revision 1488.

Original comment by Graham.Dumpleton@gmail.com on 23 Nov 2009 at 6:58

GoogleCodeExporter commented 8 years ago

Original comment by Graham.Dumpleton@gmail.com on 23 Nov 2009 at 6:59

GoogleCodeExporter commented 8 years ago
Fixed in revision 1489 for 2.8 branch.

Original comment by Graham.Dumpleton@gmail.com on 23 Nov 2009 at 10:34

GoogleCodeExporter commented 8 years ago
3.1 and 2.8 were released a while back.

Original comment by Graham.Dumpleton@gmail.com on 18 Dec 2009 at 10:28