perl 内联 cpp 在 Windows 32 位上不起作用

perl Inline cpp not working windows 32 bit

本文关键字:不起作用 Windows 内联 cpp perl      更新时间:2023-10-16

我正在使用perl Inline::CPP和cpan文档中的此示例代码

 use Inline CPP;
print "9 + 16 = ", add(9, 16), "n";
print "9 - 16 = ", subtract(9, 16), "n";
__END__
__CPP__
int add(int x, int y) {
  return x + y;
}
int subtract(int x, int y) {
  return x - y;
}

错误日志

   C:strawberryperlbinperl.exe C:strawberryperllibExtUtilsxsubpp  -type
 "C:strawberryperllibExtUtilstypemap"  inline_pl_172d.xs > inline_pl_172
sc && C:strawberryperlbinperl.exe -MExtUtils::Command -e mv -- inline_pl_
d.xsc inline_pl_172d.c
Didn't find a 'MODULE ... PACKAGE ... PREFIX' line
g++ -c          -s -O2 -DWIN32 -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEX
DPERL_IMPLICIT_SYS -fno-strict-aliasing -mms-bitfields -s -O2     -DVERSION=
00"    -DXS_VERSION="0.00"  "-IC:strawberryperllibCORE"   inline_pl_17
c
inline_pl_172d.xs:28:2: error: 'MODULE' does not name a type
dmake:  Error code 129, while making 'inline_pl_172d.o'
A problem was encountered while attempting to compile and install your Inline
CPP code. The command that failed was:
  dmake > out.make 2>&1
The build directory was:
D:universityphddatadatamailChordata2_Inlinebuildinline_pl_172d
To debug the problem, cd to the build directory, and inspect the output files
 at D:universityphddatadatamailChordata2inline.pl line 0.
        ...propagated at C:/strawberry/perl/site/lib/Inline/C.pm line 772.
INIT failed--call queue aborted.

如果软件包在我的机器上安装不好 如何知道并修复它?

一旦我从 CPAN 安装了内联::CPP,您的代码就无需修改即可为我工作......

c:Perl>
c:Perl>perl StackOverflow.pl
Set up gcc environment - 3.4.5 (mingw-vista special r3)
9 + 16 = 25
9 - 16 = -7
c:Perl>
This is perl 5, version 16, subversion 3 (v5.16.3) built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2012, Larry Wall
Binary build 1603 [296746] provided by ActiveState http://www.ActiveState.com
Built Mar 13 2013 11:29:21
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

c:Perl>

这是在运行 ActivePerl 5.16.3 多线程和内联::CPP 0.46 的 Win7 32 位系统上,使用内联::CPP 模块设置中的默认安装设置。从外观上看,Perl 似乎正在使用 GCC 3.4.5 作为模块编译器......

c:Perl>gcc -v
Reading specs from C:/Perl/site/lib/auto/MinGW/bin/../lib/gcc/mingw32/3.4.5/specs
Configured with: ../gcc-3.4.5-20060117-3/configure --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-shared --enable-s
jlj-exceptions --enable-libgcj --disable-java-awt --without-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-synchronization --enable-libstdcxx-debug
Thread model: win32
gcc version 3.4.5 (mingw-vista special r3)
c:Perl>

使用的制作实用程序是 dmake 4.11...

c:Perl>dmake -V MAKE_VERSION
dmake.exe - Version 4.11-20080107-SHAY (Windows / MS Visual C++)
Copyright (c) 1990,...,1997 by WTI Corp.
Default Configuration:
        MAXLINELENGTH := 32766
        MAXPROCESSLIMIT := 4
        MAXPROCESS := 1
        .IMPORT .IGNORE: DMAKEROOT
        .MAKEFILES : makefile.mk makefile
        .SOURCE    : .NULL
        DMAKEROOT *= $(ABSMAKECMD:d)startup
        MAKESTARTUP := $(DMAKEROOT)startup.mk
Please read the NEWS file for the latest release notes.
c:Perl>

完整的内联::CPP CPAN 模块安装日志...

