[ 
https://issues.apache.org/jira/browse/PROTON-2094?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16976498#comment-16976498
 ] 

Jiri Daněk commented on PROTON-2094:
------------------------------------

I did not figure it out with venv, but I managed to point CMake to pyenv Python 
with

{noformat}
-DPYTHON_EXECUTABLE=$(pyenv root)/versions/3.7.5/bin/python
{noformat}

It is important to have a python so library, which is accomplished with

{noformat}
export PYTHON_CONFIGURE_OPTS="--enable-shared"
pyenv install 3.7.5
{noformat}

If this is not done, using static library fails like this

{noformat}
[100%] Linking C shared module _cproton.so
/usr/bin/ld: /.pyenv/versions/3.7.5/lib/libpython3.7m.a(ceval.o): relocation 
R_X86_64_PC32 against symbol `_PyRuntime' can not be used when making a shared 
object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
{noformat}

My Dockerfile

{noformat}
# docker build -t qpid-proton:ubuntu -f tools/docker/ubuntu.Dockerfile .

FROM library/ubuntu:18.04 as buildbase
RUN apt-get update
RUN apt-get install -y make build-essential cmake swig libpython3-dev 
libsasl2-dev libjsoncpp-dev
RUN mkdir /source /build /install

FROM buildbase as pyenv
RUN apt-get install -y git
RUN git clone https://github.com/yyuu/pyenv.git /.pyenv
ENV PYENV_ROOT="/.pyenv"
ENV PATH="/.pyenv/bin:${PATH}"
# https://github.com/pyenv/pyenv/wiki
RUN DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends 
make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev 
libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev 
libxmlsec1-dev libffi-dev liblzma-dev
ENV PYTHON_CONFIGURE_OPTS="--enable-shared"
RUN pyenv install 3.7.5
RUN $(pyenv root)/versions/3.7.5/bin/python -m venv /venv
ENV PATH=/venv/bin:${PATH}
WORKDIR /build
ADD . /source/
RUN cmake .. /source -DCMAKE_INSTALL_PREFIX=/install -DBUILD_BINDINGS=python 
-DPYTHON_EXECUTABLE=$(pyenv root)/versions/3.7.5/bin/python
RUN make
# RUN make install
# RUN ctest -V
{noformat}

> Support Python 3.7
> ------------------
>
>                 Key: PROTON-2094
>                 URL: https://issues.apache.org/jira/browse/PROTON-2094
>             Project: Qpid Proton
>          Issue Type: Improvement
>          Components: python-binding
>    Affects Versions: proton-c-0.29.0
>         Environment: Ubuntu 18.04
>            Reporter: Omer Katz
>            Assignee: Andrew Stitcher
>            Priority: Major
>              Labels: build, features
>             Fix For: proton-c-future
>
>
> I tried building the bindings locally on Python 3.7 and it didn't work.
> I checked setup.py and Python 3.7 is not listed under the supported versions.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to