[ovs-dev] [PATCH] python/setup: "-fPIC" extra compile flag for C extension
Ben Pfaff
blp at ovn.org
Wed Jan 11 02:01:58 UTC 2017
On Wed, Jan 11, 2017 at 09:38:13AM +0900, IWASE Yusuke wrote:
> To build shared library object, it is required to built as "Position
> Independent Code" (on x86-64, for example).
> This patch adds "-fPIC" extra compile flag to make sure that extension
> being PIC while building a shared library object.
>
> Signed-off-by: IWASE Yusuke <iwase.yusuke0 at gmail.com>
> ---
> python/setup.py | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/python/setup.py b/python/setup.py
> index 19c1f18..8f565d8 100644
> --- a/python/setup.py
> +++ b/python/setup.py
> @@ -76,8 +76,13 @@ setup_args = dict(
> 'Programming Language :: Python :: 3',
> 'Programming Language :: Python :: 3.4',
> ],
> - ext_modules=[setuptools.Extension("ovs._json", sources=["ovs/_json.c"],
> - libraries=['openvswitch'])],
> + ext_modules=[
> + setuptools.Extension(
> + "ovs._json",
> + sources=["ovs/_json.c"],
> + libraries=['openvswitch'],
> + extra_compile_args=["-fPIC"]),
> + ],
> cmdclass={'build_ext': try_build_ext},
> )
Are you sure that this is the right way to build a Python shared object?
It is very ELF-specific so I imagine that it will break Windows and BSD
builds.
More information about the dev
mailing list