]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: disable "variable tracking" when building rados python binding 41071/head
authorKefu Chai <kchai@redhat.com>
Wed, 28 Apr 2021 15:22:32 +0000 (23:22 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 28 Apr 2021 16:11:33 +0000 (00:11 +0800)
to silence the warning like:

/home/jenkins-build/build/workspace/ceph-pull-requests/build/src/pybind/rados/rados.c: In function '__pyx_pymod_exec_rados':
/home/jenkins-build/build/workspace/ceph-pull-requests/build/src/pybind/rados/rados.c:78903:30: note: variable tracking size limit exceeded with '-fvar-tracking-assignments', retrying without
78903 | static CYTHON_SMALL_CODE int __pyx_pymod_exec_rados(PyObject *__pyx_pyinit_module)
      |                              ^~~~~~~~~~~~~~~~~~~~~~
cc: warning: /usr/bin/cc: linker input file unused because linking not done

Signed-off-by: Kefu Chai <kchai@redhat.com>
cmake/modules/Distutils.cmake
src/pybind/rados/CMakeLists.txt

index ff01aaf818a71d161c8d2c2ae65d827f1e0b772e..cd17e500a177d334cbe2b6a74c73e2c92a4e38bc 100644 (file)
@@ -55,6 +55,10 @@ function(distutils_add_cython_module target name src)
   # Note: this is reproduced in distutils_install_cython_module
   list(APPEND cflags -D'void0=dead_function\(void\)')
   list(APPEND cflags -D'__Pyx_check_single_interpreter\(ARG\)=ARG \#\# 0')
+  cmake_parse_arguments(DU "DISABLE_VTA" "" "" ${ARGN})
+  if(DU_DISABLE_VTA AND HAS_VTA)
+    list(APPEND cflags -fno-var-tracking-assignments)
+  endif()
   set(PY_CC ${compiler_launcher} ${CMAKE_C_COMPILER} ${c_compiler_arg1} ${cflags})
   set(PY_CXX ${compiler_launcher} ${CMAKE_CXX_COMPILER} ${cxx_compiler_arg1})
   set(PY_LDSHARED ${link_launcher} ${CMAKE_C_COMPILER} ${c_compiler_arg1} "-shared")
@@ -97,12 +101,17 @@ function(distutils_install_cython_module name)
   get_property(link_launcher GLOBAL PROPERTY RULE_LAUNCH_LINK)
   set(PY_CC "${compiler_launcher} ${CMAKE_C_COMPILER}")
   set(PY_LDSHARED "${link_launcher} ${CMAKE_C_COMPILER} -shared")
+  cmake_parse_arguments(DU "DISABLE_VTA" "" "" ${ARGN})
+  if(DU_DISABLE_VTA AND HAS_VTA)
+    set(CFLAG_DISABLE_VTA -fno-var-tracking-assignments)
+  endif()
   install(CODE "
     set(ENV{CC} \"${PY_CC}\")
     set(ENV{LDSHARED} \"${PY_LDSHARED}\")
     set(ENV{CPPFLAGS} \"-iquote${CMAKE_SOURCE_DIR}/src/include
                         -D'void0=dead_function\(void\)' \
-                        -D'__Pyx_check_single_interpreter\(ARG\)=ARG \#\# 0'\")
+                        -D'__Pyx_check_single_interpreter\(ARG\)=ARG \#\# 0' \
+                        ${CFLAG_DISABLE_VTA}\")
     set(ENV{LDFLAGS} \"-L${CMAKE_LIBRARY_OUTPUT_DIRECTORY}\")
     set(ENV{CYTHON_BUILD_DIR} \"${CMAKE_CURRENT_BINARY_DIR}\")
     set(ENV{CEPH_LIBDIR} \"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}\")
index 0cd19d03174599fff98d172714bd57f73047a5fb..fe700fb0bccb18efc2dac141005c441da97626b5 100644 (file)
@@ -1,5 +1,7 @@
 distutils_add_cython_module(cython_rados
   rados
-  ${CMAKE_CURRENT_SOURCE_DIR}/rados.pyx)
+  ${CMAKE_CURRENT_SOURCE_DIR}/rados.pyx
+  DISABLE_VTA)
 add_dependencies(cython_rados rados)
-distutils_install_cython_module(cython_rados)
+distutils_install_cython_module(cython_rados
+  DISABLE_VTA)