c:Perl>cpan
Set up gcc environment - 3.4.5 (mingw-vista special r3)
cpan shell -- CPAN exploration and modules installation (v2.00)
Enter 'h' for help.
cpan> install Inline::CPP
Reading 'C:PerlcpanMetadata'
  Database was generated on Mon, 28 Oct 2013 11:08:37 GMT
Fetching with LWP:
http://ppm.activestate.com/CPAN/authors/01mailrc.txt.gz
Reading 'C:Perlcpansourcesauthors1mailrc.txt.gz'
............................................................................DONE
Fetching with LWP:
http://ppm.activestate.com/CPAN/modules/02packages.details.txt.gz
Reading 'C:Perlcpansourcesmodules2packages.details.txt.gz'
  Database was generated on Tue, 05 Nov 2013 20:53:02 GMT
Warning: This index file is 40 days old.
  Please check the host you chose as your CPAN mirror for staleness.
  I'll continue but problems seem likely to happen.
............................................................................DONE
Fetching with LWP:
http://ppm.activestate.com/CPAN/modules/03modlist.data.gz
Reading 'C:Perlcpansourcesmodules3modlist.data.gz'
............................................................................DONE
Writing C:PerlcpanMetadata
Running install for module 'Inline::CPP'
Running make for D/DA/DAVIDO/Inline-CPP-0.46.tar.gz
Fetching with LWP:
http://ppm.activestate.com/CPAN/authors/id/D/DA/DAVIDO/Inline-CPP-0.46.tar.gz
Fetching with LWP:
http://ppm.activestate.com/CPAN/authors/id/D/DA/DAVIDO/CHECKSUMS
Checksum for C:PerlcpansourcesauthorsidDDADAVIDOInline-CPP-0.46.tar.gz ok
Scanning cache C:Perl/cpan/build for sizes
...........................................................................-DONE
DEL(1/2): C:PerlcpanbuildMath-Polynomial-1.005-ahaC2G
DEL(2/2): C:PerlcpanbuildMath-Polynomial-1.005-ahaC2G.yml
Inline-CPP-0.46/
Inline-CPP-0.46/Makefile.PL
Inline-CPP-0.46/META.yml
Inline-CPP-0.46/README
Inline-CPP-0.46/MANIFEST
Inline-CPP-0.46/TESTED
Inline-CPP-0.46/Changes
Inline-CPP-0.46/MANIFEST.SKIP
Inline-CPP-0.46/t/
Inline-CPP-0.46/t/03prefix.t
Inline-CPP-0.46/t/02basic.t
Inline-CPP-0.46/t/14changes.t
Inline-CPP-0.46/t/11rewrite_config.t
Inline-CPP-0.46/t/04charptr.t
Inline-CPP-0.46/t/07perlcritic.t
Inline-CPP-0.46/t/00load_prereqs.t
Inline-CPP-0.46/t/01fn_cans.t
Inline-CPP-0.46/t/10kwalitee.t
Inline-CPP-0.46/t/06fn_regress.t
Inline-CPP-0.46/t/08cppguess.t
Inline-CPP-0.46/t/09pod_coverage.t
Inline-CPP-0.46/t/13version_numbers.t
Inline-CPP-0.46/t/12custom_libs.t
Inline-CPP-0.46/t/05pod.t
Inline-CPP-0.46/grammar/
Inline-CPP-0.46/grammar/Makefile.PL
Inline-CPP-0.46/grammar/grammar.pm
Inline-CPP-0.46/grammar/t/
Inline-CPP-0.46/grammar/t/03inline.t
Inline-CPP-0.46/grammar/t/02scope.t
Inline-CPP-0.46/grammar/t/10struct.t
Inline-CPP-0.46/grammar/t/01nherit.t
Inline-CPP-0.46/grammar/t/05virt.t
Inline-CPP-0.46/grammar/t/09purevt.t
Inline-CPP-0.46/grammar/t/11minhrt.t
Inline-CPP-0.46/grammar/t/15stvar.t
Inline-CPP-0.46/grammar/t/14const.t
Inline-CPP-0.46/grammar/t/00pod_coverage.t
Inline-CPP-0.46/grammar/t/16varlst.t
Inline-CPP-0.46/grammar/t/13vararg.t
Inline-CPP-0.46/grammar/t/12retlst.t
Inline-CPP-0.46/grammar/t/17memberarray.t
Inline-CPP-0.46/grammar/t/06deflt.t
Inline-CPP-0.46/grammar/t/07static.t
Inline-CPP-0.46/grammar/t/08anon.t
Inline-CPP-0.46/grammar/t/04const.t
Inline-CPP-0.46/CPP.pm
Inline-CPP-0.46/META.json
Inline-CPP-0.46/lib/
Inline-CPP-0.46/lib/Inline/
Inline-CPP-0.46/lib/Inline/CPP/
Inline-CPP-0.46/lib/Inline/CPP/Config.pm
Inline-CPP-0.46/lib/Inline/CPP.pod
  CPAN.pm: Building D/DA/DAVIDO/Inline-CPP-0.46.tar.gz
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Warning: prerequisite Inline version 0.53 not found. at Makefile.PL line 49.
Warning: prerequisite Inline::C version 0.53 not found. at Makefile.PL line 49.
This will configure and build Inline::C++.
What default C++ compiler would you like to use? [C:Perlsitebing++.exe]
What default libraries would you like to include? [-lstdc++]
Detected <iostream> style headers. ('.h' not needed.)
Checking if your kit is complete...
Looks good
Warning: prerequisite Inline 0.53 not found. We have 0.52.
Warning: prerequisite Inline::C 0.53 not found. We have 0.52.
Writing Makefile for Inline::CPP::grammar
Writing MYMETA.yml and MYMETA.json
Writing Makefile for Inline::CPP
Writing MYMETA.yml and MYMETA.json
---- Unsatisfied dependencies detected during ----
----       DAVIDO/Inline-CPP-0.46.tar.gz      ----
    Inline::C [requires]
    Inline [requires]
