Message ID | 20190904184928.8414-1-raj.khem@gmail.com |
---|---|
State | Superseded |
Headers | show |
Series | [V2] python3native, pythonnative: export PYTHON_LIBRARY and PYTHON_INCLUDE_DIR | expand |
Thanks, this looks good now. Alex On Wed, 4 Sep 2019 at 20:49, Khem Raj <raj.khem@gmail.com> wrote: > packages can use > > find_package(PythonInterp REQUIRED) > find_package(PythonLibs REQUIRED) > > while we control PYTHON pointing to native py3 the libs and include > directories will then point to build host version, which can result in > unexpected combination and if we are lucky we get errors if its quite > different e.g. py2 libs/includes and py3 executable > > This variable can be then used to export PYTHON_LIBRARY and > PYTHON_INCLUDE_DIR so that above find_packages can work correctly > > see [1] for how it happens in cmake > > LLDB uses it see [2] > > [1] > https://github.com/Kitware/CMake/blob/master/Modules/FindPythonLibs.cmake > [2] > https://github.com/llvm/llvm-project/blob/master/lldb/cmake/modules/LLDBConfig.cmake#L226 > > Signed-off-by: Khem Raj <raj.khem@gmail.com> > --- > v2: Use PYTHON_DIR variable > > meta/classes/python3native.bbclass | 8 ++++++++ > meta/classes/pythonnative.bbclass | 8 ++++++++ > 2 files changed, 16 insertions(+) > > diff --git a/meta/classes/python3native.bbclass > b/meta/classes/python3native.bbclass > index a3acaf61bb..768302488b 100644 > --- a/meta/classes/python3native.bbclass > +++ b/meta/classes/python3native.bbclass > @@ -9,6 +9,14 @@ DEPENDS_append = " python3-native " > export STAGING_INCDIR > export STAGING_LIBDIR > > +# Packages can use > +# find_package(PythonInterp REQUIRED) > +# find_package(PythonLibs REQUIRED) > +# which ends up using libs/includes from build host > +# Therefore pre-empt that effort > +export PYTHON_LIBRARY="${STAGING_LIBDIR}/${PYTHON_DIR}" > +export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}" > + > export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata" > > # suppress host user's site-packages dirs. > diff --git a/meta/classes/pythonnative.bbclass > b/meta/classes/pythonnative.bbclass > index ae6600cd15..604423b80e 100644 > --- a/meta/classes/pythonnative.bbclass > +++ b/meta/classes/pythonnative.bbclass > @@ -12,6 +12,14 @@ DEPENDS_append = " python-native " > export STAGING_INCDIR > export STAGING_LIBDIR > > +# Packages can use > +# find_package(PythonInterp REQUIRED) > +# find_package(PythonLibs REQUIRED) > +# which ends up using libs/includes from build host > +# Therefore pre-empt that effort > +export PYTHON_LIBRARY="${STAGING_LIBDIR}/${PYTHON_DIR}" > +export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}" > + > # suppress host user's site-packages dirs. > export PYTHONNOUSERSITE = "1" > > -- > 2.23.0 > > -- > _______________________________________________ > Openembedded-core mailing list > Openembedded-core@lists.openembedded.org > http://lists.openembedded.org/mailman/listinfo/openembedded-core > <div dir="ltr"><div>Thanks, this looks good now.</div><div><br></div><div>Alex<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 4 Sep 2019 at 20:49, Khem Raj <<a href="mailto:raj.khem@gmail.com">raj.khem@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">packages can use<br> <br> find_package(PythonInterp REQUIRED)<br> find_package(PythonLibs REQUIRED)<br> <br> while we control PYTHON pointing to native py3 the libs and include<br> directories will then point to build host version, which can result in<br> unexpected combination and if we are lucky we get errors if its quite<br> different e.g. py2 libs/includes and py3 executable<br> <br> This variable can be then used to export PYTHON_LIBRARY and<br> PYTHON_INCLUDE_DIR so that above find_packages can work correctly<br> <br> see [1] for how it happens in cmake<br> <br> LLDB uses it see [2]<br> <br> [1] <a href="https://github.com/Kitware/CMake/blob/master/Modules/FindPythonLibs.cmake" rel="noreferrer" target="_blank">https://github.com/Kitware/CMake/blob/master/Modules/FindPythonLibs.cmake</a><br> [2] <a href="https://github.com/llvm/llvm-project/blob/master/lldb/cmake/modules/LLDBConfig.cmake#L226" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/blob/master/lldb/cmake/modules/LLDBConfig.cmake#L226</a><br> <br> Signed-off-by: Khem Raj <<a href="mailto:raj.khem@gmail.com" target="_blank">raj.khem@gmail.com</a>><br> ---<br> v2: Use PYTHON_DIR variable<br> <br> meta/classes/python3native.bbclass | 8 ++++++++<br> meta/classes/pythonnative.bbclass | 8 ++++++++<br> 2 files changed, 16 insertions(+)<br> <br> diff --git a/meta/classes/python3native.bbclass b/meta/classes/python3native.bbclass<br> index a3acaf61bb..768302488b 100644<br> --- a/meta/classes/python3native.bbclass<br> +++ b/meta/classes/python3native.bbclass<br> @@ -9,6 +9,14 @@ DEPENDS_append = " python3-native "<br> export STAGING_INCDIR<br> export STAGING_LIBDIR<br> <br> +# Packages can use<br> +# find_package(PythonInterp REQUIRED)<br> +# find_package(PythonLibs REQUIRED)<br> +# which ends up using libs/includes from build host<br> +# Therefore pre-empt that effort<br> +export PYTHON_LIBRARY="${STAGING_LIBDIR}/${PYTHON_DIR}"<br> +export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}"<br> +<br> export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"<br> <br> # suppress host user's site-packages dirs.<br> diff --git a/meta/classes/pythonnative.bbclass b/meta/classes/pythonnative.bbclass<br> index ae6600cd15..604423b80e 100644<br> --- a/meta/classes/pythonnative.bbclass<br> +++ b/meta/classes/pythonnative.bbclass<br> @@ -12,6 +12,14 @@ DEPENDS_append = " python-native "<br> export STAGING_INCDIR<br> export STAGING_LIBDIR<br> <br> +# Packages can use<br> +# find_package(PythonInterp REQUIRED)<br> +# find_package(PythonLibs REQUIRED)<br> +# which ends up using libs/includes from build host<br> +# Therefore pre-empt that effort<br> +export PYTHON_LIBRARY="${STAGING_LIBDIR}/${PYTHON_DIR}"<br> +export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}"<br> +<br> # suppress host user's site-packages dirs.<br> export PYTHONNOUSERSITE = "1"<br> <br> -- <br> 2.23.0<br> <br> -- <br> _______________________________________________<br> Openembedded-core mailing list<br> <a href="mailto:Openembedded-core@lists.openembedded.org" target="_blank">Openembedded-core@lists.openembedded.org</a><br> <a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/mailman/listinfo/openembedded-core</a><br> </blockquote></div> -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
wait for v3 on this I am doing a build which is still not done yet. On Wed, Sep 4, 2019 at 11:58 AM Alexander Kanavin <alex.kanavin@gmail.com> wrote: > > Thanks, this looks good now. > > Alex > > On Wed, 4 Sep 2019 at 20:49, Khem Raj <raj.khem@gmail.com> wrote: >> >> packages can use >> >> find_package(PythonInterp REQUIRED) >> find_package(PythonLibs REQUIRED) >> >> while we control PYTHON pointing to native py3 the libs and include >> directories will then point to build host version, which can result in >> unexpected combination and if we are lucky we get errors if its quite >> different e.g. py2 libs/includes and py3 executable >> >> This variable can be then used to export PYTHON_LIBRARY and >> PYTHON_INCLUDE_DIR so that above find_packages can work correctly >> >> see [1] for how it happens in cmake >> >> LLDB uses it see [2] >> >> [1] https://github.com/Kitware/CMake/blob/master/Modules/FindPythonLibs.cmake >> [2] https://github.com/llvm/llvm-project/blob/master/lldb/cmake/modules/LLDBConfig.cmake#L226 >> >> Signed-off-by: Khem Raj <raj.khem@gmail.com> >> --- >> v2: Use PYTHON_DIR variable >> >> meta/classes/python3native.bbclass | 8 ++++++++ >> meta/classes/pythonnative.bbclass | 8 ++++++++ >> 2 files changed, 16 insertions(+) >> >> diff --git a/meta/classes/python3native.bbclass b/meta/classes/python3native.bbclass >> index a3acaf61bb..768302488b 100644 >> --- a/meta/classes/python3native.bbclass >> +++ b/meta/classes/python3native.bbclass >> @@ -9,6 +9,14 @@ DEPENDS_append = " python3-native " >> export STAGING_INCDIR >> export STAGING_LIBDIR >> >> +# Packages can use >> +# find_package(PythonInterp REQUIRED) >> +# find_package(PythonLibs REQUIRED) >> +# which ends up using libs/includes from build host >> +# Therefore pre-empt that effort >> +export PYTHON_LIBRARY="${STAGING_LIBDIR}/${PYTHON_DIR}" >> +export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}" >> + >> export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata" >> >> # suppress host user's site-packages dirs. >> diff --git a/meta/classes/pythonnative.bbclass b/meta/classes/pythonnative.bbclass >> index ae6600cd15..604423b80e 100644 >> --- a/meta/classes/pythonnative.bbclass >> +++ b/meta/classes/pythonnative.bbclass >> @@ -12,6 +12,14 @@ DEPENDS_append = " python-native " >> export STAGING_INCDIR >> export STAGING_LIBDIR >> >> +# Packages can use >> +# find_package(PythonInterp REQUIRED) >> +# find_package(PythonLibs REQUIRED) >> +# which ends up using libs/includes from build host >> +# Therefore pre-empt that effort >> +export PYTHON_LIBRARY="${STAGING_LIBDIR}/${PYTHON_DIR}" >> +export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}" >> + >> # suppress host user's site-packages dirs. >> export PYTHONNOUSERSITE = "1" >> >> -- >> 2.23.0 >> >> -- >> _______________________________________________ >> Openembedded-core mailing list >> Openembedded-core@lists.openembedded.org >> http://lists.openembedded.org/mailman/listinfo/openembedded-core -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
diff --git a/meta/classes/python3native.bbclass b/meta/classes/python3native.bbclass index a3acaf61bb..768302488b 100644 --- a/meta/classes/python3native.bbclass +++ b/meta/classes/python3native.bbclass @@ -9,6 +9,14 @@ DEPENDS_append = " python3-native " export STAGING_INCDIR export STAGING_LIBDIR +# Packages can use +# find_package(PythonInterp REQUIRED) +# find_package(PythonLibs REQUIRED) +# which ends up using libs/includes from build host +# Therefore pre-empt that effort +export PYTHON_LIBRARY="${STAGING_LIBDIR}/${PYTHON_DIR}" +export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}" + export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata" # suppress host user's site-packages dirs. diff --git a/meta/classes/pythonnative.bbclass b/meta/classes/pythonnative.bbclass index ae6600cd15..604423b80e 100644 --- a/meta/classes/pythonnative.bbclass +++ b/meta/classes/pythonnative.bbclass @@ -12,6 +12,14 @@ DEPENDS_append = " python-native " export STAGING_INCDIR export STAGING_LIBDIR +# Packages can use +# find_package(PythonInterp REQUIRED) +# find_package(PythonLibs REQUIRED) +# which ends up using libs/includes from build host +# Therefore pre-empt that effort +export PYTHON_LIBRARY="${STAGING_LIBDIR}/${PYTHON_DIR}" +export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}" + # suppress host user's site-packages dirs. export PYTHONNOUSERSITE = "1"
packages can use find_package(PythonInterp REQUIRED) find_package(PythonLibs REQUIRED) while we control PYTHON pointing to native py3 the libs and include directories will then point to build host version, which can result in unexpected combination and if we are lucky we get errors if its quite different e.g. py2 libs/includes and py3 executable This variable can be then used to export PYTHON_LIBRARY and PYTHON_INCLUDE_DIR so that above find_packages can work correctly see [1] for how it happens in cmake LLDB uses it see [2] [1] https://github.com/Kitware/CMake/blob/master/Modules/FindPythonLibs.cmake [2] https://github.com/llvm/llvm-project/blob/master/lldb/cmake/modules/LLDBConfig.cmake#L226 Signed-off-by: Khem Raj <raj.khem@gmail.com> --- v2: Use PYTHON_DIR variable meta/classes/python3native.bbclass | 8 ++++++++ meta/classes/pythonnative.bbclass | 8 ++++++++ 2 files changed, 16 insertions(+) -- 2.23.0 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core