当前位置:首页 » 编程软件 » 编译依赖

编译依赖

发布时间: 2022-01-09 17:53:42

编译安装python需要哪些依赖

依赖库:

//使用apt 安装即可
1.gcc, make, zlib1g-dev(压缩解压缩库)
安装过程需要的库。
2.libbz2-dev
bz2支持库,若在编译安装python前没有安装,将无法通过pip install 安装提供bz2格式的第三方库,会出现unsupported archive format: .tar.bz2的错误,例如爬虫库Scrapy依赖的Twisted。
3.libsqlite3-dev
sqlite3支持库,若在编译安装python前没有安装,则python中会缺失sqlite3模块,当引入sqlite3或使用依赖sqllite3的第三方库(例如Scrapy)时,会出现ImportError: No mol named _sqllite3的错误。
//以上为编译安装前需要安装的库,可能不够全面,会不断补充。
4.其他:安装第三方库需要的库
python3-dev, libxml2-dev, libxslt1, libffi-dev, libssl-dev等,在安装第三方库会有具体说明,不做过多解释。

安装:

//通过wget获取压缩包,这里选择3.6.1版
wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz
//解压
tar xJf Python-3.6.1.tar.xz
cd Python-3.6.1
./configure
make
/*这步如果需要sudo,请使用sudo -H命令,即sudo -H make install,避免pip等模块安装失败。
错误示例(pip安装失败):The directory '/home/ls/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
*/
make install

⑵ 怎么查看makefile编译依赖关系

目标,依赖,命令(规则),第一项目标,然后会有个:号,后面的就是依赖了

例如 hello.o : hello.c, a.o, b.o
gcc hello.c hello.o

hello.c, a.o,b.o就都是依赖,就这样

⑶ g++ 编译命令中依赖的动态库如果还依赖别的库,命令怎么设置

第一步,我先从简单的调用出发,定义了一个简单的函数,该函数仅仅实现一个整数加法求和:

LIBEXPORT_API int mySum(int a,int b){ return a+b;}
C# 导入定义:

public class RefComm
{
[DllImport("LibEncrypt.dll",
EntryPoint=" mySum ",
CharSet=CharSet.Auto,CallingConvention=CallingConvention.StdCall)]
public static extern int mySum (int a,int b);
}
在C#中调用测试:

int iSum = RefComm.mySum(,);

运行查看结果iSum为5,调用正确。第一步试验完成,说明在C#中能够调用自定义的动态链接库函数。

第二步,我定义了字符串操作的函数(简单起见,还是采用前面的函数名),返回结果为字符串:

LIBEXPORT_API char *mySum(char *a,char *b){sprintf(b,"%s",a); return a;}
C# 导入定义:

public class RefComm
{
[DllImport("LibEncrypt.dll",
EntryPoint=" mySum ",
CharSet=CharSet.Auto,
CallingConvention=CallingConvention.StdCall)]
public static extern string mySum (string a, string b);
}
在C#中调用测试:

string strDest="";
string strTmp= RefComm.mySum("45", strDest);

运行查看结果 strTmp 为"45",但是strDest为空。我修改动态链接库实现,返回结果为串b:

LIBEXPORT_API char *mySum(char *a,char *b){sprintf(b,"%s",a) return b;}
修改 C# 导入定义,将串b修改为ref方式:

public class RefComm
{
[DllImport("LibEncrypt.dll",
EntryPoint=" mySum ",
CharSet=CharSet.Auto,CallingConvention=CallingConvention.StdCall)]
public static extern string mySum (string a, ref string b);
}
在C#中再调用测试:

string strDest="";
string strTmp= RefComm.mySum("45", ref strDest);
运行查看结果 strTmp 和 strDest 均不对,含不可见字符。再修改 C# 导入定义,将CharSet从Auto修改为Ansi:

public class RefComm
{
[DllImport("LibEncrypt.dll",
EntryPoint=" mySum ",
CharSet=CharSet.Ansi,CallingConvention=CallingConvention.StdCall)]
public static extern string mySum (string a, string b);
}
在C#中再调用测试:

string strDest="";
string strTmp= RefComm. mySum("45", ref strDest);
运行查看结果 strTmp 为"45",但是串 strDest 没有赋值。第二步实现函数返回串,但是在函数出口参数中没能进行输出。再次修改 C# 导入定义,将串b修改为引用(ref):

public class RefComm
{
[DllImport("LibEncrypt.dll",
EntryPoint=" mySum ",
CharSet=CharSet.Ansi,CallingConvention=CallingConvention.StdCall)]
public static extern string mySum (string a, ref string b);
}

运行时调用失败,不能继续执行。

第三步,修改动态链接库实现,将b修改为双重指针:

LIBEXPORT_API char *mySum(char *a,char **b){sprintf((*b),"%s",a); return *b;}
C#导入定义:

public class RefComm
{
[DllImport("LibEncrypt.dll",
EntryPoint=" mySum ",
CharSet=CharSet.Ansi,CallingConvention=CallingConvention.StdCall)]
public static extern string mySum (string a, ref string b);
}
在C#中调用测试:

string strDest="";
string strTmp= RefComm. mySum("45", ref strDest);

