2016-07-03 185 views
3

我在Windows上使用MSYS2/MINGW64構建了一個跨python的python支持。我在MINGW64中安裝了python,也就是我在C:\msys64\mingw64\bin中有python2.7.exe,這個地址在我的路徑中。Cross gdb找不到python

我收到以下錯誤,當我運行GDB

Could not find platform independent libraries <prefix> 
Could not find platform dependent libraries <exec_prefix> 
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] 
ImportError: No module named site` 

我還添加了C:\msys64\mingw64\lib在那裏我有libpython2.7.dll.a,但我仍然得到同樣的錯誤。

我也嘗試在Windows上安裝python並設置所有的路徑,但仍然是相同的錯誤。

我該如何讓gdb找到python?

回答

0

你必須設置環境變量:

PYTHONPATH = C:\ msys64 \ mingw64 \ LIB \ python2.7; C:\ msys64 \ mingw64 \ LIB \ python2.7 \ LIB-dynload;

PYTHONHOME變量是指Python解釋:

PYTHONHOME=C:\msys64\mingw64\bin\pyhon.exe 

我建下msys2我自己GDB並將其設置正確的環境變量後,工作原理:

Microsoft Windows [Version 10.0.16299.19] 
(c) 2017 Microsoft Corporation. All rights reserved. 

C:\Users\tiit>echo %PYTHONHOME% 
C:\msys64\mingw64\bin\pyhon.exe 

C:\Users\tiit>echo %PYTHONPATH% 
C:\msys64\mingw64\lib\python2.7;C:\msys64\mingw64\lib\python2.7\lib-dynload; 

C:\Users\tiit>C:\msys64\home\tiit\gdb-7.11-bin\bin\x86_64-linux-gnu-gdb.exe 
GNU gdb (GDB) 7.11.1.20160801-git 
Copyright (C) 2016 Free Software Foundation, Inc. 
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html> 
This is free software: you are free to change and redistribute it. 
There is NO WARRANTY, to the extent permitted by law. Type "show copying" 
and "show warranty" for details. 
This GDB was configured as "--host=x86_64-w64-mingw32 --target=x86_64-linux-gnu". 
Type "show configuration" for configuration details. 
For bug reporting instructions, please see: 
<http://www.gnu.org/software/gdb/bugs/>. 
Find the GDB manual and other documentation resources online at: 
<http://www.gnu.org/software/gdb/documentation/>. 
For help, type "help". 
Type "apropos word" to search for commands related to "word". 
(gdb) 

我的configure命令行是:

./configure --target=x86_64-linux-gnu --prefix=/home/tiit/gdb-7.11-bin --with-python=/mingw64/bin/python.exe --enable-static=yes