Discussion:
Invalid use of 'static' in linkage specification
(too old to reply)
Alberto Simões
2012-01-02 13:54:29 UTC
Permalink
Hello

Although most architectures are compiling my module correctly, I am
getting some complains for some random linuxes:

http://www.cpantesters.org/cpan/report/294f5cfc-3507-11e1-9d6f-f6dbfa7543f5

http://www.cpantesters.org/cpan/report/c9dafc5a-34fb-11e1-9d6f-f6dbfa7543f5

http://www.cpantesters.org/cpan/report/1afb75b2-34c3-11e1-9bca-f0349aeef8c6

They complain about the use of 'static' on the file generated by
ExtUtils::ParseXS. But my .xs file doesn't have any 'static' on it, so
it is referring to some code generated automatically.

Any hint on what it might be?

Thanks,
Cheers
ambs
muppet
2012-01-02 19:12:37 UTC
Permalink
Post by Alberto Simões
Hello
http://www.cpantesters.org/cpan/report/294f5cfc-3507-11e1-9d6f-f6dbfa7543f5
http://www.cpantesters.org/cpan/report/c9dafc5a-34fb-11e1-9d6f-f6dbfa7543f5
http://www.cpantesters.org/cpan/report/1afb75b2-34c3-11e1-9bca-f0349aeef8c6
They complain about the use of 'static' on the file generated by ExtUtils::ParseXS. But my .xs file doesn't have any 'static' on it, so it is referring to some code generated automatically.
Any hint on what it might be?
It's hard to say without seeing the generated code. The error message:

cc -Icld-src -I/home/cpan/pit/bare/perl-5.15.2/lib/5.15.2/x86_64-linux/CORE -fPIC -fPIC -I. -O2 -DCLD_WINDOWS -c -x c++ -O2 -o CLD.o CLD.cc
CLD.cc:178: error: invalid use of 'static' in linkage specification
CLD.cc:179: error: invalid use of 'static' in linkage specification
error building CLD.o from 'CLD.cc' at /home/cpan/pit/bare/perl-5.15.2/lib/5.15.2/ExtUtils/CBuilder/Base.pm line 177.

shows that the XS code is being turned into C++ code rather than C code.

It may be that one of the xsubpp macros that expects to expand into a C function is expanding in C++ class scope.


--
Daddy! Daddy! Daddy! Daddy! What was that question I asked?
-- Yvonne, confused
Alberto Simões
2012-01-02 19:42:31 UTC
Permalink
Post by muppet
Post by Alberto Simões
Hello
http://www.cpantesters.org/cpan/report/294f5cfc-3507-11e1-9d6f-f6dbfa7543f5
http://www.cpantesters.org/cpan/report/c9dafc5a-34fb-11e1-9d6f-f6dbfa7543f5
http://www.cpantesters.org/cpan/report/1afb75b2-34c3-11e1-9bca-f0349aeef8c6
They complain about the use of 'static' on the file generated by ExtUtils::ParseXS. But my .xs file doesn't have any 'static' on it, so it is referring to some code generated automatically.
Any hint on what it might be?
cc -Icld-src -I/home/cpan/pit/bare/perl-5.15.2/lib/5.15.2/x86_64-linux/CORE -fPIC -fPIC -I. -O2 -DCLD_WINDOWS -c -x c++ -O2 -o CLD.o CLD.cc
CLD.cc:178: error: invalid use of 'static' in linkage specification
CLD.cc:179: error: invalid use of 'static' in linkage specification
error building CLD.o from 'CLD.cc' at /home/cpan/pit/bare/perl-5.15.2/lib/5.15.2/ExtUtils/CBuilder/Base.pm line 177.
shows that the XS code is being turned into C++ code rather than C code.
It may be that one of the xsubpp macros that expects to expand into a C function is expanding in C++ class scope.
I think this is a ExtUtils::XSParser problem. debugging it right now :)
David Oswald
2012-02-23 06:26:02 UTC
Permalink
Alberto (or anyone else):

Have you made any progress on this issue?  I'm seeing the same problem
in a couple of smoke test failures on Inline::CPP v0.34_002 dev.

Here's an example:

http://www.cpantesters.org/cpan/report/35702916-59fc-11e1-8417-42773f40e7b5

I look at the .c output from Inline::CPP (take the t/01basic.t test, for
example) and see one clue.  The segment:

#ifdef __cplusplus
extern "C"
#endif


I'm thinking that one resolution might be to use the newer syntax:

#ifdef __cplusplus
extern "C" {    // Note the new block.
#endif

/* fast forward to the bottom of the file */

#ifdef __cplusplus
}               // Close the block.
#endif

...that's only a hunch; I can't grasp how get ExtUtils::ParseXS to do
that for me, so I haven't been able to try it out.

At any rate, same error message you're getting, so that at least helps
me to realize I should be looking outside of Inline::CPP and Inline::C
for an answer.

Dave
Alberto Simões
2012-02-23 11:00:21 UTC
Permalink
Hello

That issue got fixed in my case without doing anything interesting :S

Sorry for not being able to help :(
Have you made any progress on this issue? I'm seeing the same problem
in a couple of smoke test failures on Inline::CPP v0.34_002 dev.
http://www.cpantesters.org/cpan/report/35702916-59fc-11e1-8417-42773f40e7b5
I look at the .c output from Inline::CPP (take the t/01basic.t test, for
#ifdef __cplusplus
extern "C"
#endif
#ifdef __cplusplus
extern "C" { // Note the new block.
#endif
/* fast forward to the bottom of the file */
#ifdef __cplusplus
} // Close the block.
#endif
...that's only a hunch; I can't grasp how get ExtUtils::ParseXS to do
that for me, so I haven't been able to try it out.
At any rate, same error message you're getting, so that at least helps
me to realize I should be looking outside of Inline::CPP and Inline::C
for an answer.
Dave
Loading...