导航:首页 > 源码编译 > 编译依赖

编译依赖

发布时间:2022-02-15 16:55:29

1. 自己编译的包能被依赖吗

- 这里主要是想试验一下,对一个具有多层嵌套的动态库进行编译时,是否要把最底层的库也包含进来的问题,结论是:只要直接依赖的库名称,不需要最底层库名称

2. 怎么查看makefile编译依赖关系

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

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

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

3. 求助,ubuntu安装编译依赖软件时出现问题

is really not easy. Originally,

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

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

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

就是编译的时候静态链接,把这个库文件集成到你的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

6. 编译安装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

7. 怎样解决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

8. 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# 的动态链接库,两个动态链接库就在同一个目录下运行。

9. linux内核编译怎么找的依赖

linux内核不依赖gcc gcc只是一个编译软件,是在kernel的源码变成可执行文件的时候起作用,真正使用起来就没有什么关系。

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

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

阅读全文

与编译依赖相关的资料

热点内容
应届毕业生程序员实习期怎么过 浏览:704
板石楼梯计算法 浏览:432
swift开发pdf 浏览:290
ideajava编译版本 浏览:960
迈普交换机常用命令 浏览:177
删除创建的文件夹命令 浏览:181
linuxmysql连接拒绝连接 浏览:818
php关键词源码 浏览:828
小米公司需要那么多程序员吗 浏览:881
超准macd副图源码 浏览:9
好脾气的程序员 浏览:663
macppt压缩软件 浏览:135
公众号推广系统源码 浏览:66
程序员作息安排 浏览:625
如何在本地登录服务器 浏览:338
喵吧app怎么使用 浏览:752
家庭服务器如何连wifi 浏览:209
新闻推荐系统源码 浏览:227
php中文星号 浏览:515
服务器4盘是什么意思 浏览:598