Running make test
  Delayed until after prerequisites
Running make install
  Delayed until after prerequisites
Running install for module 'Inline::C'
Running make for S/SI/SISYPHUS/Inline-0.53.tar.gz
Fetching with LWP:
http://ppm.activestate.com/CPAN/authors/id/S/SI/SISYPHUS/Inline-0.53.tar.gz
Fetching with LWP:
http://ppm.activestate.com/CPAN/authors/id/S/SI/SISYPHUS/CHECKSUMS
Checksum for C:PerlcpansourcesauthorsidSSISISYPHUSInline-0.53.tar.gz ok
Inline-0.53/
Inline-0.53/C/
Inline-0.53/C/C-Cookbook.pod
Inline-0.53/C/C.pm
Inline-0.53/C/C.pod
Inline-0.53/C/Changes
Inline-0.53/C/lib/
Inline-0.53/C/lib/Inline/
Inline-0.53/C/lib/Inline/C/
Inline-0.53/C/lib/Inline/C/ParseRecDescent.pm
Inline-0.53/C/lib/Inline/C/ParseRegExp.pm
Inline-0.53/C/Makefile.PL
Inline-0.53/C/README
Inline-0.53/C/rt/
Inline-0.53/C/rt/grammars.t
Inline-0.53/C/t/
Inline-0.53/C/t/00init.t
Inline-0.53/C/t/01syntax.t
Inline-0.53/C/t/02config.t
Inline-0.53/C/t/03typemap.t
Inline-0.53/C/t/04perlapi.t
Inline-0.53/C/t/05xsmode.t
Inline-0.53/C/t/06parseregexp.t
Inline-0.53/C/t/07typemap_multi.t
Inline-0.53/C/t/08taint.t
Inline-0.53/C/t/08taint_1.p
Inline-0.53/C/t/08taint_2.p
Inline-0.53/C/t/08taint_3.p
Inline-0.53/C/t/09parser.t
Inline-0.53/C/t/10callback.t
Inline-0.53/C/t/11default_readonly.t
Inline-0.53/C/t/12taint_old.t
Inline-0.53/C/t/14void_arg.t
Inline-0.53/C/t/15ccflags.t
Inline-0.53/C/t/16ccflagsex.t
Inline-0.53/C/t/17prehead.t
Inline-0.53/C/t/18quote_space.t
Inline-0.53/C/t/19INC.t
Inline-0.53/C/t/20eval.t
Inline-0.53/C/t/21read_DATA.t
Inline-0.53/C/t/22read_DATA_2.t
Inline-0.53/C/t/23validate.t
Inline-0.53/C/t/bar/
Inline-0.53/C/t/bar/find_me_in_bar.h
Inline-0.53/C/t/foo/
Inline-0.53/C/t/foo/find_me_in_foo.h
Inline-0.53/C/t/prehead.in
Inline-0.53/C/t/soldier_typemap
Inline-0.53/C/t/typemap
Inline-0.53/Changes
Inline-0.53/Inline-API.pod
Inline-0.53/Inline-FAQ.pod
Inline-0.53/Inline-Support.pod
Inline-0.53/Inline.pm
Inline-0.53/Inline.pod
Inline-0.53/kobes.log
Inline-0.53/lib/
Inline-0.53/lib/Inline/
Inline-0.53/lib/Inline/denter.pm
Inline-0.53/lib/Inline/Foo.pm
Inline-0.53/lib/Inline/MakeMaker/
Inline-0.53/lib/Inline/MakeMaker/Changes
Inline-0.53/lib/Inline/MakeMaker.pm
Inline-0.53/Makefile.PL
Inline-0.53/MANIFEST
Inline-0.53/modules/
Inline-0.53/modules/Math/
Inline-0.53/modules/Math/Simple/
Inline-0.53/modules/Math/Simple/Changes
Inline-0.53/modules/Math/Simple/Makefile.PL
Inline-0.53/modules/Math/Simple/MANIFEST
Inline-0.53/modules/Math/Simple/Simple.pm
Inline-0.53/modules/Math/Simple/test.pl
Inline-0.53/README
Inline-0.53/symbols.perl
Inline-0.53/t/
Inline-0.53/t/00init.t
Inline-0.53/t/01usages.t
Inline-0.53/t/02config.t
Inline-0.53/t/03errors.t
Inline-0.53/t/04create.t
Inline-0.53/t/05files.t
Inline-0.53/t/06rewrite_config.p
Inline-0.53/t/06rewrite_config.t
Inline-0.53/t/07rewrite2_config.p
Inline-0.53/t/07rewrite2_config.t
Inline-0.53/t/file
Inline-0.53/ToDo
  CPAN.pm: Building S/SI/SISYPHUS/Inline-0.53.tar.gz
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Checking if your kit is complete...
Looks good
Inline::C is packaged with Inline.pm because it is the most commonly used
Inline Language Support Module (ILSM).
See also: Inline::ASM, ::Awk, ::BC, ::Basic, ::Befunge, ::CPP (C++), ::CPR,
          ::Foo, ::Guile, ::Java, ::Octave, ::PERL, ::Python, ::Ruby, ::TT,
          ::Tcl and ::WebChat.
