[ovs-dev] [PATCH] python/setup: "-fPIC" extra compile flag for C extension

IWASE Yusuke iwase.yusuke0 at gmail.com
Wed Jan 11 00:38:13 UTC 2017


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},
 )
 
-- 
2.7.4



More information about the dev mailing list