Re: How to link to python 3.6.4 library on linux ?

2018-02-19 Thread Jason Qian via Python-list
Thanks  Chris,

I think I figured it out that when build python on Linux, we need to
enable-shared.

Thanks again,

On Mon, Feb 19, 2018 at 5:04 PM, Chris Angelico  wrote:

> On Tue, Feb 20, 2018 at 8:07 AM, Jason Qian via Python-list
>  wrote:
> >  Hi,
> >
> >   I am calling python from a  c application.
> >   It compiles and works fine on the windows. How do I compile and
> link
> > it on the linux for Python 3.6.4  ?
> >
> >   Under python dir, it only have a static library,
> >
> >/opt/Python-3.6.4*/lib*/*libpython3.6m.a*
> >
> > * If I link to it, I got:*
> >
> > */opt/Python-3.6.4/lib/libpython3.6m.a(abstract.o): relocation
> R_X86_64_32S
> > against `_Py_NotImplementedStruct' can not be used when making a shared
> > object; recompile with -fPIC*
> > */opt/Python-3.6.4/lib/libpython3.6m.a: could not read symbols: Bad
> value*
> >
>
> By "calling Python from C", do you mean what the docs call "embedding"?
>
> https://docs.python.org/3/extending/embedding.html
>
> I would recommend following the tutorial there, if you haven't
> already. If you have, and the tutorial code doesn't work for you, post
> your code and what you did, and we'll try to help with that.
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to link to python 3.6.4 library on linux ?

2018-02-19 Thread Chris Angelico
On Tue, Feb 20, 2018 at 8:07 AM, Jason Qian via Python-list
 wrote:
>  Hi,
>
>   I am calling python from a  c application.
>   It compiles and works fine on the windows. How do I compile and link
> it on the linux for Python 3.6.4  ?
>
>   Under python dir, it only have a static library,
>
>/opt/Python-3.6.4*/lib*/*libpython3.6m.a*
>
> * If I link to it, I got:*
>
> */opt/Python-3.6.4/lib/libpython3.6m.a(abstract.o): relocation R_X86_64_32S
> against `_Py_NotImplementedStruct' can not be used when making a shared
> object; recompile with -fPIC*
> */opt/Python-3.6.4/lib/libpython3.6m.a: could not read symbols: Bad value*
>

By "calling Python from C", do you mean what the docs call "embedding"?

https://docs.python.org/3/extending/embedding.html

I would recommend following the tutorial there, if you haven't
already. If you have, and the tutorial code doesn't work for you, post
your code and what you did, and we'll try to help with that.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list