运行查看结果 strTmp 和 strDest 均为"45",调用正确。第三步实现了函数出口参数正确输出结果。

第四步,修改动态链接库实现,实现整数参数的输出:

LIBEXPORT_API int mySum(int a,int b,int *c){ *c=a+b; return *c;}
C#导入的定义:

public class RefComm
{
[DllImport("LibEncrypt.dll",
EntryPoint=" mySum ",
CharSet=CharSet.Ansi,CallingConvention=CallingConvention.StdCall)]
public static extern int mySum (int a, int b,ref int c);
}
在C#中调用测试:

int c=0;
int iSum= RefComm. mySum(,, ref c);

运行查看结果iSum 和c均为5,调用正确。

经过以上几个步骤的试验,基本掌握了如何定义动态库函数以及如何在 C# 定义导入,有此基础,很快我实现了变长加密函数在 C# 中的调用,至此目标实现。

三、结论

在 C# 中调用 C++ 编写的动态链接库函数,如果需要出口参数输出,则需要使用指针,对于字符串,则需要使用双重指针,对于 C# 的导入定义,则需要使用引用(ref)定义。

对于函数返回值,C# 导入定义和 C++ 动态库函数声明定义需要保持一致,否则会出现函数调用失败。定义导入时,一定注意 CharSet 和 CallingConvention 参数,否则导致调用失败或结果异常。运行时,动态链接库放在 C# 程序的目录下即可,我这里是一个 C# 的动态链接库,两个动态链接库就在同一个目录下运行。

⑷ 编译源码包,如何得到包依赖的库

你这报错是因为你编译过程中无法在指定lib目录下找到相应库文件
解决方法
把你安装的开发库文件建立软链到你指定的lib目录 /usr/lib/也建一份

⑸ 在编译过程中,程序可以依赖于库而不是运行时吗

就是编译的时候静态链接,把这个库文件集成到你的dll文件中,试试。

补充一点:
源文件是C不是C++。使用到的MSVCR80.DLL中的函数包括:

__CppXcptFilter
__clean_type_info_names_internal
__dllonexit
_adjust_fdiv
_amsg_exit
_crt_debugger_hook
_decode_pointer
_encode_pointer
_encoded_null
_except_handler4_common
_initterm
_initterm_e
_lock
_malloc_crt
_onexit
_unlock
free

⑹ 怎样解决maven里编译时包的依赖有关问题

一、导出到默认目录 targed/dependency
从Maven项目中导出项目依赖的jar包:进入工程pom.xml 所在的目录下,执行如下命令:

mvn dependency:-dependencies
或在eclipse中,选择项目的pom.xml文件,点击右键菜单中的Run As,见下图红框中,在弹出的Configuration窗口中,输入 dependency:-dependencies后,点击运行
maven项目所依赖的jar包会导出到targed/dependency目录中。
二、导出到自定义目录中
在maven项目下创建lib文件夹,输入以下命令:

mvn dependency:-dependencies -DoutputDirectory=lib
maven项目所依赖的jar包都会复制到项目目录下的lib目录下
三、设置依赖级别
同时可以设置依赖级别,通常使用compile级别

mvn dependency:-dependencies -DoutputDirectory=lib -DincludeScope=compile

linux怎么编译两个相互依赖的模块

insmod不过最好是modprobe这个命令会检测模块之间的功能依赖关系一同载入。不过需要在/lib/moles里面有模块的信息(这个信息怎么写怎么生成我不清楚)。

⑻ 编译程序缺少依赖库

这个用来操作电话本,比如导出vcard之类的,我在我的模拟器上好用的。sdk是
3rd
fp1

⑼ ant怎么编译带有依赖关系的类

1.所有的类一起编译。
2.你的父添加到classpath中。
3.ant 中添加 classpath 下边是例 子。
<javac destdir="${classes.dir}" srcdir="${src.dir}" encoding="UTF-8">
<classpath refid="classespath" />
</javac>

⑽ 用gcc编译后的可执行文件还依不依赖原来编译的头文件和库文件

不依赖头文件,库文件要看是静态库还是动态库。静态库在程序的链接阶段被复制到了程序中,动态库在链接阶段没有被复制到程序中,而是程序在运行时由系统动态加载到内存中供程序调用。

热点内容
html文件上传表单 发布:2024-09-17 03:08:02 浏览:783
聊天软件编程 发布:2024-09-17 03:00:07 浏览:725
linuxoracle安装路径 发布:2024-09-17 01:57:29 浏览:688
两个安卓手机照片怎么同步 发布:2024-09-17 01:51:53 浏览:207
cf编译后没有黑框跳出来 发布:2024-09-17 01:46:54 浏览:249
安卓怎么禁用应用读取列表 发布:2024-09-17 01:46:45 浏览:524
win10设密码在哪里 发布:2024-09-17 01:33:32 浏览:662
情逢敌手迅雷下载ftp 发布:2024-09-17 01:32:35 浏览:337
安卓如何让软件按照步骤自动运行 发布:2024-09-17 01:28:27 浏览:197
Z包解压命令 发布:2024-09-17 01:27:51 浏览:221