3

GoogleのURLライブラリ機能の一部をperlモジュールとして公開しようとしています。ここや他の場所でのいくつかの投稿に基づくと、XSPPから始めるのが良いと思われます。これまでに作成したものは次のとおりです(googleurl libのコンパイル済みバージョンから開始):

私はこの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を正常に実行でき、妥当な出力が生成されます。

4

1 に答える 1

6

ExtUtils :: Typemaps :: Defaultのドキュメントには、ExtUtils :: Typemaps::STLがすでに含まれていることが明記されています。後者をから削除すると、extra_typemapsすべて機能するはずです。

于 2011-11-15T19:16:01.267 に答える