Re: [lldb-dev] Python3 compatibility for the API

2016-09-13 Thread Ted Woodward via lldb-dev
I just built lldb on Ubuntu 12 with Python 3.5.1. I needed to set python 
includes, python library and python executable in cmake.

I found a problem with the tests - most ran fine, but I got errors with tests 
that tried to use pexpect, like TestConvenienceVariables.py.
  File 
"/local/scratch/ted/8.1/llvm/tools/lldb/third_party/Python/module/pexpect-2.4/pexpect.py",
 line 82
except ImportError, e:
  ^
SyntaxError: invalid syntax

If we want to run the tests with Python3 we'll need to update pexpect.

--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux 
Foundation Collaborative Project


-Original Message-
From: lldb-dev [mailto:lldb-dev-boun...@lists.llvm.org] On Behalf Of Luke 
Drummond via lldb-dev
Sent: Tuesday, August 30, 2016 7:01 AM
To: lldb-dev@lists.llvm.org
Subject: Re: [lldb-dev] Python3 compatibility for the API

Hi Zachary, Peter

On 30/08/16 00:14, Zachary Turner via lldb-dev wrote:
> Right, the existing version that is built and what you are using links 
> directly against a 2.7 libpython at compile time.  So you would 
> probably need to build LLDB from source and tweak the build system to 
> make it possible to link against your 3.x version of python.  There's 
> some build instructions on the website 
> <http://lldb.llvm.org/build.html>.  I know there's a few linux 
> developers around here, so it's possible someone else would be 
> interested in making this work as well, but I don't know that it's on 
> anyone's immediate timeline.

We build lldb against python3 regularly, because - as Zachary said - this is 
the only way to get scripting support on windows. To link against python3 on 
Linux you *should* just need the correct headers installed, and invoke CMake 
with the correct python path. For Ubuntu:

```
sudo apt install python3-dev
cmake "$PATH_TO_LLVM_SRC" -DPYTHON_EXECUTABLE:FILEPATH=$(which python3) ```

*should* give you everything you need. However, you may see that cmake picks up 
the python3 interpreter correctly, but tries to link against the python2.7 
library.

-- Found PythonInterp: /usr/bin/python3 (found version "3.5.2") [...]
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython2.7.so (found version 
"2.7.12")

