我想从python27.dll (C:Windows/SysWOW64 64)创建libpython27.a
:
/usr/i686-w64-mingw32/bin/dlltool -A --dllname python27.dll --def python27.def --output-lib libpython27.a
/usr/i686-w64-mingw32/bin/dlltool: Syntax error in def file python27.def:11使用-v运行dlltool,我得到:
/usr/i686-w64-mingw32/bin/dlltool: Using file: /usr/i686-w64-mingw32/bin/as
/usr/i686-w64-mingw32/bin/dlltool: Processing def file: python27.def
��/usr/i686-w64-mingw32/bin/dlltool: Syntax error in def file python27.def:11
/usr/i686-w64-mingw32/bin/dlltool: Processed def file
/usr/i686-w64-mingw32/bin/dlltool: Processing definitions
/usr/i686-w64-mingw32/bin/dlltool: Processed definitions
/usr/i686-w64-mingw32/bin/dlltool: Creating library file: libpython27.a
/usr/i686-w64-mingw32/bin/dlltool: run: /usr/i686-w64-mingw32/bin/as -o dlumbh.o dlumbh.s
/usr/i686-w64-mingw32/bin/dlltool: run: /usr/i686-w64-mingw32/bin/as -o dlumbt.o dlumbt.s
/usr/i686-w64-mingw32/bin/dlltool: Created lib file正如您所看到的,我得到了python27.def文件的语法错误,但是libpython27.a是生成的。
我创建python27.def如下(在Windows中)
python27.def:
; .text : RVA: 00001000, File offset: 00000400
; .rdata : RVA: 000e7000, File offset: 000e6000
; .data : RVA: 001b9000, File offset: 001b7e00
; .rsrc : RVA: 00214000, File offset: 00209200
; .reloc : RVA: 00215000, File offset: 00209a00
; Reading exports from section: .rdata
; Export table: python27.dll
; Ordinal base: 1
; Ordinal table RVA: 001b3300
; Name table RVA: 01b22b4
; Export address table RVA: 001b1268
LIBRARY python27.dll
EXPORTS
PyAST_Compile ; .text ; RVA 000c1a03
PyAST_FromNode ; .text ; RVA 000b394f
PyArena_AddPyObject ; .text ; RVA 000d4279
PyArena_Free ; .text ; RVA 000d4211
PyArena_Malloc ; .text ; RVA 000d424f
PyArena_New ; .text ; RVA 000d41bd
PyArg_Parse ; .text ; RVA 000cb1d6
PyArg_ParseTuple ; .text ; RVA 000cb218
PyArg_ParseTupleAndKeywords ; .text ; RVA 000ccb89
PyArg_UnpackTuple ; .text ; RVA 000cd191
PyArg_VaParse ; .text ; RVA 000cb25a
PyArg_VaParseTupleAndKeywords ; .text ; RVA 000ccc5c
PyBaseObject_Type DATA ; .data ; RVA 001d4728
PyBaseString_Type DATA ; .data ; RVA 001d8058
PyBool_FromLong ; .text ; RVA 00065ad7
PyBool_Type DATA ; .data ; RVA 001e6470
PyBuffer_FillContiguousStrides ; .text ; RVA 000631b8
PyBuffer_FillInfo ; .text ; RVA 0006320a
PyBuffer_FromContiguous ; .text ; RVA 00062f13
PyBuffer_FromMemory ; .text ; RVA 00065e2a
PyBuffer_FromObject ; .text ; RVA 00065dac
...
...我的程序有问题吗?制造python27.def?
注意:下面有一个libpython27.a,但是我读到了一些注释,它不能链接到交叉编译linux中的python扩展模块。
谢谢!
发布于 2019-03-08 19:08:28
最后,我安装了gendef (来自win-builds)并创建了python27.def
.\gendef.exe C:\Windows\SysWOW64\python27.dll然后,在Linux中,我成功地运行dlltool来创建libpython27.a:
i686-w64-mingw32-dlltool -A --dllname python27.dll --def python27.def --output-lib libpython27.alibpython27.a (Gendef)的大小:774580
libpython27.a的大小(对pexport失败):1470
双赢建设
https://stackoverflow.com/questions/55067503
复制相似问题