當前位置:首頁 » 編程軟體 » 編譯依賴

編譯依賴

發布時間: 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編譯後的可執行文件還依不依賴原來編譯的頭文件和庫文件

不依賴頭文件,庫文件要看是靜態庫還是動態庫。靜態庫在程序的鏈接階段被復制到了程序中,動態庫在鏈接階段沒有被復制到程序中,而是程序在運行時由系統動態載入到內存中供程序調用。

熱點內容
linux下ntp伺服器搭建 發布:2024-09-08 08:26:46 瀏覽:742
db2新建資料庫 發布:2024-09-08 08:10:19 瀏覽:171
頻率計源碼 發布:2024-09-08 07:40:26 瀏覽:778
奧迪a6哪個配置帶後排加熱 發布:2024-09-08 07:06:32 瀏覽:101
linux修改apache埠 發布:2024-09-08 07:05:49 瀏覽:209
有多少個不同的密碼子 發布:2024-09-08 07:00:46 瀏覽:566
linux搭建mysql伺服器配置 發布:2024-09-08 06:50:02 瀏覽:995
加上www不能訪問 發布:2024-09-08 06:39:52 瀏覽:811
銀行支付密碼器怎麼用 發布:2024-09-08 06:39:52 瀏覽:513
蘋果手機清理瀏覽器緩存怎麼清理緩存 發布:2024-09-08 06:31:32 瀏覽:554