Config.pm indicates that your version of Perl was built with this C compiler:
    C:Perlsitebingcc.exe
I have located this compiler on your system.
Do you want to install Inline::C? [y] y
Writing Makefile for Inline::C
Writing MYMETA.yml and MYMETA.json
Writing Makefile for Inline
Writing MYMETA.yml and MYMETA.json
Fixing Makefile for MSWin32
cp Inline.pod bliblibInline.pod
cp lib/Inline/MakeMaker/Changes bliblibInlineMakeMakerChanges
cp lib/Inline/denter.pm bliblibInlinedenter.pm
AutoSplitting bliblibInlinedenter.pm (bliblibautoInlinedenter)
cp Inline.pm bliblibInline.pm
AutoSplitting bliblibInline.pm (bliblibautoInline)
cp lib/Inline/Foo.pm bliblibInlineFoo.pm
cp Inline-API.pod bliblibInline-API.pod
cp lib/Inline/MakeMaker.pm bliblibInlineMakeMaker.pm
cp Inline-FAQ.pod bliblibInline-FAQ.pod
cp Inline-Support.pod bliblibInline-Support.pod
cp lib/Inline/C/ParseRegExp.pm ..bliblibInlineCParseRegExp.pm
cp C-Cookbook.pod ..bliblibInlineC-Cookbook.pod
cp C.pm ..bliblibInlineC.pm
cp C.pod ..bliblibInlineC.pod
cp lib/Inline/C/ParseRecDescent.pm ..bliblibInlineCParseRecDescent.pm
  SISYPHUS/Inline-0.53.tar.gz
  C:Perlsitebindmake.exe -- OK
