You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Niko Tyni <nt...@debian.org> on 2015/06/17 19:27:28 UTC

mod_perl2, MP_INLINE and gcc 5

[resending to the correct list address]

Hi,

mod_perl2 (up to and including 2.0.9-RC3) fails to build with GCC 5,
because the default inline semantics have changed from GNU89 to C99 and
require changes in mod_perl source. See details at
 https://gcc.gnu.org/gcc-5/porting_to.html

The symptoms are lots of warnings like
  In file included from mod_perl.h:91:0,
                   from modperl_config.c:17:
  modperl_cgi.h:35:15: warning: inline function 'modperl_cgi_header_parse' declared but never defined
   MP_INLINE int modperl_cgi_header_parse(request_rec *r, char *buffer,
                 ^
and the test suite failing straight away with

  waiting 300 seconds for server to start: .apache2: Syntax error on line 79 of /home/niko/tmp/libapache2-mod-perl2/t/conf/httpd.conf: Cannot load /home/niko/tmp/libapache2-mod-perl2/src/modules/perl/mod_perl.so into server: /home/niko/tmp/libapache2-mod-perl2/src/modules/perl/mod_perl.so: undefined symbol: modperl_handler_name


The old semantics can be enabled with the -fgnu89-inline option (accepted
by GCC since 4.1.3), and the build seems to work fine with that, with
the full test suite passing for me.

I believe (but haven't tested) that clang exhibits similar behaviour
and can be forced to the old inline semantics with the -std=gnu89 option.
See http://clang.llvm.org/compatibility.html#inline
This may well be the reason for some reported MP_INLINE problems on OS X like

 https://mail-archives.apache.org/mod_mbox/perl-modperl/201211.mbox/%3C84B202A8-CAAE-4DCC-9AD7-BA55045CE23E@bowers.com%3E

 https://mail-archives.apache.org/mod_mbox/perl-dev/201501.mbox/%3C002e01d039bc$9a87f2a0$cf97d7e0$@com%3E

 https://mail-archives.apache.org/mod_mbox/perl-dev/201503.mbox/%3CCAHrynWCCAUs84QC9iDzzXQQTbCw3YpU8BFdBuopRVfLJkOyfMA@mail.gmail.com%3E

Google also finds the supporting

 http://blogs.perl.org/users/jason_a_crome/2012/04/compiling-mod-perl-2-on-os-x-lion.html

If it's not too late for 2.0.9, perhaps a note in README about this
would be useful? Maybe something like (improvements welcome; MP_CCOPTS
works for me but I'm not sure what the right way is):

diff --git a/README b/README
index 8d7c79e..cef8df4 100644
--- a/README
+++ b/README
@@ -25,6 +25,13 @@ Perl:
   configurations) are currently believed to work, but this is not
   guaranteed to be the case, either now or in the future.
 
+C compiler:
+  The mod_perl source currently relies on GNU89 inline semantics, while GCC 5
+  and Clang default to newer C99 semantics. If you see MP_INLINE
+  related warnings during the build and missing symbols when starting
+  the test suite, adding "-fgnu89-inline" (GCC) or "-std=gnu89" (Clang)
+  to MP_CCOPTS may help.
+
 *** Status ***
 
 mod_perl is currently considered stable.

-- 
Niko Tyni   ntyni@debian.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: mod_perl2, MP_INLINE and gcc 5

Posted by Niko Tyni <nt...@debian.org>.
On Wed, Jun 17, 2015 at 10:26:47PM +0100, Steve Hay wrote:
> On 17 June 2015 at 19:57, Niko Tyni <nt...@debian.org> wrote:
> > On Wed, Jun 17, 2015 at 08:27:28PM +0300, Niko Tyni wrote:
> >
> >> mod_perl2 (up to and including 2.0.9-RC3) fails to build with GCC 5,
> >> because the default inline semantics have changed from GNU89 to C99 and
> >> require changes in mod_perl source.
> >
> > Ah, reading my own references properly, it looks like it might be a
> > bit more complicated than that, and probably only happens when apr and
> > mod_perl are compiled with different inline semantics. Is that correct?
> >
> > Sorry for the confusion. I still think a note somewhere could help...
> 
> I was just about to roll the release this evening when I saw this. A
> minor README update surely doesn't warrant a new RC so I'm prepared to
> slip the note in now. Is the wording still accurate, given that the
> situation is more complicated than you first thought?

Thanks, and sorry for delaying the release :)

I think the wording could be amended a bit.

Reading apr.h, it defines APR_INLINE (which is the same thing as MP_INLINE
unless MP_DEBUG is defined) to __inline__ on GCC 2.7 or later, otherwise
it's left empty. I don't understand how building apr on gcc vs. clang
would affect the definition, it's not hardcoded at apr build time. AFAICS
building with clang should just work (without any inlines).

Given I haven't tried building clang myself, I guess that part could
be made less authoritative. Maybe

C compiler:
  The mod_perl source currently uses GNU89 inline semantics on GCC, but
  GCC 5 defaults to newer C99 semantics. If you see MP_INLINE related
  warnings during the build and missing symbols when starting the test
  suite, adding "-fgnu89-inline" to MP_CCOPTS may help.
  There are also some reports of this happening with the Clang compiler,
  where the corresponding option to try is "-std=gnu89".

-- 
Niko Tyni   ntyni@debian.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: mod_perl2, MP_INLINE and gcc 5

Posted by Steve Hay <st...@googlemail.com>.
On 17 June 2015 at 19:57, Niko Tyni <nt...@debian.org> wrote:
> On Wed, Jun 17, 2015 at 08:27:28PM +0300, Niko Tyni wrote:
>
>> mod_perl2 (up to and including 2.0.9-RC3) fails to build with GCC 5,
>> because the default inline semantics have changed from GNU89 to C99 and
>> require changes in mod_perl source.
>
> Ah, reading my own references properly, it looks like it might be a
> bit more complicated than that, and probably only happens when apr and
> mod_perl are compiled with different inline semantics. Is that correct?
>
> Sorry for the confusion. I still think a note somewhere could help...

I was just about to roll the release this evening when I saw this. A
minor README update surely doesn't warrant a new RC so I'm prepared to
slip the note in now. Is the wording still accurate, given that the
situation is more complicated than you first thought?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: mod_perl2, MP_INLINE and gcc 5

Posted by Niko Tyni <nt...@debian.org>.
On Wed, Jun 17, 2015 at 08:27:28PM +0300, Niko Tyni wrote:

> mod_perl2 (up to and including 2.0.9-RC3) fails to build with GCC 5,
> because the default inline semantics have changed from GNU89 to C99 and
> require changes in mod_perl source.

Ah, reading my own references properly, it looks like it might be a
bit more complicated than that, and probably only happens when apr and
mod_perl are compiled with different inline semantics. Is that correct?

Sorry for the confusion. I still think a note somewhere could help...
-- 
Niko Tyni   ntyni@debian.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org