You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Mike <dy...@gmail.com> on 2007/07/22 09:53:00 UTC

Broken APXS

Greetings.

apxs accepts only *.c files as its input. For other extensions it
doesn't invoke libtool in compile mode and several different issues
leading to empty Apache module creation. The most probably reason is
poor regex design.
We've been having a nice discussion on modules-dev about fixing apxs and
finally I decided to write a note here.

Here's what we found we think is poor and needs a fix:

//---------------------------------------------------------
around line 350
>     foreach $f (@args) {
>         if ($f =~ m|\.c$|) {  <---------------- Here, bad
>         coder! BAD!
>             push(@srcs, $f);
>         }
>         else {
>             push(@objs, $f);
>         }
>     }
//---------------------------------------------------------

around line 400
> foreach $s (@srcs) {
>	my $slo = $s;
>	$slo =~ s|\.c$|.slo|;
>	my $lo = $s;
>	$lo =~ s|\.c$|.lo|;
>	my $la = $s;
>	$la =~ s|\.c$|.la|;
>	my $o = $s;
>	$o =~ s|\.c$|.o|; 
//---------------------------------------------------------

Where could I find current apxs maintainter?

Kind regards.

Re: Broken APXS

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Mike wrote:
> 
> Where could I find current apxs maintainter?

Apache projects don't have component-maintainers the way you might
find in bsd and similar hierarchical organizations.

The good news is, you found the right place to bring this up.

Bill

Re: Broken APXS

Posted by Mike <dy...@gmail.com>.
On Sun, Jul 22, 2007 at 09:18:49AM -0400, Eric Covener wrote:
>> apxs accepts only *.c files as its input. For other extensions it
>> doesn't invoke libtool in compile mode and several different issues
>> leading to empty Apache module creation. The most probably reason is
>> poor regex design.
> 
>  This kind of invocation: $ apxs -cia mod_cpp.cpp other.C
> 
>  Seems to behave better w/ the patch below:
> 
>  http://people.apache.org/~covener/apxs-cpp.diff
> 
>  | libtool --silent --mode=compile -c -o mod_cpp.lo mod_cpp.cpp
>  | libtool --silent --mode=compile -c -o other.lo other.C
>  | libtool --silent --mode=link gcc -o mod_cpp.la ...  other.lo mod_cpp.lo
Good. Also including this in next Apache release would be good idea.
Kind regards.

Re: Broken APXS

Posted by Mike <dy...@gmail.com>.
On Sun, Jul 22, 2007 at 02:32:21PM +0100, Nick Kew wrote:
> .cxx?  Modules in other languages?
Every shared-lib-compilable language (e. g. C++).

> How about adding an environment variable?  Something like:
> 
> -    my $srcs_regex = '\.(' . join('|', @srcs_extensions) . ')$';
> +    my $srcs_regex = $ENV{'APXS_SRC_EXT'}
> +                     ? "\." . $ENV{'APXS_SRC_EXT'} . "$"
> +                     : '\.(' . join('|', @srcs_extensions) . ')$';
Fixed extension is a bad idea. Sometimes ppl might have *.c and
*.cxx/*.cpp files together.
Kind regards.

Re: Broken APXS

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Eric Covener wrote:
> On 7/22/07, Nick Kew <ni...@webthing.com> wrote:
>> On Sun, 22 Jul 2007 09:18:49 -0400
>> "Eric Covener" <co...@gmail.com> wrote:
>>
>> > Seems to behave better w/ the patch below:
>> >
>> > http://people.apache.org/~covener/apxs-cpp.diff
>>
>> .cxx?  Modules in other languages?
>> How about adding an environment variable?
> 
> How about @opt_E to prepend (unshift) additional source extensions?

My suggestion on modules-dev was to focus on the object and lib extensions,
a very short list that are usually acceptable to ld/libtool, and then having
the assumption that others are source files.  Right now, we pick up all known
source extensions, and assume any others are objects or libs.

In conjunction with Eric's patch above, it seems like a more comprehensive
fix.

Bill

Re: Broken APXS

Posted by Eric Covener <co...@gmail.com>.
On 7/22/07, Nick Kew <ni...@webthing.com> wrote:
> On Sun, 22 Jul 2007 09:18:49 -0400
> "Eric Covener" <co...@gmail.com> wrote:
>
>
> > Seems to behave better w/ the patch below:
> >
> > http://people.apache.org/~covener/apxs-cpp.diff
>
> .cxx?  Modules in other languages?
> How about adding an environment variable?  Something like:
>
> -    my $srcs_regex = '\.(' . join('|', @srcs_extensions) . ')$';
> +    my $srcs_regex = $ENV{'APXS_SRC_EXT'}
> +                     ? "\." . $ENV{'APXS_SRC_EXT'} . "$"
> +                     : '\.(' . join('|', @srcs_extensions) . ')$';
>

How about @opt_E to prepend (unshift) additional source extensions?

(will add cxx too)

-- 
Eric Covener
covener@gmail.com

Re: Broken APXS

Posted by Nick Kew <ni...@webthing.com>.
On Sun, 22 Jul 2007 09:18:49 -0400
"Eric Covener" <co...@gmail.com> wrote:


> Seems to behave better w/ the patch below:
> 
> http://people.apache.org/~covener/apxs-cpp.diff

.cxx?  Modules in other languages?
How about adding an environment variable?  Something like:

-    my $srcs_regex = '\.(' . join('|', @srcs_extensions) . ')$';
+    my $srcs_regex = $ENV{'APXS_SRC_EXT'}
+                     ? "\." . $ENV{'APXS_SRC_EXT'} . "$"
+                     : '\.(' . join('|', @srcs_extensions) . ')$';

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

Re: Broken APXS

Posted by Mike <dy...@gmail.com>.
> > >apxs accepts only *.c files as its input. For other extensions it
> > >doesn't invoke libtool in compile mode and several different issues
> > >leading to empty Apache module creation. The most probably reason is
> > >poor regex design.
> > This kind of invocation: $ apxs -cia mod_cpp.cpp other.C
> >
> > Seems to behave better w/ the patch below:
> >
> > http://people.apache.org/~covener/apxs-cpp.diff
> It's not portable to assume that $CC can compile anything other than C.
It is because you can set CC to an arbitrary value.

> I'm not sure it's worth the complexity; it's already possible to pass
> .o/.lo to apxs (right?) so third-party modules can deal with the
> compilation step of non-C code.
Well, the point is to extend apxs so it'll be able to compile and link
efficiently.
Kind regards.

Re: Broken APXS

Posted by Joe Orton <jo...@redhat.com>.
On Sun, Jul 22, 2007 at 09:18:49AM -0400, Eric Covener wrote:
> On 7/22/07, Mike <dy...@gmail.com> wrote:
> >Greetings.
> >
> >apxs accepts only *.c files as its input. For other extensions it
> >doesn't invoke libtool in compile mode and several different issues
> >leading to empty Apache module creation. The most probably reason is
> >poor regex design.
> 
> This kind of invocation: $ apxs -cia mod_cpp.cpp other.C
> 
> Seems to behave better w/ the patch below:
> 
> http://people.apache.org/~covener/apxs-cpp.diff

It's not portable to assume that $CC can compile anything other than C. 
Doing this properly means having configure detect a C++ compiler, 
getting CXX/CXXFLAGS passed through to apxs, mapping extensions to the 
correct compiler, maybe passing the libtool --tag option too where 
appropriate.

I'm not sure it's worth the complexity; it's already possible to pass 
.o/.lo to apxs (right?) so third-party modules can deal with the 
compilation step of non-C code.

joe

Re: Broken APXS

Posted by Eric Covener <co...@gmail.com>.
On 7/22/07, Mike <dy...@gmail.com> wrote:
> Greetings.
>
> apxs accepts only *.c files as its input. For other extensions it
> doesn't invoke libtool in compile mode and several different issues
> leading to empty Apache module creation. The most probably reason is
> poor regex design.

This kind of invocation: $ apxs -cia mod_cpp.cpp other.C

Seems to behave better w/ the patch below:

http://people.apache.org/~covener/apxs-cpp.diff

| libtool --silent --mode=compile -c -o mod_cpp.lo mod_cpp.cpp
| libtool --silent --mode=compile -c -o other.lo other.C
| libtool --silent --mode=link gcc -o mod_cpp.la ...  other.lo mod_cpp.lo


-- 
Eric Covener
covener@gmail.com