You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Ralf Mattes <rm...@seid-online.de> on 2007/07/19 18:12:26 UTC
Re: APXS troubles
On Thu, 2007-07-19 at 10:41 -0400, Farokh Irani wrote:
> Did you get the file OK and have you had a chance to look at it?\
>
Yes and yes - even so it was binhexed ...
I allready replied yesterday evening - no idea why you didn't get my
mail.
Anyway - indeed there is a bug in APXS. Unless your input files have the
extention '.c' APXS won't invoke libtool in compile mode (hence it's
missing from your trace). Libtool in link mode will just create an empty
library ...
The easy fix is to rename the files from '*.cpp' to '*.c' (no, '*.cc'
doesn't work either). If you find the time you might want to report the
bug to the APXS maintainers, the important lines are these:
---*----- apxs (line 351 ff.) --------------*-.--
if ($opt_c) {
##
## SHARED OBJECT COMPILATION
##
# split files into sources and objects
my @srcs = ();
my @objs = ();
my $f;
foreach $f (@args) {
if ($f =~ m|\.c$|) { <---------------- Here, bad coder! BAD!
push(@srcs, $f);
}
else {
push(@objs, $f);
}
}
HTH
Ralf Mattes
> Thanks.
Re: APXS troubles
Posted by Mike <dy...@gmail.com>.
On Thu, Jul 19, 2007 at 06:12:26PM +0200, Ralf Mattes wrote:
> Anyway - indeed there is a bug in APXS. Unless your input files have the
> extention '.c' APXS won't invoke libtool in compile mode (hence it's
> missing from your trace). Libtool in link mode will just create an empty
> library ...
[cut]
> foreach $f (@args) {
> if ($f =~ m|\.c$|) { <---------------- Here, bad coder! BAD!
> push(@srcs, $f);
> }
> else {
> push(@objs, $f);
> }
> }
Just can't believe that, f****** amazing...
Me and Farokh, we've been playing with this apxs problem for 1 month or
even better. Argggh...
Anyway big thanks to you. I wouldn't catch the apxs code examination
idea :)
Assumption that source file ends with .c is quite poor. apxs should be
fixed immediately.
One more time thank you.
Kind regards.
Re: APXS troubles
Posted by Mike <dy...@gmail.com>.
On 7/20/07, Ralf Mattes <rm...@seid-online.de> wrote:
> I'd go for:
>
> if ( $f = ~m/\.c(c|pp){0,1}$/i )
>
> This variant avoids backtracking and makes the regexp case insensitive.
> Yes, it does accept monsters like 'Foo.cPp'. but who cares :-)
which is equal to
if ( $f =~m/\.c(c|pp)?$/i )
Re: APXS troubles
Posted by Ralf Mattes <rm...@seid-online.de>.
On Fri, 2007-07-20 at 12:38 +0100, Jeremy Sowden wrote:
> Farokh Irani wrote:
> > >On Fri, 2007-07-20 at 08:36 +0200, Mike wrote:
> > >> > > if ($f =~ m|\.c$|) { <---------------- Here, bad
> > coder! BAD!
> > >> > I don't know perl at all, so those were
> > >> > stabs in the dark. Any pointers on that would be appreciated.
> > >> Try:
> > > > if( $f =~ m/\.c$|\.cpp$|\.cc$/ )
> >
> > OK, I tried this and while it appears to compile and link, the symbol
> > winds up undefined again and nm shows the a similar output as when it
> > was linked as an empty library.
> >
> > >I'd go for:
> > >
> > > if ( $f = ~m/\.c(c|pp){0,1}$/i )
> >
> > This one doesn't compile. When I run apxs, perl complains:
> > Use of uninitialized value in pattern match (m//) at /usr/bin/apxs2
> > line
> > 361.
>
> There's a typo. It should be:
>
> if ( $f =~ m/\.c(c|pp){0,1}$/i )
Yes, sorry. This was actually caused by a stupid mail client inserting a
line break during copy-n-paste. While correcting this I must somehow
inadvertently have added a whitespace at the wrong point.
Cheers, RalfD
> J.
> --
> +0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+
> www: http://www.azazel.net/
> pgp: http://www.azazel.net/~azazel/js_key.asc
> +0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+
Re: APXS troubles
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Mike wrote:
> On 7/20/07, Farokh Irani <fa...@mcfsoftware.com> wrote:
>> >So you mean a change from *.cpp to *.c is the only real working
>> >solution? That's strange but anyway it works now...
>> That is how it appears to be. Unfortunately, it's not a good solution
>> because I really don't want to have to rename a bunch of .cpp files
>> to .c only to change them back. I'd prefer to fix apxs correctly :)
> Sure. I'll take a look at apxs and send a mail to apache-dev about
> this issue. Actually I know Perl quite good so it's not a big problem
> for me.
Just a thought - it's probably easier to summarize what file names are
objects (.[[s]l]o .[l]a .s(l|o) .dylib .dll) than it is to summarize
what every flavor of .c/.cxx/.cpp/.cc etc etc are compileable, and that
doesn't even begin to cover non-cc compilations.
Since we have two lists, to be linked or to be compiled, I'd suggest a
hint to try capturing the patterns for what belongs in the link-list.
Re: APXS troubles
Posted by Mike <dy...@gmail.com>.
On 7/20/07, Farokh Irani <fa...@mcfsoftware.com> wrote:
> >So you mean a change from *.cpp to *.c is the only real working
> >solution? That's strange but anyway it works now...
> That is how it appears to be. Unfortunately, it's not a good solution
> because I really don't want to have to rename a bunch of .cpp files
> to .c only to change them back. I'd prefer to fix apxs correctly :)
Sure. I'll take a look at apxs and send a mail to apache-dev about
this issue. Actually I know Perl quite good so it's not a big problem
for me.
BTW. How about MacOS compilation?
Kind regards.
Re: APXS troubles
Posted by Farokh Irani <fa...@mcfsoftware.com>.
>On 7/20/07, Farokh Irani <fa...@mcfsoftware.com> wrote:
>>So, somewhere there is still something going on with .c vs .cpp. I'll
>>poke at apxs a bit and see if I can figure out why, but a crash
>>course in perl wasn't what I was looking at doing right now :)
>So you mean a change from *.cpp to *.c is the only real working
>solution? That's strange but anyway it works now...
That is how it appears to be. Unfortunately, it's not a good solution
because I really don't want to have to rename a bunch of .cpp files
to .c only to change them back. I'd prefer to fix apxs correctly :)
--
Farokh
----------------------------------------------------------------------------
MCF Software...simply dependably engineered
Developers of ListSTAR http://www.liststar.com/, MacRADIUS
http://www.macradius.com/, Address List Sorter
http://www.mcfsoftware.com/als/, SimpleText Filter for EIMS
http://www.mcfsoftware.com/stf/ and Auto Reply plug-in for EIMS
http://www.mcfsoftware.com/ar/.
Re: APXS troubles
Posted by Farokh Irani <fa...@mcfsoftware.com>.
>On Fri, Jul 20, 2007 at 11:39:35PM -0400, Farokh Irani wrote:
>> I took a further look at apxs, and it appears that the bad coding for the
>> source files continues. In my apxs around line 406, you'll find the
>> following:
>>
>> 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|;
>>
>> When I replaced the .c in the above with .cpp, everything worked fine using
>> .cpp.
>Change substitution command separators (s|||) to s///.
>Then create regex disjunction (operator |).
>
>$slo =~ s|\.c$|.slo|;
>
>change to
>
>$slo =~ s/\.c$|\.cpp$|\.cc$/.slo/;
>
>and all the rest with the same style.
That does seem to work OK.
Thanks.
--
Farokh
----------------------------------------------------------------------------
MCF Software...simply dependably engineered
Developers of ListSTAR http://www.liststar.com/, MacRADIUS
http://www.macradius.com/, Address List Sorter
http://www.mcfsoftware.com/als/, SimpleText Filter for EIMS
http://www.mcfsoftware.com/stf/ and Auto Reply plug-in for EIMS
http://www.mcfsoftware.com/ar/.
Re: APXS troubles
Posted by Mike <dy...@gmail.com>.
On Fri, Jul 20, 2007 at 11:39:35PM -0400, Farokh Irani wrote:
> I took a further look at apxs, and it appears that the bad coding for the
> source files continues. In my apxs around line 406, you'll find the
> following:
>
> 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|;
>
> When I replaced the .c in the above with .cpp, everything worked fine using
> .cpp.
Change substitution command separators (s|||) to s///.
Then create regex disjunction (operator |).
$slo =~ s|\.c$|.slo|;
change to
$slo =~ s/\.c$|\.cpp$|\.cc$/.slo/;
and all the rest with the same style.
> Now, I'm not sure if the perl from the first fix:
>
> if ( $f =~ m/\.c(c|pp){0,1}$/i ) instead of
> if ($f =~ m|\.c$|)
Here same rule as above.
I reviewed apxs code and it's just poor coded must-use tool :/
Kind regards.
Re: APXS troubles
Posted by Farokh Irani <fa...@mcfsoftware.com>.
>On Fri, 2007-07-20 at 14:39 +0200, Mike wrote:
>> On 7/20/07, Farokh Irani <fa...@mcfsoftware.com> wrote:
>> > So, somewhere there is still something going on with .c vs .cpp. I'll
>> > poke at apxs a bit and see if I can figure out why, but a crash
>> > course in perl wasn't what I was looking at doing right now :)
>> So you mean a change from *.cpp to *.c is the only real working
>> solution? That's strange but anyway it works now...
>
>Well - from what I can observe this seems to be a bug in libtool itself
>(why did I expect this, given libtools poor C++ support?).
>The final link command emitted by apxs seems to be (my reindentation):
>
>/usr/share/apr-1.0/build/libtool --silent --mode=link \
> --tag=disable-static g++ -o mod_fancy.la \
> -rpath /usr/lib/apache2/modules -module -avoid-version \
> config.cpp mod_fancy.cpp
>
>Note that apxs is passing source file names to libtool. This doesn't
>seem to work. Passing the '.libs/mod_fancy.o .libs/config.o' seems a
>quick fix. I wonder if it's worth the effort.
>NOTE: I've sucessfully compiled C++ modules, but 'I somehow always give
>my sorce files '*.c' extentions.
I took a further look at apxs, and it appears that the bad coding for
the source files continues. In my apxs around line 406, you'll find
the following:
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|;
When I replaced the .c in the above with .cpp, everything worked fine
using .cpp. Now, I'm not sure if the perl from the first fix:
if ( $f =~ m/\.c(c|pp){0,1}$/i ) instead of
if ($f =~ m|\.c$|)
can somehow be used in the above, but I'm sure that someone with perl
experience should be able to point out how to fix it.
--
Farokh
----------------------------------------------------------------------------
MCF Software...simply dependably engineered
Developers of ListSTAR http://www.liststar.com/, MacRADIUS
http://www.macradius.com/, Address List Sorter
http://www.mcfsoftware.com/als/, SimpleText Filter for EIMS
http://www.mcfsoftware.com/stf/ and Auto Reply plug-in for EIMS
http://www.mcfsoftware.com/ar/.
Re: APXS troubles
Posted by Ralf Mattes <rm...@seid-online.de>.
On Fri, 2007-07-20 at 14:39 +0200, Mike wrote:
> On 7/20/07, Farokh Irani <fa...@mcfsoftware.com> wrote:
> > So, somewhere there is still something going on with .c vs .cpp. I'll
> > poke at apxs a bit and see if I can figure out why, but a crash
> > course in perl wasn't what I was looking at doing right now :)
> So you mean a change from *.cpp to *.c is the only real working
> solution? That's strange but anyway it works now...
Well - from what I can observe this seems to be a bug in libtool itself
(why did I expect this, given libtools poor C++ support?).
The final link command emitted by apxs seems to be (my reindentation):
/usr/share/apr-1.0/build/libtool --silent --mode=link \
--tag=disable-static g++ -o mod_fancy.la \
-rpath /usr/lib/apache2/modules -module -avoid-version \
config.cpp mod_fancy.cpp
Note that apxs is passing source file names to libtool. This doesn't
seem to work. Passing the '.libs/mod_fancy.o .libs/config.o' seems a
quick fix. I wonder if it's worth the effort.
NOTE: I've sucessfully compiled C++ modules, but 'I somehow always give
my sorce files '*.c' extentions.
HTH Ralf Mattes
> Kind regards.
Re: APXS troubles
Posted by Mike <dy...@gmail.com>.
On 7/20/07, Farokh Irani <fa...@mcfsoftware.com> wrote:
> So, somewhere there is still something going on with .c vs .cpp. I'll
> poke at apxs a bit and see if I can figure out why, but a crash
> course in perl wasn't what I was looking at doing right now :)
So you mean a change from *.cpp to *.c is the only real working
solution? That's strange but anyway it works now...
Kind regards.
Re: APXS troubles
Posted by Farokh Irani <fa...@mcfsoftware.com>.
>There's a typo. It should be:
>
> if ( $f =~ m/\.c(c|pp){0,1}$/i )
OK, that seemed to work, but the .so file is once again an empty library.
I then recompiled using .c as the extension, but when I tried to load
apache, it complained of an unknown symbol, something with
_gxx_personality. Mike suggested that I force the stdc++ library to
be used by using -lstdc++ to apxs. So I tried it as such:
apxs2 -ic -S CC=g++ -lstdc++ -n mod_fancy mod_fancy.c config.c
and now apache loads without complaint and it works. When I hit the
IP address, I get the correct output.
So, somewhere there is still something going on with .c vs .cpp. I'll
poke at apxs a bit and see if I can figure out why, but a crash
course in perl wasn't what I was looking at doing right now :)
--
Farokh
----------------------------------------------------------------------------
MCF Software...simply dependably engineered
Developers of ListSTAR http://www.liststar.com/, MacRADIUS
http://www.macradius.com/, Address List Sorter
http://www.mcfsoftware.com/als/, SimpleText Filter for EIMS
http://www.mcfsoftware.com/stf/ and Auto Reply plug-in for EIMS
http://www.mcfsoftware.com/ar/.
Re: APXS troubles
Posted by Jeremy Sowden <je...@azazel.net>.
Farokh Irani wrote:
> >On Fri, 2007-07-20 at 08:36 +0200, Mike wrote:
> >> > > if ($f =~ m|\.c$|) { <---------------- Here, bad
> coder! BAD!
> >> > I don't know perl at all, so those were
> >> > stabs in the dark. Any pointers on that would be appreciated.
> >> Try:
> > > if( $f =~ m/\.c$|\.cpp$|\.cc$/ )
>
> OK, I tried this and while it appears to compile and link, the symbol
> winds up undefined again and nm shows the a similar output as when it
> was linked as an empty library.
>
> >I'd go for:
> >
> > if ( $f = ~m/\.c(c|pp){0,1}$/i )
>
> This one doesn't compile. When I run apxs, perl complains:
> Use of uninitialized value in pattern match (m//) at /usr/bin/apxs2
> line
> 361.
There's a typo. It should be:
if ( $f =~ m/\.c(c|pp){0,1}$/i )
J.
--
+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+
www: http://www.azazel.net/
pgp: http://www.azazel.net/~azazel/js_key.asc
+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+
Re: APXS troubles
Posted by Farokh Irani <fa...@mcfsoftware.com>.
>On Fri, 2007-07-20 at 08:36 +0200, Mike wrote:
>> > > if ($f =~ m|\.c$|) { <---------------- Here, bad coder! BAD!
>> > I don't know perl at all, so those were
>> > stabs in the dark. Any pointers on that would be appreciated.
>> Try:
> > if( $f =~ m/\.c$|\.cpp$|\.cc$/ )
OK, I tried this and while it appears to compile and link, the symbol
winds up undefined again and nm shows the a similar output as when it
was linked as an empty library.
>I'd go for:
>
> if ( $f = ~m/\.c(c|pp){0,1}$/i )
This one doesn't compile. When I run apxs, perl complains:
Use of uninitialized value in pattern match (m//) at /usr/bin/apxs2 line 361.
Thanks.
--
Farokh
----------------------------------------------------------------------------
MCF Software...simply dependably engineered
Developers of ListSTAR http://www.liststar.com/, MacRADIUS
http://www.macradius.com/, Address List Sorter
http://www.mcfsoftware.com/als/, SimpleText Filter for EIMS
http://www.mcfsoftware.com/stf/ and Auto Reply plug-in for EIMS
http://www.mcfsoftware.com/ar/.
Re: APXS troubles
Posted by Ralf Mattes <rm...@seid-online.de>.
On Fri, 2007-07-20 at 08:36 +0200, Mike wrote:
> > > if ($f =~ m|\.c$|) { <---------------- Here, bad coder! BAD!
> > I don't know perl at all, so those were
> > stabs in the dark. Any pointers on that would be appreciated.
> Try:
> if( $f =~ m/\.c$|\.cpp$|\.cc$/ )
> Kind regards.
I'd go for:
if ( $f = ~m/\.c(c|pp){0,1}$/i )
This variant avoids backtracking and makes the regexp case insensitive.
Yes, it does accept monsters like 'Foo.cPp'. but who cares :-)
Cheers, RalfD
BTW - did anyone report this bug to the maintainers?
Re: APXS troubles
Posted by Mike <dy...@gmail.com>.
> > if ($f =~ m|\.c$|) { <---------------- Here, bad coder! BAD!
> I don't know perl at all, so those were
> stabs in the dark. Any pointers on that would be appreciated.
Try:
if( $f =~ m/\.c$|\.cpp$|\.cc$/ )
Kind regards.
Re: APXS troubles
Posted by Farokh Irani <fa...@mcfsoftware.com>.
>On Thu, 2007-07-19 at 10:41 -0400, Farokh Irani wrote:
>> Did you get the file OK and have you had a chance to look at it?\
>>
>Yes and yes - even so it was binhexed ...
Whoops. Sorry about that.
>I allready replied yesterday evening - no idea why you didn't get my
>mail.
>Anyway - indeed there is a bug in APXS. Unless your input files have the
>extention '.c' APXS won't invoke libtool in compile mode (hence it's
>missing from your trace). Libtool in link mode will just create an empty
>library ...
>The easy fix is to rename the files from '*.cpp' to '*.c' (no, '*.cc'
>doesn't work either). If you find the time you might want to report the
>bug to the APXS maintainers, the important lines are these:
>---*----- apxs (line 351 ff.) --------------*-.--
>
>if ($opt_c) {
> ##
> ## SHARED OBJECT COMPILATION
> ##
>
> # split files into sources and objects
> my @srcs = ();
> my @objs = ();
> my $f;
> foreach $f (@args) {
> if ($f =~ m|\.c$|) { <---------------- Here, bad coder! BAD!
OK, is there a quick fix I can do to make it work with cpp files? I tried:
if (($f =~ m|\.c$|) || if ($f =~ m|\.cpp$|))
but that didn't seem to work. I also tried:
if ($f =~ m|\.cpp$|)
and that didn't work either. I don't know perl at all, so those were
stabs in the dark. Any pointers on that would be appreciated.
Thanks.
--
Farokh
----------------------------------------------------------------------------
MCF Software...simply dependably engineered
Developers of ListSTAR http://www.liststar.com/, MacRADIUS
http://www.macradius.com/, Address List Sorter
http://www.mcfsoftware.com/als/, SimpleText Filter for EIMS
http://www.mcfsoftware.com/stf/ and Auto Reply plug-in for EIMS
http://www.mcfsoftware.com/ar/.