swig+perl+FreeBSD
Добавлено: 2014-10-24 12:53:41
Всем день добрый!
Есть в FreeBSD 10 такая библиотека - libvmmapi.so у нее так же есть и исходники в папке /usr/src/lib/libvmmapi/ вопрос в том, что необходимо создать модуль Perl для использования функций данной библиотеки. Решил использовать SWIG, однако не удается скомпилировать выходной С файл SWIG'а. Может кто уже работал с этой программой подскажите в чем может быть дело.
Мои действия:
Есть в FreeBSD 10 такая библиотека - libvmmapi.so у нее так же есть и исходники в папке /usr/src/lib/libvmmapi/ вопрос в том, что необходимо создать модуль Perl для использования функций данной библиотеки. Решил использовать SWIG, однако не удается скомпилировать выходной С файл SWIG'а. Может кто уже работал с этой программой подскажите в чем может быть дело.
Мои действия:
Код: Выделить всё
user# swig3.0 -module libvmmapi -perl5 vmmapi.h
user# ls
Makefile vmmapi.h
libvmmapi.pm vmmapi_freebsd.c
vmmapi.c vmmapi_wrap.c
user# make
user# ls
Makefile vmmapi.o
libvmmapi.a vmmapi.po
libvmmapi.pm vmmapi_freebsd.c
libvmmapi_p.a vmmapi_freebsd.o
vmmapi.c vmmapi_freebsd.po
vmmapi.h vmmapi_wrap.c
user# clang -fPIC -c vmmapi_wrap.c -I/usr/local/lib/perl5/5.16/mach/CORE -Dbool=char
vmmapi_wrap.c:1873:19: warning: implicit declaration of
function 'vm_create' is invalid in C99
[-Wimplicit-function-declaration]
result = (int)vm_create((char const *)arg1);
^
vmmapi_wrap.c:1902:30: warning: implicit declaration of
function 'vm_open' is invalid in C99
[-Wimplicit-function-declaration]
result = (struct vmctx *)vm_open((char const *)arg1);
^
vmmapi_wrap.c:1902:14: warning: cast to 'struct vmctx *' from
smaller integer type 'int' [-Wint-to-pointer-cast]
result = (struct vmctx *)vm_open((char const *)arg1);
^
vmmapi_wrap.c:1929:5: warning: implicit declaration of
function 'vm_destroy' is invalid in C99
[-Wimplicit-function-declaration]
vm_destroy(arg1);
^
vmmapi_wrap.c:1966:19: warning: implicit declaration of
function 'vm_parse_memsize' is invalid in C99
[-Wimplicit-function-declaration]
result = (int)vm_parse_memsize((char const *)arg1,arg2);
^
vmmapi_wrap.c:2026:19: warning: implicit declaration of
function 'vm_get_memory_seg' is invalid in C99
[-Wimplicit-function-declaration]
result = (int)vm_get_memory_seg(arg1,arg2,arg3,arg4);
^
vmmapi_wrap.c:2045:24: error: variable has incomplete type
'enum vm_mmap_style'
enum vm_mmap_style arg3 ;
^
vmmapi_wrap.c:2045:10: note: forward declaration of 'enum
vm_mmap_style'
enum vm_mmap_style arg3 ;
^
vmmapi_wrap.c:2073:12: error: cast to incomplete type 'enum
vm_mmap_style'
arg3 = (enum vm_mmap_style)(val3);
^
vmmapi_wrap.c:2045:10: note: forward declaration of 'enum
vm_mmap_style'
enum vm_mmap_style arg3 ;
^
vmmapi_wrap.c:2074:19: warning: implicit declaration of
function 'vm_setup_memory' is invalid in C99
[-Wimplicit-function-declaration]
result = (int)vm_setup_memory(arg1,arg2,arg3);
^
vmmapi_wrap.c:2128:22: warning: implicit declaration of
function 'vm_map_gpa' is invalid in C99
[-Wimplicit-function-declaration]
result = (void *)vm_map_gpa(arg1,arg2,arg3);
^
vmmapi_wrap.c:2128:14: warning: cast to 'void *' from smaller
integer type 'int' [-Wint-to-pointer-cast]
result = (void *)vm_map_gpa(arg1,arg2,arg3);
^
vmmapi_wrap.c:2188:19: warning: implicit declaration of
function 'vm_get_gpa_pmap' is invalid in C99
[-Wimplicit-function-declaration]
result = (int)vm_get_gpa_pmap(arg1,arg2,arg3,arg4);
^
vmmapi_wrap.c:2220:14: warning: implicit declaration of
function 'vm_get_lowmem_limit' is invalid in C99
[-Wimplicit-function-declaration]
result = vm_get_lowmem_limit(arg1);
^
vmmapi_wrap.c:2261:5: warning: implicit declaration of
function 'vm_set_lowmem_limit' is invalid in C99
[-Wimplicit-function-declaration]
vm_set_lowmem_limit(arg1,arg2);
^
vmmapi_wrap.c:2347:19: warning: implicit declaration of
function 'vm_set_desc' is invalid in C99
[-Wimplicit-function-declaration]
result = (int)vm_set_desc(arg1,arg2,arg3,arg4,arg5,arg6);
^
vmmapi_wrap.c:2419:19: warning: implicit declaration of
function 'vm_get_desc' is invalid in C99
[-Wimplicit-function-declaration]
result = (int)vm_get_desc(arg1,arg2,arg3,arg4,arg5,arg6);
^
vmmapi_wrap.c:2487:19: warning: implicit declaration of
function 'vm_set_register' is invalid in C99
[-Wimplicit-function-declaration]
result = (int)vm_set_register(arg1,arg2,arg3,arg4);
^
vmmapi_wrap.c:2543:19: warning: implicit declaration of
function 'vm_get_register' is invalid in C99
[-Wimplicit-function-declaration]
result = (int)vm_get_register(arg1,arg2,arg3,arg4);
^
vmmapi_wrap.c:2607:19: warning: implicit declaration of
function 'vm_run' is invalid in C99
[-Wimplicit-function-declaration]
result = (int)vm_run(arg1,arg2,arg3,arg4);
^
vmmapi_wrap.c:2647:19: warning: implicit declaration of
function 'vm_apicid2vcpu' is invalid in C99
[-Wimplicit-function-declaration]
result = (int)vm_apicid2vcpu(arg1,arg2);
^
vmmapi_wrap.c:2664:24: error: variable has incomplete type
'enum vm_event_type'
enum vm_event_type arg3 ;
^
vmmapi_wrap.c:2664:10: note: forward declaration of 'enum
vm_event_type'
enum vm_event_type arg3 ;
^
vmmapi_wrap.c:2695:12: error: cast to incomplete type 'enum
vm_event_type'
arg3 = (enum vm_event_type)(val3);
^
vmmapi_wrap.c:2664:10: note: forward declaration of 'enum
vm_event_type'
enum vm_event_type arg3 ;
^
vmmapi_wrap.c:2701:19: warning: implicit declaration of
function 'vm_inject_event' is invalid in C99
[-Wimplicit-function-declaration]
result = (int)vm_inject_event(arg1,arg2,arg3,arg4);
^
vmmapi_wrap.c:2722:24: error: variable has incomplete type
'enum vm_event_type'
enum vm_event_type arg3 ;
^
vmmapi_wrap.c:2722:10: note: forward declaration of 'enum
vm_event_type'
enum vm_event_type arg3 ;
^
vmmapi_wrap.c:2756:12: error: cast to incomplete type 'enum
vm_event_type'
arg3 = (enum vm_event_type)(val3);
^
vmmapi_wrap.c:2722:10: note: forward declaration of 'enum
vm_event_type'
enum vm_event_type arg3 ;
^
vmmapi_wrap.c:2767:19: warning: implicit declaration of
function 'vm_inject_event2' is invalid in C99
[-Wimplicit-function-declaration]
result = (int)vm_inject_event2(arg1,arg2,arg3,arg4,arg5);
^
vmmapi_wrap.c:2819:19: warning: implicit declaration of
function 'vm_lapic_irq' is invalid in C99
[-Wimplicit-function-declaration]
result = (int)vm_lapic_irq(arg1,arg2,arg3);
^
vmmapi_wrap.c:2859:19: warning: implicit declaration of
function 'vm_inject_nmi' is invalid in C99
[-Wimplicit-function-declaration]
result = (int)vm_inject_nmi(arg1,arg2);
^
vmmapi_wrap.c:2890:19: warning: implicit declaration of
function 'vm_capability_name2type' is invalid in C99
[-Wimplicit-function-declaration]
result = (int)vm_capability_name2type((char cons...
^
vmmapi_wrap.c:2918:22: warning: implicit declaration of
function 'vm_capability_type2name' is invalid in C99
[-Wimplicit-function-declaration]
result = (char *)vm_capability_type2name(arg1);
^
vmmapi_wrap.c:2918:14: warning: cast to 'char *' from smaller
integer type 'int' [-Wint-to-pointer-cast]
result = (char *)vm_capability_type2name(arg1);
^
vmmapi_wrap.c:2933:22: error: variable has incomplete type
'enum vm_cap_type'
enum vm_cap_type arg3 ;
^
vmmapi_wrap.c:2933:10: note: forward declaration of
'enum vm_cap_type'
enum vm_cap_type arg3 ;
^
vmmapi_wrap.c:2964:12: error: cast to incomplete type
'enum vm_cap_type'
arg3 = (enum vm_cap_type)(val3);
^
vmmapi_wrap.c:2933:10: note: forward declaration of
'enum vm_cap_type'
enum vm_cap_type arg3 ;
^
vmmapi_wrap.c:2970:19: warning: implicit declaration of
function 'vm_get_capability' is invalid in C99
[-Wimplicit-function-declaration]
result = (int)vm_get_capability(arg1,arg2,arg3,arg4);
^
vmmapi_wrap.c:2991:22: error: variable has incomplete type
'enum vm_cap_type'
enum vm_cap_type arg3 ;
^
vmmapi_wrap.c:2991:10: note: forward declaration of
'enum vm_cap_type'
enum vm_cap_type arg3 ;
^
vmmapi_wrap.c:3022:12: error: cast to incomplete type
'enum vm_cap_type'
arg3 = (enum vm_cap_type)(val3);
^
vmmapi_wrap.c:2991:10: note: forward declaration of
'enum vm_cap_type'
enum vm_cap_type arg3 ;
^
vmmapi_wrap.c:3028:19: warning: implicit declaration of
function 'vm_set_capability' is invalid in C99
[-Wimplicit-function-declaration]
result = (int)vm_set_capability(arg1,arg2,arg3,arg4);
^
vmmapi_wrap.c:3086:19: warning: implicit declaration of
function 'vm_assign_pptdev' is invalid in C99
[-Wimplicit-function-declaration]
result = (int)vm_assign_pptdev(arg1,arg2,arg3,arg4);
^
vmmapi_wrap.c:3144:19: warning: implicit declaration of
function 'vm_unassign_pptdev' is invalid in C99
[-Wimplicit-function-declaration]
result = (int)vm_unassign_pptdev(arg1,arg2,arg3,arg4);
^
vmmapi_wrap.c:3238:19: warning: implicit declaration of
function 'vm_map_pptdev_mmio' is invalid in C99
[-Wimplicit-function-declaration]
result = (int)vm_map_pptdev_mmio(arg1,arg2,arg3,a...
^
vmmapi_wrap.c:3330:19: warning: implicit declaration of
function 'vm_setup_msi' is invalid in C99
[-Wimplicit-function-declaration]
result = (int)vm_setup_msi(arg1,arg2,arg3,arg4,ar...
^
vmmapi_wrap.c:3454:19: warning: implicit declaration of
function 'vm_setup_msix' is invalid in C99
[-Wimplicit-function-declaration]
result = (int)vm_setup_msix(arg1,arg2,arg3,arg4,a...
^
vmmapi_wrap.c:3516:26: warning: implicit declaration of
function 'vm_get_stats' is invalid in C99
[-Wimplicit-function-declaration]
result = (uint64_t *)vm_get_stats(arg1,arg2,arg3,arg4);
^
vmmapi_wrap.c:3516:14: warning: cast to 'uint64_t *' (aka
'unsigned long *') from smaller integer type 'int'
[-Wint-to-pointer-cast]
result = (uint64_t *)vm_get_stats(arg1,arg2,arg3,arg4);
^
vmmapi_wrap.c:3558:22: warning: implicit declaration of
function 'vm_get_stat_desc' is invalid in C99
[-Wimplicit-function-declaration]
result = (char *)vm_get_stat_desc(arg1,arg2);
^
vmmapi_wrap.c:3558:14: warning: cast to 'char *' from smaller
integer type 'int' [-Wint-to-pointer-cast]
result = (char *)vm_get_stat_desc(arg1,arg2);
^
vmmapi_wrap.c:3604:19: warning: implicit declaration of
function 'vm_get_x2apic_state' is invalid in C99
[-Wimplicit-function-declaration]
result = (int)vm_get_x2apic_state(arg1,arg2,arg3);
^
vmmapi_wrap.c:3623:23: error: variable has incomplete type
'enum x2apic_state'
enum x2apic_state arg3 ;
^
vmmapi_wrap.c:3623:10: note: forward declaration of
'enum x2apic_state'
enum x2apic_state arg3 ;
^
vmmapi_wrap.c:3651:12: error: cast to incomplete type
'enum x2apic_state'
arg3 = (enum x2apic_state)(val3);
^
vmmapi_wrap.c:3623:10: note: forward declaration of
'enum x2apic_state'
enum x2apic_state arg3 ;
^
vmmapi_wrap.c:3652:19: warning: implicit declaration of
function 'vm_set_x2apic_state' is invalid in C99
[-Wimplicit-function-declaration]
result = (int)vm_set_x2apic_state(arg1,arg2,arg3);
^
vmmapi_wrap.c:3692:19: warning: implicit declaration of
function 'vcpu_reset' is invalid in C99
[-Wimplicit-function-declaration]
result = (int)vcpu_reset(arg1,arg2);
^
vmmapi_wrap.c:3786:19: warning: implicit declaration of
function 'vm_setup_freebsd_registers' is invalid in C99
[-Wimplicit-function-declaration]
result = (int)vm_setup_freebsd_registers(arg1,arg...
^
vmmapi_wrap.c:3815:5: warning: implicit declaration of
function 'vm_setup_freebsd_gdt' is invalid in C99
[-Wimplicit-function-declaration]
vm_setup_freebsd_gdt(arg1);
^
vmmapi_wrap.c:4229:61: error: use of undeclared identifier
'VM_MMAP_NONE'
...SWIG_From_int SWIG_PERL_CALL_ARGS_1((int)(VM_MMAP_NO...
^
vmmapi_wrap.c:913:80: note: expanded from macro
'SWIG_PERL_CALL_ARGS_1'
...(SWIG_PERL_OBJECT_CALL arg1)
^
/usr/local/lib/perl5/5.16/mach/CORE/sv.h:1851:22: note:
expanded from macro 'sv_setsv'
sv_setsv_flags(dsv, ssv, SV_GMAGIC|SV_DO_COW_SVSETSV)
^
/usr/local/lib/perl5/5.16/mach/CORE/embed.h:628:59: note:
expanded from macro 'sv_setsv_flags'
...Perl_sv_setsv_flags(aTHX_ a,b,c)
^
vmmapi_wrap.c:4234:61: error: use of undeclared identifier
'VM_MMAP_ALL'
...SWIG_From_int SWIG_PERL_CALL_ARGS_1((int)(VM_MMAP_AL...
^
vmmapi_wrap.c:913:80: note: expanded from macro
'SWIG_PERL_CALL_ARGS_1'
...(SWIG_PERL_OBJECT_CALL arg1)
^
/usr/local/lib/perl5/5.16/mach/CORE/sv.h:1851:22: note:
expanded from macro 'sv_setsv'
sv_setsv_flags(dsv, ssv, SV_GMAGIC|SV_DO_COW_SVSETSV)
^
/usr/local/lib/perl5/5.16/mach/CORE/embed.h:628:59: note:
expanded from macro 'sv_setsv_flags'
...Perl_sv_setsv_flags(aTHX_ a,b,c)
^
vmmapi_wrap.c:4239:61: error: use of undeclared identifier
'VM_MMAP_SPARSE'
...SWIG_From_int SWIG_PERL_CALL_ARGS_1((int)(VM_MMAP_SP...
^
vmmapi_wrap.c:913:80: note: expanded from macro
'SWIG_PERL_CALL_ARGS_1'
...(SWIG_PERL_OBJECT_CALL arg1)
^
/usr/local/lib/perl5/5.16/mach/CORE/sv.h:1851:22: note:
expanded from macro 'sv_setsv'
sv_setsv_flags(dsv, ssv, SV_GMAGIC|SV_DO_COW_SVSETSV)
^
/usr/local/lib/perl5/5.16/mach/CORE/embed.h:628:59: note:
expanded from macro 'sv_setsv_flags'
...Perl_sv_setsv_flags(aTHX_ a,b,c)
^
41 warnings and 15 errors generated.
vmmapi.h:48:42: error: unknown type name 'size_t'
int vm_parse_memsize(const char *optarg, size_t *...
^
vmmapi.h:49:42: error: unknown type name 'vm_paddr_t'
int vm_get_memory_seg(struct vmctx *ctx, vm_paddr...
^
vmmapi.h:49:58: error: unknown type name 'size_t'
...vmctx *ctx, vm_paddr_t gpa, size_t *ret_len,
^
vmmapi.h:51:40: error: unknown type name 'size_t'
int vm_setup_memory(struct vmctx *ctx, size_t len...
^
vmmapi.h:52:37: error: unknown type name 'vm_paddr_t'
void *vm_map_gpa(struct vmctx *ctx, vm_paddr_t gad...
^
vmmapi.h:52:55: error: unknown type name 'size_t'
...vmctx *ctx, vm_paddr_t gaddr, size_t len);
^
vmmapi.h:53:37: error: unknown type name 'uint64_t'
int vm_get_gpa_pmap(struct vmctx *, uint64_t gpa...
^
vmmapi.h:53:51: error: unknown type name 'uint64_t'
int vm_get_gpa_pmap(struct vmctx *, uint64_t gpa, uint64_...
^
vmmapi.h:54:1: error: unknown type name 'uint32_t'
uint32_t vm_get_lowmem_limit(struct vmctx *ctx);
^
vmmapi.h:55:45: error: unknown type name 'uint32_t'
void vm_set_lowmem_limit(struct vmctx *ctx, uint32...
^
vmmapi.h:57:7: error: unknown type name 'uint64_t'
uint64_t base, uint32_t limit, ui...
^
vmmapi.h:57:22: error: unknown type name 'uint32_t'
uint64_t base, uint32_t limit, ui...
^
vmmapi.h:57:38: error: unknown type name 'uint32_t'
...uint64_t base, uint32_t limit, uint32_t access);
^
vmmapi.h:59:7: error: unknown type name 'uint64_t'
uint64_t *base, uint32_t *limit, ...
^
vmmapi.h:59:23: error: unknown type name 'uint32_t'
uint64_t *base, uint32_t *limit, ...
^
vmmapi.h:59:40: error: unknown type name 'uint32_t'
...uint64_t *base, uint32_t *limit, uint32_t *access);
^
vmmapi.h:60:59: error: unknown type name 'uint64_t'
...vmctx *ctx, int vcpu, int reg, uint64_t val);
^
vmmapi.h:61:59: error: unknown type name 'uint64_t'
...vmctx *ctx, int vcpu, int reg, uint64_t *retval);
^
vmmapi.h:62:41: error: unknown type name 'uint64_t'
int vm_run(struct vmctx *ctx, int vcpu, uint64_t rip,
^
vmmapi.h:63:16: warning: declaration of 'struct vm_exit' will
not be visible outside of this function [-Wvisibility]
struct vm_exit *ret_vmexit);
^
vmmapi.h:65:55: warning: declaration of 'enum vm_event_type'
will not be visible outside of this function
[-Wvisibility]
...vmctx *ctx, int vcpu, enum vm_event_type type,
^
vmmapi.h:67:56: warning: declaration of 'enum vm_event_type'
will not be visible outside of this function
[-Wvisibility]
...vmctx *ctx, int vcpu, enum vm_event_type type,
^
vmmapi.h:73:57: warning: declaration of 'enum vm_cap_type'
will not be visible outside of this function
[-Wvisibility]
...vmctx *ctx, int vcpu, enum vm_cap_type cap,
^
vmmapi.h:75:57: warning: declaration of 'enum vm_cap_type'
will not be visible outside of this function
[-Wvisibility]
...vmctx *ctx, int vcpu, enum vm_cap_type cap,
^
fatal error: too many errors emitted, stopping now
[-ferror-limit=]