内联:: C构建失败

时间:2013-05-29 12:23:05

标签: perl perl-module nmake activeperl

我正在使用有效的perl 5.14.2。在这里,我尝试使用Inline :: C

在我的perl代码中使用Windows C库
use strict;

use Inline C => DATA =>
           CCFLAGS => '-std:C99 -Tx86-coff -Zi -Ob1 -fp:precise -W1 -Gd -Ze -Go -D_USER_SPACE_' =>
           INC  => '"-ID:\test\incl"' =>
           LIBS => '"-LD:\test\lib" -llib1 -llib2 -llib3 -llib4';


test();

__END__
__C__

#include <incl/hd1.h>

#include <stdio.h>

#define __STDC_FORMAT_MACROS
#include <inttypes.h>

void test(void) {
.........

当我尝试运行脚本时,它失败并出现以下错误

Warning. No Inline C functions bound to Perl in .\test.pl
Check your C function definition(s) for Inline compatibility


Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation.  All rights reserved.

        C:\Perl5.14\bin\perl.exe C:\Perl5.14\lib\ExtUtils\xsubpp  -typemap "C:\Perl5.14\lib\ExtUtils\typemap"  test_pl_7fbb.xs > test_pl_7fbb.xsc && C:\Perl5.14\bin\perl.exe -M
ExtUtils::Command -e "mv" -- test_pl_7fbb.xsc test_pl_7fbb.c
        cl -c  -I"D:/test" "-ID:\test\incl"  -std:C99 -Tx86-coff -Zi -Ob1 -fp:precise -W1 -Gd -Ze -Go -D_USER_SPACE_ -MD -Zi -DNDEBUG -O1    -DVERSIO
N=\"0.00\"  -DXS_VERSION=\"0.00\"  "-IC:\Perl5.14\lib\CORE"   test_pl_7fbb.c
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\cl.EXE"' : return code '0xc0000135'
Stop.

A problem was encountered while attempting to compile and install your Inline
C code. The command that failed was:
  C:\PROGRA~2\MICROS~1.0\VC\bin\nmake.exe > out.make 2>&1

The build directory was:
D:\test\_Inline\build\test_pl_7fbb

To debug the problem, cd to the build directory, and inspect the output files.

 at .\test.pl line 0
        ...propagated at C:/Perl5.14/site/lib/Inline/C.pm line 772.
INIT failed--call queue aborted.
PS D:\cmapl_test> perl -v

This is perl 5, version 14, subversion 2 (v5.14.2) built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2011, Larry Wall

Binary build 1402 [295342] provided by ActiveState http://www.ActiveState.com
Built Oct  7 2011 15:49:44

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.

我尝试使用以下命令构建test_pl_7fbb.c文件:

cl -c  "-ID:\test" "-ID:\test\include"  -std:C99 -Tx86-coff -Zi -Ob1 -fp:precise -W1 -
Gd -Ze -Go -D_USER_SPACE_  -MD -Zi -DNDEBUG -O1    "-DVERSION=0.00"  
"-DXS_VERSION=0.00"  "-IC:\Perl5.14\lib\CORE"   test_pl_7fbb.c

它完成没有错误。

我的猜测编译时Inline使用的选项-I“D:/ test”导致问题。

提前感谢您提供任何帮助。

2 个答案:

答案 0 :(得分:1)

您似乎安装了Visual C VC-9(VS 2008),但上次使用Activeperl的Inline C时,它需要VC-6。

如果这是原因,您可以尝试安装VC 6或切换到包含gcc 4.6工具链的Strawberry Perl。

答案 1 :(得分:1)

您可以尝试从ActivePerl的PPM服务器安装MinGW。它可能需要重新编译你安装的许多模块才能工作,但我确信它会让Inline :: C正常工作。