rurban / Cpanel-JSON-XS

Improved fork of JSON-XS

Home Page:http://search.cpan.org/dist/Cpanel-JSON-XS/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build-time failure: g++9 / FreeBSD-12

jkeenan opened this issue · comments

Today I had occasion to try to install a CPAN library (Devel-NYTProf) on FreeBSD-12 using g++-9.3.0 as the C-compiler with which the associated perl was compiled. Similar attempts on this machine with clang10 and gcc9 were successful. But with g++-9 I got:

[perlmonger: Cpanel-JSON-XS-4.25] $ uname -mrs
FreeBSD 12.2-STABLE amd64

$ thisperl -v | head -2 | tail -1
This is perl 5, version 32, subversion 1 (v5.32.1) built for amd64-freebsd-thread-multi

$ thisperl -V:config_args; thisperl -V:cc
config_args='-des -Dusedevel -Uversiononly -Dprefix=/usr/home/jkeenan/testing/g++9/v5.32.1 -Dman1dir=none -Dman3dir=none -Duseithreads -Doptimize=-O2 -pipe -fstack-protector -fno-strict-aliasing -des -Dusedevel -Dusethreads -Dcc=g++9';
cc='g++9';

$ thisperl Makefile.PL
Generating a Unix-style Makefile
Writing Makefile for Cpanel::JSON::XS
Writing MYMETA.yml and MYMETA.json

$ make
Skip blib/lib/Cpanel/JSON/XS/Type.pm (unchanged)
Skip blib/lib/Cpanel/JSON/XS/Boolean.pm (unchanged)
Skip blib/lib/Cpanel/JSON/XS.pm (unchanged)
Running Mkbootstrap for XS ()
chmod 644 "XS.bs"
"/usr/home/jkeenan/testing/g++9/v5.32.1/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- XS.bs blib/arch/auto/Cpanel/JSON/XS/XS.bs 644
g++9 -c    -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_FORTIFY_SOURCE=2 -O2 -pipe -fstack-protector -fno-strict-aliasing    -DVERSION=\"4.25\"  -DXS_VERSION=\"4.25\" -DPIC -fPIC "-I/usr/home/jkeenan/testing/g++9/v5.32.1/lib/perl5/5.32.1/amd64-freebsd-thread-multi/CORE"  -Wall -Werror=declaration-after-statement -Wextra -W XS.c
cc1plus: warning: '-Werror=' argument '-Werror=declaration-after-statement' is not valid for C++
In file included from /usr/home/jkeenan/testing/g++9/v5.32.1/lib/perl5/5.32.1/amd64-freebsd-thread-multi/CORE/perl.h:5606,
                 from XS.xs:3:
XS.xs: In function 'UV decode_utf8(PerlInterpreter*, unsigned char*, STRLEN, int, STRLEN*)':
/usr/home/jkeenan/testing/g++9/v5.32.1/lib/perl5/5.32.1/amd64-freebsd-thread-multi/CORE/embed.h:737:66: warning: 'UV Perl_utf8n_to_uvuni(PerlInterpreter*, const U8*, STRLEN, STRLEN*, U32)' is deprecated [-Wdeprecated-declarations]
  737 | #define utf8n_to_uvuni(a,b,c,d) Perl_utf8n_to_uvuni(aTHX_ a,b,c,d)
      |                                                                  ^
