2011-11-15 2 views
3

Google URL Library 기능 중 일부를 perl 모듈로 노출하려고 시도하고 있습니다. 여기 및 다른 곳의 일부 게시물을 기반으로하면 XSPP과 같이 시작하는 것이 좋습니다. 여기에 지금까지합니다 (googleurl lib 디렉토리의 컴파일 된 버전으로 시작) 생성 한 작업은 다음과 같습니다 Perl XSPP - std :: string의 다중 정의

나는이 xspp 파일 (간결함을 위해 생략 몇 가지 방법) 생성 :

#include "gurl.h" 
%typemap{std::string}; 
%typemap{bool}; 
%module{Google::URL}; 
class GURL 
{ 
    %name{new} GURL(std::string& url); 
    ~GURL(); 
    bool is_valid(); 
    bool is_empty(); 
    std::string spec(); 
    std::string possibly_invalid_spec(); 
    std::string scheme(); 
    std::string username(); 
    std::string password(); 
    std::string host(); 
    std::string port(); 
    std::string path(); 
    std::string query(); 
    std::string ref(); 
    bool has_scheme(); 
    bool has_username(); 
    bool has_password(); 
    bool has_host(); 
    bool has_port(); 
    bool has_path(); 
    bool has_query(); 
    bool has_ref(); 
}; 

을 그리고 나는이 Makefile을 만들었습니다. PL 파일 :

use 5.012; 
use Module::Build::WithXSpp; 
my $build = Module::Build::WithXSpp->new(
    module_name  => 'Google::URL::GURL', 
    license   => 'perl', 
    extra_typemap_modules => { 
    'ExtUtils::Typemap::Default' => '0.01', 
    'ExtUtils::Typemap::STL' => '0.01', 
    }, 
    extra_linker_flags => '-L../googleurl -lgoogleurl', 
    extra_compiler_flags => '-I. -I.. -I../googleurl -I../googleurl/base -I../googleurl/src', 
); 

은 그럼 실행

perl Makefile.PL && ./Build 

.. 그리고 다음과 같은 오류가 발생합니다 :

WARNING: the following files are missing in your kit: 
    GURL.xs 
Please inform the author. 

Created MYMETA.yml and MYMETA.json 
Creating new 'Build' script for 'Google-URL-GURL' version '0.01' 
Building Google-URL-GURL 
Processing XS typemap files... 
Multiple definition of ctype 'std::string' in TYPEMAP section at ~/lib/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/ExtUtils/Typemaps.pm line 819. 

xspp 경험이있는 사람이라면 무엇이이 오류의 원인 일 수 있습니까? 위의 GURL.xsp 파일에서 xspp를 성공적으로 실행할 수 있으며 나에게 합리적인 출력을 생성합니다.

+0

왜 Build.PL 파일의 이름을 Makefile.PL으로 지정하고 있습니까? 그건 전혀 말이되지 않습니다! –

+0

@Leon - 내 부분에 대한 무지 - 이름을 바꿉니다. –

답변

6

ExtUtils::Typemaps::Default의 문서에 이미 ExtUtils::Typemaps::STL이 포함되어 있다고 분명히 말합니다. 후자를 extra_typemaps에서 제거하면 모두 작동합니다.

+0

* 부끄러움을 당한다. * Module :: Build :: WithXSpp보다 더 똑똑해야한다고 생각한다. – tsee