This appears to be due to a problem in LLVM's CMakeLists.txt specifying support 
for 2.7 only. I have a patch to fix the issue awaiting review
[here](https://reviews.llvm.org/D20825) which should fix the issue on Linux 
when multiple pythons are installed. It may be worth applying this patch 
locally and see how you get on.

Hope that helps

Best

Luke
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev

___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


Re: [lldb-dev] Python3 compatibility for the API

2016-08-30 Thread Luke Drummond via lldb-dev

Hi Zachary, Peter

On 30/08/16 00:14, Zachary Turner via lldb-dev wrote:

Right, the existing version that is built and what you are using links
directly against a 2.7 libpython at compile time.  So you would probably
need to build LLDB from source and tweak the build system to make it
possible to link against your 3.x version of python.  There's some build
instructions on the website .  I know
there's a few linux developers around here, so it's possible someone
else would be interested in making this work as well, but I don't know
that it's on anyone's immediate timeline.


We build lldb against python3 regularly, because - as Zachary said - 
this is the only way to get scripting support on windows. To link 
against python3 on Linux you *should* just need the correct headers 
installed, and invoke CMake with the correct python path. For Ubuntu:


```
sudo apt install python3-dev
cmake "$PATH_TO_LLVM_SRC" -DPYTHON_EXECUTABLE:FILEPATH=$(which python3)
```

*should* give you everything you need. However, you may see that cmake 
picks up the python3 interpreter correctly, but tries to link against 
the python2.7 library.


-- Found PythonInterp: /usr/bin/python3 (found version "3.5.2")
[...]
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython2.7.so (found 
version "2.7.12")


This appears to be due to a problem in LLVM's CMakeLists.txt specifying 
support for 2.7 only. I have a patch to fix the issue awaiting review 
[here](https://reviews.llvm.org/D20825) which should fix the issue on 
Linux when multiple pythons are installed. It may be worth applying this 
patch locally and see how you get on.


Hope that helps

Best

Luke
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


Re: [lldb-dev] Python3 compatibility for the API

2016-08-30 Thread Pavel Labath via lldb-dev
We don't have any immediate plans to make lldb work with python 3 on
linux. However, I would be willing to guide you through making that
work. As Zachary pointed out, it should be fairly simple, given that
it already works on windows.

I don't think you'll be able to avoid building your own copy of lldb,
so I think you should start by making sure that you can build a
working lldb trunk with python2. Then we can figure out how to get
python 3 working.

BTW, linux support in lldb 3.6 was still quite flaky. I'd recommend
going at least to 3.8 to get a more stable experience.

pl



On 30 August 2016 at 00:14, Zachary Turner via lldb-dev
 wrote:
> Right, the existing version that is built and what you are using links
> directly against a 2.7 libpython at compile time.  So you would probably
> need to build LLDB from source and tweak the build system to make it
> possible to link against your 3.x version of python.  There's some build
> instructions on the website.  I know there's a few linux developers around
> here, so it's possible someone else would be interested in making this work
> as well, but I don't know that it's on anyone's immediate timeline.
>
> In any case, if you want to try it yourself, the first step would be to get
> a working build (even with 2.7), and once you have that working we can look
> at how to make it link against Python 3.
>
> On Mon, Aug 29, 2016 at 4:07 PM Peter Gebhard  wrote:
>>
>> Hmm…sure? I can try. Feel free to send me any tips.
>>
>> It does show syntax errors when trying to import the existing lldb module
>> in Python 3, however.
>>
>> Thanks,
>> Peter
>>
>> On Aug 29, 2016, at 6:42 PM, Zachary Turner  wrote:
>>
>> 3.6.2 should be new enough, Python 3 has been working for over a year and
>> it's actually the only supported configuration right now on Windows.  Most
>> likely the problem is just that I never updated the build system to work
>> with a platform other than Windows.  Unfortunately, being that I work
>> primarily on Windows, I'm probably not the best person to fix this, but if
>> you want to take a stab at it I can give you some pointers to put you in the
>> right direction.
>>
>> On Mon, Aug 29, 2016 at 3:37 PM Peter Gebhard  wrote:
>>>
>>> Zachary,
>>>
>>> Great to hear! I was trying it out on Ubuntu 15.10 (which has lldb
>>> 3.6.2), and it seemed that the relevant modules were only installed with the
>>> Python 2 packages. Is it an installation issue on my side, or did 3.6.2 not
>>> have your changes yet? I can always install a newer version of lldb if it’s
>>> simply too old.
>>>
>>> Thanks,
>>> Peter
>>>
>>> On Aug 29, 2016, at 6:30 PM, Zachary Turner  wrote:
>>>
>>> Hi,
>>>
>>> LLDB already supports Python 3.  I spent a LONG time making this work.
>>> :)  I've only ever tested the Python 3 support on Windows, and I've only
>>> tested 3.5 and above, but I don't expect any major difficulties getting it
>>> working on another platform, although you may need to tweak the CMake a
>>> little bit to get it building on your platform if it's not Windows.  Please
>>> try it and let me know how it goes.
>>>
>>> What OS and minor version are you planning to use?
>>>
>>> On Mon, Aug 29, 2016 at 3:15 PM Peter Gebhard via lldb-dev
>>>  wrote:

 Hello,

 I am developing a tool which is written in Python3 due to its use of
 some libraries which require it. I am wondering if there is a sane way to
 integrate use of the LLDB Python API into my tool or is there a plan to add
 Python3 support for the LLDB Python API in the near future?

 Thank you,
 Peter

 ___
 lldb-dev mailing list
 lldb-dev@lists.llvm.org
 http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
>>>
>>>
>>
>
> ___
> lldb-dev mailing list
> lldb-dev@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
>
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


Re: [lldb-dev] Python3 compatibility for the API

2016-08-29 Thread Peter Gebhard via lldb-dev
Hmm…sure? I can try. Feel free to send me any tips.

It does show syntax errors when trying to import the existing lldb module in 
Python 3, however.

Thanks,
Peter

> On Aug 29, 2016, at 6:42 PM, Zachary Turner  wrote:
> 
> 3.6.2 should be new enough, Python 3 has been working for over a year and 
> it's actually the only supported configuration right now on Windows.  Most 
> likely the problem is just that I never updated the build system to work with 
> a platform other than Windows.  Unfortunately, being that I work primarily on 
> Windows, I'm probably not the best person to fix this, but if you want to 
> take a stab at it I can give you some pointers to put you in the right 
> direction.
> 
> On Mon, Aug 29, 2016 at 3:37 PM Peter Gebhard  > wrote:
> Zachary,
> 
> Great to hear! I was trying it out on Ubuntu 15.10 (which has lldb 3.6.2), 
> and it seemed that the relevant modules were only installed with the Python 2 
> packages. Is it an installation issue on my side, or did 3.6.2 not have your 
> changes yet? I can always install a newer version of lldb if it’s simply too 
> old.
> 
> Thanks,
> Peter
> 
>> On Aug 29, 2016, at 6:30 PM, Zachary Turner > > wrote:
>> 
>> Hi,
>> 
>> LLDB already supports Python 3.  I spent a LONG time making this work.  :)  
>> I've only ever tested the Python 3 support on Windows, and I've only tested 
>> 3.5 and above, but I don't expect any major difficulties getting it working 
>> on another platform, although you may need to tweak the CMake a little bit 
>> to get it building on your platform if it's not Windows.  Please try it and 
>> let me know how it goes.
>> 
>> What OS and minor version are you planning to use?
>> 
>> On Mon, Aug 29, 2016 at 3:15 PM Peter Gebhard via lldb-dev 
>> > wrote:
>> Hello,
>> 
>> I am developing a tool which is written in Python3 due to its use of some 
>> libraries which require it. I am wondering if there is a sane way to 
>> integrate use of the LLDB Python API into my tool or is there a plan to add 
>> Python3 support for the LLDB Python API in the near future?
>> 
>> Thank you,
>> Peter
>> 
>> ___
>> lldb-dev mailing list
>> lldb-dev@lists.llvm.org 
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev 
>> 
> 