XS.xs:539:12: note: in expansion of macro 'utf8n_to_uvuni'
  539 |     UV c = utf8n_to_uvuni (s, len, clen,
      |            ^~~~~~~~~~~~~~
In file included from /usr/home/jkeenan/testing/g++9/v5.32.1/lib/perl5/5.32.1/amd64-freebsd-thread-multi/CORE/perl.h:5567,
                 from XS.xs:3:
/usr/home/jkeenan/testing/g++9/v5.32.1/lib/perl5/5.32.1/amd64-freebsd-thread-multi/CORE/proto.h:3989:18: note: declared here
 3989 | PERL_CALLCONV UV Perl_utf8n_to_uvuni(pTHX_ const U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags)
      |                  ^~~~~~~~~~~~~~~~~~~
In file included from /usr/home/jkeenan/testing/g++9/v5.32.1/lib/perl5/5.32.1/amd64-freebsd-thread-multi/CORE/perl.h:5606,
                 from XS.xs:3:
/usr/home/jkeenan/testing/g++9/v5.32.1/lib/perl5/5.32.1/amd64-freebsd-thread-multi/CORE/embed.h:737:66: warning: 'UV Perl_utf8n_to_uvuni(PerlInterpreter*, const U8*, STRLEN, STRLEN*, U32)' is deprecated [-Wdeprecated-declarations]
  737 | #define utf8n_to_uvuni(a,b,c,d) Perl_utf8n_to_uvuni(aTHX_ a,b,c,d)
      |                                                                  ^
XS.xs:539:12: note: in expansion of macro 'utf8n_to_uvuni'
  539 |     UV c = utf8n_to_uvuni (s, len, clen,
      |            ^~~~~~~~~~~~~~
In file included from /usr/home/jkeenan/testing/g++9/v5.32.1/lib/perl5/5.32.1/amd64-freebsd-thread-multi/CORE/perl.h:5567,
                 from XS.xs:3:
/usr/home/jkeenan/testing/g++9/v5.32.1/lib/perl5/5.32.1/amd64-freebsd-thread-multi/CORE/proto.h:3989:18: note: declared here
 3989 | PERL_CALLCONV UV Perl_utf8n_to_uvuni(pTHX_ const U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags)
      |                  ^~~~~~~~~~~~~~~~~~~
XS.xs: In function 'void encode_hv(PerlInterpreter*, enc_t*, HV*, SV*)':
XS.xs:1361:46: error: invalid conversion from 'void*' to 'HEK*' {aka 'hek*'} [-fpermissive]
 1361 |                   he1->hent_hek = safecalloc (1, sizeof (struct hek) + sizeof (SV*) + 2);
In file included from /usr/home/jkeenan/testing/g++9/v5.32.1/lib/perl5/5.32.1/amd64-freebsd-thread-multi/CORE/perl.h:5606,
                 from XS.xs:3:
XS.xs: In function 'void XS_Cpanel__JSON__XS_incr_parse(PerlInterpreter*, CV*)':
XS.xs:4911:60: warning: type qualifiers ignored on cast result type [-Wignored-qualifiers]
 4911 |               sv_chop (self->incr_text, (const char* const)endp);
      |                                                            ^~~~
/usr/home/jkeenan/testing/g++9/v5.32.1/lib/perl5/5.32.1/amd64-freebsd-thread-multi/CORE/embed.h:575:44: note: in definition of macro 'sv_chop'
  575 | #define sv_chop(a,b)  Perl_sv_chop(aTHX_ a,b)
      |                                            ^
*** Error code 1

Stop.
make: stopped in /usr/home/jkeenan/.cpanm/work/1618007847.6775/Cpanel-JSON-XS-4.25

Can you investigate?

Thank you very much.
Jim Keenan

error: invalid conversion from 'void*' to 'HEK*'
because of a C++ compiler. This might need a #ifdef'ed _cplusplus
AFAIK perl was not C++ safe at all, only the linker is commonly g++. Will check.

Confirmed.

$ uname -mrs
FreeBSD 12.2-STABLE amd64
$ ./bin/perl -V:config_args
config_args='-des -Dusedevel -Uversiononly -Dprefix=/tmp/testing/g++9/v5.32.1 -Dman1dir=none -Dman3dir=none -Duseithreads -Doptimize=-O2 -pipe -fstack-protector -fno-strict-aliasing -des -Dusedevel -Dusethreads -Dcc=g++9';
$ ./bin/perl -V:cc
cc='g++9';
$ ./bin/perl -V:gccversion
gccversion='9.3.0';
$ ./bin/perl -MCpanel::JSON::XS -MDevel::NYTProf -E 'say join "\t" => $Cpanel::JSON::XS::VERSION, $Devel::NYTProf::VERSION;' | head -1
fid 1 has no src saved for -e (NYTP_FIDf_HAS_SRC not set but src available!)
4.26	6.07

Thanks!