Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A request to backport a commit to perl 5.16 #13745

Closed
p5pRT opened this issue Apr 19, 2014 · 14 comments
Closed

A request to backport a commit to perl 5.16 #13745

p5pRT opened this issue Apr 19, 2014 · 14 comments

Comments

@p5pRT
Copy link

p5pRT commented Apr 19, 2014

Migrated from rt.perl.org#121686 (status was 'rejected')

Searchable as RT121686$

@p5pRT
Copy link
Author

p5pRT commented Apr 19, 2014

From @craigberry

I received this request privately from one of the macports folks and I'm opening a ticket to get it properly considered.

The short version is whether 7db66e1, "A more C++-friendly dNOOP," can be backported to maint-5.16 to fix a problem with newer, stricter versions of clang++.

Begin forwarded message​:

From​: Mojca Miklavec <mojca@​macports.org>
Subject​: A request to backport a commit to perl 5.16
Date​: April 3, 2014 at 4​:59​:20 AM CDT
To​: "Craig A. Berry" <craigberry@​mac.com>, Ricardo Signes <rjbs@​cpan.org>

Hi,

I would like to kindly request adding the following commit also to
maint-5.16 if possible (for the next 5.16.4 release)​:

http​://perl5.git.perl.org/perl.git/commit/7db66e12883f0832ca80164b723768b848187bda?f=perl.h

(I didn't test with 5.14 or 5.12, so maybe it's needed there as well.
If there's a need to test it, I can ask users to do it, but we are
experiencing other problems on 5.14 which currently don't allow us to
test *exactly* that scenario.)

See​:
https://trac.macports.org/ticket/43150

I'm still waiting for confirmation from other users if that solves the
problem for them as well. This only became a problem with the latest
XCode release and a stricter clang compiler.

Thank you,
Mojca

The problem is readily illustrated by configuring a build of maint-5.16 as of v5.16.3-9-g7aa08a0 with -Dcc=clang++ when the clang++ version is​:

$ clang++ --version
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target​: x86_64-apple-darwin13.1.0
Thread model​: posix

This is what comes with XCode 5.1.1, but how one acquires the relevant version of clang++ probably doesn't matter. The build falls down hard like so​:

`sh cflags "optimize='-O3'" mro.o` mro.c
  CCCMD = clang++ -DPERL_CORE -c -fno-common -DPERL_DARWIN -no-cpp-precomp -I/usr/local/include -I/opt/local/include -O3 -Wall -ansi -W -Wextra -Wdeclaration-after-statement -Wendif-labels -Wc++-compat -Wwrite-strings -Wno-unused-variable -Wno-unused-parameter