___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


Re: [lldb-dev] Python3 compatibility for the API

2016-08-29 Thread Zachary Turner via lldb-dev
3.6.2 should be new enough, Python 3 has been working for over a year and
it's actually the only supported configuration right now on Windows.  Most
likely the problem is just that I never updated the build system to work
with a platform other than Windows.  Unfortunately, being that I work
primarily on Windows, I'm probably not the best person to fix this, but if
you want to take a stab at it I can give you some pointers to put you in
the right direction.

On Mon, Aug 29, 2016 at 3:37 PM Peter Gebhard  wrote:

> Zachary,
>
> Great to hear! I was trying it out on Ubuntu 15.10 (which has lldb 3.6.2),
> and it seemed that the relevant modules were only installed with the Python
> 2 packages. Is it an installation issue on my side, or did 3.6.2 not have
> your changes yet? I can always install a newer version of lldb if it’s
> simply too old.
>
> Thanks,
> Peter
>
> On Aug 29, 2016, at 6:30 PM, Zachary Turner  wrote:
>
> Hi,
>
> LLDB already supports Python 3.  I spent a LONG time making this work.  :)
>  I've only ever tested the Python 3 support on Windows, and I've only
> tested 3.5 and above, but I don't expect any major difficulties getting it
> working on another platform, although you may need to tweak the CMake a
> little bit to get it building on your platform if it's not Windows.  Please
> try it and let me know how it goes.
>
> What OS and minor version are you planning to use?
>
> On Mon, Aug 29, 2016 at 3:15 PM Peter Gebhard via lldb-dev <
> lldb-dev@lists.llvm.org> wrote:
>
>> Hello,
>>
>> I am developing a tool which is written in Python3 due to its use of some
>> libraries which require it. I am wondering if there is a sane way to
>> integrate use of the LLDB Python API into my tool or is there a plan to add
>> Python3 support for the LLDB Python API in the near future?
>>
>> Thank you,
>> Peter
>>
>> ___
>> lldb-dev mailing list
>> lldb-dev@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
>>
>
>
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


Re: [lldb-dev] Python3 compatibility for the API

2016-08-29 Thread Zachary Turner via lldb-dev
Hi,

LLDB already supports Python 3.  I spent a LONG time making this work.  :)
 I've only ever tested the Python 3 support on Windows, and I've only
tested 3.5 and above, but I don't expect any major difficulties getting it
working on another platform, although you may need to tweak the CMake a
little bit to get it building on your platform if it's not Windows.  Please
try it and let me know how it goes.

What OS and minor version are you planning to use?

On Mon, Aug 29, 2016 at 3:15 PM Peter Gebhard via lldb-dev <
lldb-dev@lists.llvm.org> wrote:

> Hello,
>
> I am developing a tool which is written in Python3 due to its use of some
> libraries which require it. I am wondering if there is a sane way to
> integrate use of the LLDB Python API into my tool or is there a plan to add
> Python3 support for the LLDB Python API in the near future?
>
> Thank you,
> Peter
>
> ___
> lldb-dev mailing list
> lldb-dev@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
>
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev