<div dir="ltr">When you built LLDB, did you specify a -DPYTHON_HOME=<path> on your CMake command line, and also run the install_custom_python.py script? There's a lot of steps, so it seems like almost everybody misses at least one step when doing this.<div><br></div><div>I'm actively working (as in, literally right now) on getting LLDB to work with Python 3. If all goes smoothly, hopefully all of these problems will disappear and everything will just work without any user configuration required at all.</div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Oct 7, 2015 at 12:17 PM kwadwo amankwa <<a href="mailto:que@lunarblack.com">que@lunarblack.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
Hi Zachary,<br>
<br>
Ok so I did end up reconfiguring it and rebuilding but that was no
help . I then realized that I was importing python27.dll as well as
python27_d.dll . When I rebuilt liblldb I started getting an single
unresolved error for <br>
imp_Py_InitModule which I guess was the symbol for the
Py_InitModule4 python api which is actually a macro which is
defined depending on a few flags . So I ended up rebuilding python27
and the unresolved error went away and built everything from scratch
. The good news is that when I invoke the 'script' command in the
lldb interpreter it doesn't crash anymore and I can use the python
interpreter . I can even import the lldb module without getting the
embedded interpreter Import error . However I when I actually
import lldb from a python module and run it with the standalone
interpreter I still get the Import Error. I have checked the
PYTHONPATH which was different for the lldb embedded interpreter and
updated the variable to contain the missing paths but no cigar <span><span> :-( </span></span>. Any
suggestions ?</div><div bgcolor="#FFFFFF" text="#000000"><br>
<br>
<div>On 05/10/15 21:21, Zachary Turner
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Can you try to regenerate CMake with that command
line and see if that helps?</div>
<br>
<div class="gmail_quote">
<div dir="ltr">On Mon, Oct 5, 2015 at 1:17 PM kwadwo amankwa
<<a href="mailto:que@lunarblack.com" target="_blank">que@lunarblack.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> <br>
No <br>
</div>
<div bgcolor="#FFFFFF" text="#000000"> <br>
<div>On 05/10/15 21:15, Zachary Turner wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Are you using -DCMAKE_BUILD_TYPE=Debug when
you generate CMake?</div>
<br>
<div class="gmail_quote">
<div dir="ltr">On Mon, Oct 5, 2015 at 1:14 PM kwadwo
amankwa <<a href="mailto:que@lunarblack.com" target="_blank">que@lunarblack.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> Thanks for the
response , sorry for the delay. As a matter of fact
I actually got rid of the system python and
installed my custom version. I do suspect it is a
linking problem though. When I build liblldb.dll it
always loads python27.dll instead of python27_d.dll.
Do you happen to know where the python27 lib is
specified as an input library because the project
properties in liblldb does not specify it . however
the linker complains if I don't specify the lib
directory in 'additional directories' and when I do
it always links to the python27lib. I grepped the
whole build directory and two files
SystemInitializer.obj and LLDBWrapPython.obj seem to
contain /DEFAULTLIB:python27.lib. Do you have an
idea of what is causing the compiler to do this ?</div>
<div bgcolor="#FFFFFF" text="#000000"><br>
<br>
<div>On 05/10/15 19:13, Zachary Turner wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Ahh, I thought you were doing this
from inside LLDB. There are a couple of
problems:
<div><br>
</div>
<div>1) You might be running with the system
Python, not the custom Python you built with
VS2013. What is the value of
`sys.executable`?</div>
<div>2) Even if you are running your own Python,
the regular Python appears to be in your
`sys.path`. You will need to unset PYTHONPATH
and PYTHONHOME from pointing to your system
Python. PYTHONHOME should point to your
custom Python, and PYTHONPATH should point to
the `lib\site-packages` directory that I
mentioned earlier in your build directory.</div>
<div><br>
</div>
<div><br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr">On Mon, Oct 5, 2015 at 11:06 AM
kwadwo amankwa <<a href="mailto:que@lunarblack.com" target="_blank">que@lunarblack.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> here it
is;<br>
<br>
C:\Users\redbandit\Documents\GitHub\pygui>python
<br>
Python 2.7.10 (default, Sep 18 2015,
02:35:59) [MSC v.1800 64 bit (AMD64)] on
win32 <br>
Type "help", "copyright", "credits" or
"license" for more information. <br>
>>> import sys <br>
>>> sys.path <br>
['', 'C:\\Python27\\Lib',
'C:\\Users\\redbandit\\llvm\\build\\Debug\\lib\\site-packages\\lldb',
'C:\\Users\\redbandit\\llvm\\build\\tools\\lldb\\scripts',
'C:\\Users\\redbandi
t\\Documents\\GitHub\\pygui',
'C:\\Python27\\python27.zip',
'C:\\Python27\\DLLs',
'C:\\Python27\\lib\\plat-win',
'C:\\Python27\\lib\\lib-tk', 'C:\\Python27',
'C:\\Python27\\li b\\site-packages'] <br>
>>> import lldb <br>
Traceback (most recent call last): <br>
</div>
<div bgcolor="#FFFFFF" text="#000000"> File
"<string>", line 1, in <module>
<br>
</div>
<div bgcolor="#FFFFFF" text="#000000">
ImportError: No module named
embedded_interpreter <br>
>>> lldb.__file__ <br>
'C:\\Users\\redbandit\\llvm\\build\\tools\\lldb\\scripts\\lldb.pyc'
<br>
>>> sys.path <br>
['C:/Users/redbandit/llvm/build/Debug/lib/site-packages/lldb',
'C:/Users/redbandit/llvm/build/Debug/lib/site-packages/lib/site-packages',
'', 'C:\\Python27\\Lib', 'C:\\Users\\
redbandit\\llvm\\build\\Debug\\lib\\site-packages\\lldb',
'C:\\Users\\redbandit\\llvm\\build\\tools\\lldb\\scripts',
'C:\\Users\\redbandit\\Documents\\GitHub\\pygui',
'C:\\Pyt hon27\\python27.zip',
'C:\\Python27\\DLLs',
'C:\\Python27\\lib\\plat-win',
'C:\\Python27\\lib\\lib-tk', 'C:\\Python27',
'C:\\Python27\\lib\\site-packages', '.']</div>
<div bgcolor="#FFFFFF" text="#000000"><br>
<br>
<div>On 05/10/15 18:48, Zachary Turner
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Can you run the followign
commands and paste the output?
<div><br>
</div>
<div>
<div>>>> import sys</div>
<div>>>> sys.path</div>
<div>['D:/src/llvmbuild/ninja/bin',
'D:/src/llvmbuild/ninja/lib/site-packages',
'D:\\src\\llvmbuild\\ninja\\bin\\python27_d.zip',
'C:\\Python27_LLDB\\x86\\DLLs',
'C:\\Python27_LLDB\\x86\\lib',
'C:\\Python27_LLDB\\x86\\lib\\plat-win',
'C:\\Python27_LLDB\\x86\\lib\\lib-tk',
'D:\\src\\llvmbuild\\ninja\\bin'</div>
<div>, 'C:\\Python27_LLDB\\x86',
'C:\\Python27_LLDB\\x86\\lib\\site-packages',
'.']</div>
<div>>>> import lldb</div>
<div>>>> lldb.__file__</div>
<div>'D:/src/llvmbuild/ninja/lib/site-packages\\lldb\\__init__.pyc'</div>
<div>>>> sys.path</div>
<div>['D:/src/llvmbuild/ninja/bin',
'D:/src/llvmbuild/ninja/lib/site-packages',
'D:\\src\\llvmbuild\\ninja\\bin\\python27_d.zip',
'C:\\Python27_LLDB\\x86\\DLLs',
'C:\\Python27_LLDB\\x86\\lib',
'C:\\Python27_LLDB\\x86\\lib\\plat-win',
'C:\\Python27_LLDB\\x86\\lib\\lib-tk',
'D:\\src\\llvmbuild\\ninja\\bin'</div>
<div>, 'C:\\Python27_LLDB\\x86',
'C:\\Python27_LLDB\\x86\\lib\\site-packages',
'.']</div>
<div>>>></div>
</div>
<div><br>
</div>
<div>and also make sure that in the same
folder as your _lldb_d.pyd, there is
an embedded_interpreter.py?</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr">On Mon, Oct 5, 2015 at
9:14 AM kwadwo amankwa <<a href="mailto:que@lunarblack.com" target="_blank">que@lunarblack.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
Hi Zachary,<br>
<br>
thanks for the reply , I did use
MSBUILD as Ninja didn't work for me
on my system. As far as the
_lldb_d.pyd file is concerned it is
stored in the same place. and it is
being used by lldb.py because
everything else works besides the
embedded_interpreter. That is I am
able to use the api from python it
is just that interpreter issue that
comes up . <br>
<br>
Cheers,<br>
Que</div>
<div bgcolor="#FFFFFF" text="#000000"><br>
<br>
<div>On 05/10/15 16:56, Zachary
Turner wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Are you using
MSBuild or Ninja to build (i.e.
are you clicking the Build
Solution button in Visual Studio
or running ninja from command
line)? I don't know where it
puts this stuff with a VS2013
build, but with a ninja build,
your directory will be organized
like this:
<div><br>
</div>
<div>build</div>
<div>|___bin</div>
<div> |___lldb.exe</div>
<div> |___liblldb.dll</div>
<div>|___lib</div>
<div> |___site-packages</div>
<div> |___lldb</div>
<div>
|___lldb_d.pyd // If this
is a debug build, lldb.pyd if
release</div>
<div><br>
</div>
<div>I'm betting you're missing
the pyd file. Can you
confirm? Then we can diagnose
that if it turns out to be the
problem.</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr">On Mon, Oct 5,
2015 at 5:20 AM kwadwo amankwa
via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi
guys,<br>
<br>
Can someone point me in the
right direction on this . I
have managed to<br>
set up my environment on
windows , compiling
python2.7.10 using VS2013<br>
and building llvm/lldb in
VS2013. lldb and all its
libraries build<br>
successfully so its just when
I import lldb into my python
project I get<br>
this error.<br>
<br>
File "<string>", line 1,
in <module><br>
Import error: No module named
embedded_interpreter<br>
<br>
Also when I use the 'script'
command in the lldb
interpreter , lldb<br>
completely crashes with an
unhandled exception in the
python<br>
file_write function
(fileobject.c:1852)<br>
<br>
n2 = fwrite(s, 1, n,
f->f_fp);<br>
<br>
the call to fwrite causes an
access violation . My
intuition tells me<br>
that i'm missing a lib or
something but I can't put my
finger on it.<br>
Please Help !<br>
<br>
<br>
_______________________________________________<br>
lldb-dev mailing list<br>
<a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev</a><br>
</blockquote>
</div>
</blockquote>
<br>
</div>
</blockquote>
</div>
</blockquote>
<br>
</div>
</blockquote>
</div>
</blockquote>
<br>
</div>
</blockquote>
</div>
</blockquote>
<br>
</div>
</blockquote>
</div>
</blockquote>
<br>
</div></blockquote></div>