clang​: warning​: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
mro.c​:421​:10​: warning​: implicit conversion of NULL constant to 'bool' [-Wnull-conversion]
  ? newSVhek(HvENAME_HEK(stash)
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
./embed.h​:360​:42​: note​: expanded from macro 'newSVhek'
#define newSVhek(a) Perl_newSVhek(aTHX_ a)
  ~~~~~~~~~~~~~ ^
mro.c​:421​:10​: warning​: implicit conversion of NULL constant to 'bool' [-Wnull-conversion]
  ? newSVhek(HvENAME_HEK(stash)
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
./embed.h​:360​:42​: note​: expanded from macro 'newSVhek'
#define newSVhek(a) Perl_newSVhek(aTHX_ a)
  ~~~~~~~~~~~~~ ^
mro.c​:1396​:5​: error​: declaration of 'Perl___notused' has a different language linkage
  dVAR;
  ^
./perl.h​:174​:17​: note​: expanded from macro 'dVAR'
# define dVAR dNOOP
  ^
./perl.h​:362​:26​: note​: expanded from macro 'dNOOP'
#define dNOOP extern int Perl___notused(void)
  ^
mro.c​:493​:5​: note​: previous declaration is here
  dVAR;
  ^
./perl.h​:174​:17​: note​: expanded from macro 'dVAR'
# define dVAR dNOOP
  ^
./perl.h​:362​:26​: note​: expanded from macro 'dNOOP'
#define dNOOP extern int Perl___notused(void)
  ^
2 warnings and 1 error generated.
make​: *** [mro.o] Error 1

The problem doesn't exist in 5.18.x and later because I fixed a similar problem for the OpenVMS C++ compiler as follows​:

commit 7db66e1
Author​: Craig A. Berry <craigberry@​mac.com>
Date​: Wed May 30 18​:57​:51 2012 -0500

  A more C++-friendly dNOOP.

  The problem with Perl___notused under C++ is that in some cases
  it's merely extern, and in some cases (via the XS macro via the
  XSPROTO macro) it's extern "C". Object code analysis shows that
  you do actually get one mangled and one unmangled version of the
  symbol, which wouldn't matter since the whole point is to have
  something we never use.

  Except that one very picky C++ compiler (HP C++ for OpenVMS) sees
  what we're up to and slaps us down hard. Since declaration after
  statement has always been allowed in C++, just go ahead and do a
  real noop statement for C++ and avoid the use of an external
  symbol.

Inline Patch
diff --git a/perl.h b/perl.h
index 3d89f8a..798e7b7 100644
--- a/perl.h
+++ b/perl.h
@@ -359,7 +359,11 @@
 /* Rats: if dTHR is just blank then the subsequent ";" throws an error */
 /* Declaring a *function*, instead of a variable, ensures that we don't rely
    on being able to suppress "unused" warnings.  */
+#ifdef __cplusplus
+#define dNOOP (void)0
+#else
 #define dNOOP extern int Perl___notused(void)
+#endif

 #ifndef pTHX
 /* Don't bother defining tTHX and sTHX; using them outside
[end]

The problem with backporting this as-is is that's it's not binary compatible. If the core is built with C++ after this patch, the Perl___notused symbol goes missing from libperl. A previously-built extension looking for that symbol at run-time would blow up.

However, if building the core is only supported for C, and C++ is only supported for extension building, it might be ok because the Perl___notused symbol will still be present in a libperl built with C. So that's one potential answer.

Another is to provide the Perl___notused symbol somewhere such as mathoms.c when building with C++.

The perl -V info below reflects the platform where the issue was reproduced but not the compiler used since you don't even get as far as miniperl with clang++.

$ ./perl -Ilib -V
Summary of my perl5 (revision 5 version 16 subversion 3) configuration​:
  Commit id​: 7aa08a0
  Platform​:
  osname=darwin, osvers=13.1.0, archname=darwin-2level
  uname='darwin triamond.local 13.1.0 darwin kernel version 13.1.0​: thu jan 16 19​:40​:37 pst 2014; root​:xnu-2422.90.20~2release_x86_64 x86_64 '
  config_args='-des'
  hint=recommended, useposix=true, d_sigaction=define
  useithreads=undef, usemultiplicity=undef
  useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
  use64bitint=define, use64bitall=define, uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='cc', ccflags ='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include',
  optimize='-O3',
  cppflags='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include'
  ccversion='', gccversion='4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)', gccosandvers=''
  intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
  ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
  alignbytes=8, prototype=define
  Linker and Libraries​:
  ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -fstack-protector -L/usr/local/lib -L/opt/local/lib'
  libpth=/usr/local/lib /opt/local/lib /usr/lib
  libs=-ldbm -ldl -lm -lutil -lc
  perllibs=-ldl -lm -lutil -lc
  libc=, so=dylib, useshrplib=false, libperl=libperl.a
  gnulibc_version=''
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
  cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -L/opt/local/lib -fstack-protector'

Characteristics of this binary (from libperl)​:
  Compile-time options​: HAS_TIMES PERLIO_LAYERS PERL_DONT_CREATE_GVSV
  PERL_MALLOC_WRAP PERL_PRESERVE_IVUV USE_64_BIT_ALL
  USE_64_BIT_INT USE_LARGE_FILES USE_LOCALE
  USE_LOCALE_COLLATE USE_LOCALE_CTYPE
  USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
  Built under darwin
  Compiled at Apr 19 2014 10​:38​:05
  @​INC​:
  lib
  /usr/local/lib/perl5/site_perl/5.16.3/darwin-2level
  /usr/local/lib/perl5/site_perl/5.16.3
  /usr/local/lib/perl5/5.16.3/darwin-2level
  /usr/local/lib/perl5/5.16.3
  /usr/local/lib/perl5/site_perl/5.16.2/darwin-2level
  /usr/local/lib/perl5/site_perl/5.16.2
  /usr/local/lib/perl5/site_perl

________________________________________
Craig A. Berry
mailto​:craigberry@​mac.com

"... getting out of a sonnet is much more
difficult than getting in."
  Brad Leithauser

@p5pRT
Copy link
Author

p5pRT commented Apr 20, 2014

From @xdg

On Sat, Apr 19, 2014 at 12​:15 PM, Craig A. Berry
<perlbug-followup@​perl.org> wrote​:

The problem with backporting this as-is is that's it's not binary compatible.

Unless binary compatibility can be assured, I don't think this should
be backported. If mathoms.c can be patched in blead and both commits
backported, that might be OK.

But patching mathoms.c might need to wait until 5.21. At which point,
technically, we don't support 5.16 anymore, either, except for
security fixes, so maybe this is all moot.

David

--
David Golden <xdg@​xdg.me> Twitter/IRC​: @​xdg

@p5pRT
Copy link
Author

p5pRT commented Apr 20, 2014

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Apr 20, 2014

From @tonycoz

On Sat Apr 19 09​:15​:09 2014, craigberry wrote​:

The problem with Perl___notused under C++ is that in some cases
it's merely extern, and in some cases (via the XS macro via the
XSPROTO macro) it's extern "C". Object code analysis shows that
you do actually get one mangled and one unmangled version of the
symbol, which wouldn't matter since the whole point is to have
something we never use.

Except that one very picky C++ compiler (HP C++ for OpenVMS) sees
what we're up to and slaps us down hard. Since declaration after
statement has always been allowed in C++, just go ahead and do a
real noop statement for C++ and avoid the use of an external
symbol.

We don't ever define the symbol, so I don't see how extensions could rely upon it.

Tony

@p5pRT
Copy link
Author

p5pRT commented Apr 21, 2014

From @craigberry

On Apr 20, 2014, at 6​:58 PM, Tony Cook via RT <perlbug-followup@​perl.org> wrote​:

On Sat Apr 19 09​:15​:09 2014, craigberry wrote​:

The problem with Perl___notused under C++ is that in some cases
it's merely extern, and in some cases (via the XS macro via the
XSPROTO macro) it's extern "C". Object code analysis shows that
you do actually get one mangled and one unmangled version of the
symbol, which wouldn't matter since the whole point is to have
something we never use.

Except that one very picky C++ compiler (HP C++ for OpenVMS) sees
what we're up to and slaps us down hard. Since declaration after
statement has always been allowed in C++, just go ahead and do a
real noop statement for C++ and avoid the use of an external
symbol.

We don't ever define the symbol, so I don't see how extensions could rely upon it.

Of course! In which case 7db66e1 should be completely safe to backport. Regarding David's comment, maint-5.16 is still supported for another month and the building of any C++ extensions in a common environment is broken without this, so IMO it should be backported.
________________________________________
Craig A. Berry
mailto​:craigberry@​mac.com

"... getting out of a sonnet is much more
difficult than getting in."
  Brad Leithauser

@p5pRT
Copy link
Author

p5pRT commented Apr 21, 2014

From @Leont

On Mon, Apr 21, 2014 at 2​:59 AM, Craig A. Berry <craigberry@​mac.com> wrote​:

Of course! In which case 7db66e1 should be completely safe to
backport. Regarding David's comment, maint-5.16 is still supported for
another month and the building of any C++ extensions in a common
environment is broken without this, so IMO it should be backported.

Seems reasonable, but are we really going to release another 5.16? Not that
it's bad to keep updating maint (if only to make downstream's life easier).

Also, it squicks me a bit for not being a declaration like it claims, even
though I know the point is entirely moot on C++

Leon

@p5pRT
Copy link
Author

p5pRT commented Apr 22, 2014

From @karenetheridge

On Mon, Apr 21, 2014 at 04​:03​:25PM +0200, Leon Timmermans wrote​:

Seems reasonable, but are we really going to release another 5.16? Not that
it's bad to keep updating maint (if only to make downstream's life easier).

Are there any other commits in maint-5.16 that haven't been released (or
fixes that would make sense to backport)? It would seem reasonable to me
to do one last 5.16 release just before 5.20, before closing off
(non-security-related) support for that line.

@p5pRT
Copy link
Author

p5pRT commented Apr 23, 2014

From mojca@macports.org

Dear Developers,

I would really like to see the following commit or something
equivalent backported to maint-5.16 if possible (for the next 5.16.4
release)​:

http​://perl5.git.perl.org/perl.git/commit/7db66e12883f0832ca80164b723768b848187bda?f=perl.h

See​:
https://trac.macports.org/ticket/43150

With the latest XCode 5.1 upgrade and stricter syntax checks in clang
3.4, some Perl modules don't build any longer on OS X 10.8/10.9.

As a consequence a lot of modules/packages (like wxPerl) are broken
when used with Perl 5.16 and compiled with clang 3.4 or later on OS X.

(I didn't test with 5.14 or 5.12, so maybe a similar trick is needed
there as well.)

Mojca

@p5pRT
Copy link
Author

p5pRT commented Apr 23, 2014

From @tonycoz

On Sun Apr 20 16​:58​:22 2014, tonyc wrote​:

We don't ever define the symbol, so I don't see how extensions could
rely upon it.

FWIW, +1 from me.

I don't expect we'll do a release though.

Tony

@p5pRT
Copy link
Author

p5pRT commented Apr 23, 2014

From @tonycoz

On Tue Apr 22 18​:28​:54 2014, mojca@​macports.org wrote​:

Dear Developers,

I would really like to see the following commit or something
equivalent backported to maint-5.16 if possible (for the next 5.16.4
release)​:

http​://perl5.git.perl.org/perl.git/commit/7db66e12883f0832ca80164b723768b848187bda?f=perl.h

See​:
https://trac.macports.org/ticket/43150

With the latest XCode 5.1 upgrade and stricter syntax checks in clang
3.4, some Perl modules don't build any longer on OS X 10.8/10.9.

As a consequence a lot of modules/packages (like wxPerl) are broken
when used with Perl 5.16 and compiled with clang 3.4 or later on OS X.

(I didn't test with 5.14 or 5.12, so maybe a similar trick is needed
there as well.)

This is a duplicate of 121686, so I've merged 121714 into that.

As a summary of the discussion​: it's seems safe to backport that change, but it's unlikely there will be a 5.16.4 release, since 5.20.0 will be released soonish, putting 5.16 outside of the maintenance window.

Tony

@p5pRT
Copy link
Author

p5pRT commented Oct 19, 2014

From @jkeenan

On Wed Apr 23 16​:41​:42 2014, tonyc wrote​:

On Tue Apr 22 18​:28​:54 2014, mojca@​macports.org wrote​:

Dear Developers,

I would really like to see the following commit or something
equivalent backported to maint-5.16 if possible (for the next 5.16.4
release)​:

http​://perl5.git.perl.org/perl.git/commit/7db66e12883f0832ca80164b723768b848187bda?f=perl.h

See​:
https://trac.macports.org/ticket/43150

With the latest XCode 5.1 upgrade and stricter syntax checks in clang
3.4, some Perl modules don't build any longer on OS X 10.8/10.9.

As a consequence a lot of modules/packages (like wxPerl) are broken
when used with Perl 5.16 and compiled with clang 3.4 or later on OS
X.

(I didn't test with 5.14 or 5.12, so maybe a similar trick is needed
there as well.)

This is a duplicate of 121686, so I've merged 121714 into that.

As a summary of the discussion​: it's seems safe to backport that
change, but it's unlikely there will be a 5.16.4 release, since 5.20.0
will be released soonish, putting 5.16 outside of the maintenance
window.

Tony

perl-5.20 has been released, so perl-5.16 is outside the maintenance window.

Can we close this ticket?

Thank you very much.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Oct 19, 2014

From @bulk88

On Sun Oct 19 16​:21​:32 2014, jkeenan wrote​:

On Wed Apr 23 16​:41​:42 2014, tonyc wrote​:

On Tue Apr 22 18​:28​:54 2014, mojca@​macports.org wrote​:

Dear Developers,

I would really like to see the following commit or something
equivalent backported to maint-5.16 if possible (for the next
5.16.4
release)​:

http​://perl5.git.perl.org/perl.git/commit/7db66e12883f0832ca80164b723768b848187bda?f=perl.h

See​:
https://trac.macports.org/ticket/43150

With the latest XCode 5.1 upgrade and stricter syntax checks in
clang
3.4, some Perl modules don't build any longer on OS X 10.8/10.9.

As a consequence a lot of modules/packages (like wxPerl) are broken
when used with Perl 5.16 and compiled with clang 3.4 or later on OS
X.

(I didn't test with 5.14 or 5.12, so maybe a similar trick is
needed
there as well.)

This is a duplicate of 121686, so I've merged 121714 into that.

As a summary of the discussion​: it's seems safe to backport that
change, but it's unlikely there will be a 5.16.4 release, since
5.20.0
will be released soonish, putting 5.16 outside of the maintenance
window.

Tony

perl-5.20 has been released, so perl-5.16 is outside the maintenance
window.

Can we close this ticket?

Thank you very much.

This does sound like a pretty bad bug if all C++ building was broken on 5.16, but it requires a developer suite upgrade on OSX to trigger. IDK how Devel​::PatchPerl plays into this bug/ticket.

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented Jul 3, 2019

From @jkeenan

On Sun, 19 Oct 2014 23​:21​:32 GMT, jkeenan wrote​:

On Wed Apr 23 16​:41​:42 2014, tonyc wrote​:

On Tue Apr 22 18​:28​:54 2014, mojca@​macports.org wrote​:

Dear Developers,

I would really like to see the following commit or something
equivalent backported to maint-5.16 if possible (for the next
5.16.4
release)​:

http​://perl5.git.perl.org/perl.git/commit/7db66e12883f0832ca80164b723768b848187bda?f=perl.h

See​:
https://trac.macports.org/ticket/43150

With the latest XCode 5.1 upgrade and stricter syntax checks in
clang
3.4, some Perl modules don't build any longer on OS X 10.8/10.9.

As a consequence a lot of modules/packages (like wxPerl) are broken
when used with Perl 5.16 and compiled with clang 3.4 or later on OS
X.

(I didn't test with 5.14 or 5.12, so maybe a similar trick is
needed
there as well.)

This is a duplicate of 121686, so I've merged 121714 into that.

As a summary of the discussion​: it's seems safe to backport that
change, but it's unlikely there will be a 5.16.4 release, since
5.20.0
will be released soonish, putting 5.16 outside of the maintenance
window.

Tony

perl-5.20 has been released, so perl-5.16 is outside the maintenance
window.

Can we close this ticket?

5.16 was released 7 years ago, so there will be no more maintenance releases. Closing ticket.

Thank you very much.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Jul 3, 2019

@jkeenan - Status changed from 'open' to 'rejected'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant