Re: APXS troubles
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
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
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
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
On 7/20/07, Ralf Mattes [EMAIL PROTECTED] 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
On 7/20/07, Farokh Irani [EMAIL PROTECTED] 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
On Fri, 2007-07-20 at 14:39 +0200, Mike wrote: On 7/20/07, Farokh Irani [EMAIL PROTECTED] 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
On 7/20/07, Farokh Irani [EMAIL PROTECTED] 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
Mike wrote: On 7/20/07, Farokh Irani [EMAIL PROTECTED] 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
On Fri, 2007-07-20 at 14:39 +0200, Mike wrote: On 7/20/07, Farokh Irani [EMAIL PROTECTED] 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
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
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.