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 <ros...@gmail.com> wrote: > On Tue, Feb 20, 2018 at 8:07 AM, Jason Qian via Python-list > <python-list@python.org> 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