Running make test
C:Perlbinperl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'bliblib', 'blibarch')" t/*.t
t/00init.t ............. ok
t/01usages.t ........... ok
t/02config.t ........... ok
t/03errors.t ........... ok
t/04create.t ........... ok
t/05files.t ............ ok
t/06rewrite_config.t ... ok
t/07rewrite2_config.t .. ok
All tests successful.
Files=8, Tests=19, 15 wallclock secs ( 0.11 usr +  0.06 sys =  0.17 CPU)
Result: PASS
C:Perlbinperl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, '..bliblib', '..blibarch')" t/*.t
t/00init.t .............. ok
t/01syntax.t ............ ok
t/02config.t ............ ok
t/03typemap.t ........... ok
t/04perlapi.t ........... ok
t/05xsmode.t ............ ok
t/06parseregexp.t ....... ok
t/07typemap_multi.t ..... ok
t/08taint.t ............. ok
t/09parser.t ............
This test could take a couple of minutes to run
t/09parser.t ............ ok
t/10callback.t .......... ok
t/11default_readonly.t .. ok
t/12taint_old.t ......... Skipped - applies only to perl 5.6.x
t/12taint_old.t ......... ok
t/14void_arg.t .......... ok
t/15ccflags.t ........... ok
t/16ccflagsex.t ......... ok
t/17prehead.t ........... ok
t/18quote_space.t ....... ok
t/19INC.t ............... ok
t/20eval.t .............. ok
t/21read_DATA.t ......... ok
t/22read_DATA_2.t ....... ok
t/23validate.t .......... ok
All tests successful.
Files=23, Tests=71, 165 wallclock secs ( 0.12 usr +  0.05 sys =  0.17 CPU)
Result: PASS
  SISYPHUS/Inline-0.53.tar.gz
  C:Perlsitebindmake.exe test -- OK
Running make install
Prepending C:PerlcpanbuildInline-0.53-JPPUvK/blib/arch C:PerlcpanbuildInline-0.53-JPPUvK/blib/lib to PERL5LIB for 'install'
Installing C:PerlsitelibInline.pm
Installing C:PerlsitelibInline.pod
Installing C:PerlsitelibInlineC.pm
Installing C:PerlsitelibInlineMakeMaker.pm
Installing C:PerlsitelibInlineMakeMakerChanges
Appending installation info to C:Perllib/perllocal.pod
  SISYPHUS/Inline-0.53.tar.gz
  C:Perlsitebindmake.exe install  -- OK
Inline is up to date (0.53).
Running make for D/DA/DAVIDO/Inline-CPP-0.46.tar.gz
  Has already been unwrapped into directory C:PerlcpanbuildInline-CPP-0.46-QMmSMq
  CPAN.pm: Building D/DA/DAVIDO/Inline-CPP-0.46.tar.gz
cp lib/Inline/CPP/Config.pm bliblibInlineCPPConfig.pm
cp CPP.pm bliblibInlineCPP.pm
cp lib/Inline/CPP.pod bliblibInlineCPP.pod
cp grammar.pm ..bliblibInlineCPPgrammar.pm
  DAVIDO/Inline-CPP-0.46.tar.gz
  C:Perlsitebindmake.exe -- OK
Running make test
C:Perlbinperl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'bliblib', 'blibarch')" t/*.t
t/00load_prereqs.t ..... # $Config{osname}:     MSWin32
# $Config{cc}:         C:Perlsitebingcc.exe
# $Config{gccversion}: 3.4.5 (mingw-vista special r3)
t/00load_prereqs.t ..... ok
t/01fn_cans.t .......... ok
t/02basic.t ............ ok
t/03prefix.t ........... ok
t/04charptr.t .......... ok
t/05pod.t .............. skipped: Author Test: Set $ENV{RELEASE_TESTING} to a true value to run.
t/06fn_regress.t ....... ok
t/07perlcritic.t ....... skipped: Author Test: Set $ENV{RELEASE_TESTING} to a true value to run.
t/08cppguess.t ......... # ExtUtils::CppGuess not installed.  This set of tests and diagnostics
# is more thorough when ExtUtils::CppGuess can be loaded.
# Detected basic defaults (Strawberry, etc.).
#
# Compiler guess:
t/08cppguess.t ......... 1/2 #  Makefile.PL approach: [C:Perlsitebing++.exe].
#
# Linker guess:
#       Makefile.PL approach: [-lstdc++].
t/08cppguess.t ......... ok
t/09pod_coverage.t ..... skipped: Author Test: Set $ENV{RELEASE_TESTING} to a true value to run.
t/10kwalitee.t ......... skipped: Author Test: Set $ENV{RELEASE_TESTING} to a true value to run.
t/11rewrite_config.t ... skipped: Author Test: Set $ENV{RELEASE_TESTING} to a true value to run.
t/12custom_libs.t ...... ok
t/13version_numbers.t .. skipped: Author Test: Set $ENV{RELEASE_TESTING} to a true value to run.
t/14changes.t .......... skipped: Author tests skipped.  Set $ENV{RELEASE_TESTING} to run
All tests successful.
Files=15, Tests=29, 22 wallclock secs ( 0.09 usr +  0.05 sys =  0.14 CPU)
Result: PASS
C:Perlbinperl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, '..bliblib', '..blibarch')" t/*.t
t/00pod_coverage.t .. ok
t/01nherit.t ........ ok
t/02scope.t ......... ok
t/03inline.t ........ ok
t/04const.t ......... ok
t/05virt.t .......... ok
t/06deflt.t ......... ok
t/07static.t ........ ok
t/08anon.t .......... ok
t/09purevt.t ........ ok
t/10struct.t ........ ok
t/11minhrt.t ........ ok
t/12retlst.t ........ ok
t/13vararg.t ........ ok
t/14const.t ......... ok
t/15stvar.t ......... ok
t/16varlst.t ........ ok
t/17memberarray.t ... ok
All tests successful.
Test Summary Report
-------------------
t/11minhrt.t      (Wstat: 0 Tests: 38 Failed: 0)
  TODO passed:   28-31
Files=18, Tests=79, 89 wallclock secs ( 0.14 usr +  0.00 sys =  0.14 CPU)
Result: PASS
  DAVIDO/Inline-CPP-0.46.tar.gz
  C:Perlsitebindmake.exe test -- OK
Running make install
Prepending C:PerlcpanbuildInline-CPP-0.46-QMmSMq/blib/arch C:PerlcpanbuildInline-CPP-0.46-QMmSMq/blib/lib to PERL5LIB for 'install'
Installing C:PerlsitelibInlineCPP.pm
Installing C:PerlsitelibInlineCPP.pod
Installing C:PerlsitelibInlineCPPConfig.pm
Installing C:PerlsitelibInlineCPPgrammar.pm
Appending installation info to C:Perllib/perllocal.pod
  DAVIDO/Inline-CPP-0.46.tar.gz
  C:Perlsitebindmake.exe install  -- OK
cpan> exit
Lockfile removed.
c:Perl>

希望这有帮助。