From 4712fe18405ffea31405308357a8e7fca358bcce Mon Sep 17 00:00:00 2001 From: Dengke Du Date: Mon, 11 Mar 2019 09:14:09 +0800 Subject: [PATCH] ceph: fix build errors for cross compile 1. set the cross compile sysroot to find the rocksdb library 2. correct the install path for library in Distutils.cmake Upstream-Status: Inappropriate [oe specific] Signed-off-by: Dengke Du Adjust context for v14.2.3 Signed-off-by: He Zhe Signed-off-by: Sakib Sajal --- cmake/modules/Distutils.cmake | 25 +++++-------------------- cmake/modules/FindRocksDB.cmake | 4 ++-- src/compressor/zstd/CMakeLists.txt | 2 +- src/pybind/cephfs/setup.py | 8 -------- src/pybind/rados/setup.py | 8 -------- src/pybind/rbd/setup.py | 8 -------- src/pybind/rgw/setup.py | 8 -------- 7 files changed, 8 insertions(+), 55 deletions(-) Index: ceph-18.2.0/cmake/modules/Distutils.cmake =================================================================== --- ceph-18.2.0.orig/cmake/modules/Distutils.cmake +++ ceph-18.2.0/cmake/modules/Distutils.cmake @@ -29,17 +29,10 @@ cmake_parse_arguments(DU "" "INSTALL_SCRIPT" "" ${ARGN}) install(CODE " set(options --prefix=${CMAKE_INSTALL_PREFIX}) - if(DEFINED ENV{DESTDIR}) - if(EXISTS /etc/debian_version) - list(APPEND options --install-layout=deb) - endif() - list(APPEND options - --root=\$ENV{DESTDIR} - --single-version-externally-managed) - endif() if(NOT \"${DU_INSTALL_SCRIPT}\" STREQUAL \"\") list(APPEND options --install-script=${DU_INSTALL_SCRIPT}) - endif() + list(APPEND options --root=${CMAKE_DESTDIR}) + list(APPEND options --install-lib=${PYTHON_SITEPACKAGES_DIR}) execute_process( COMMAND ${Python3_EXECUTABLE} setup.py install \${options} @@ -65,7 +58,7 @@ if(DU_DISABLE_VTA AND HAS_VTA) list(APPEND PY_CFLAGS -fno-var-tracking-assignments) endif() - list(APPEND PY_CPPFLAGS -iquote${CMAKE_SOURCE_DIR}/src/include -w) + list(APPEND PY_CPPFLAGS -iquote${CMAKE_SOURCE_DIR}/src/include -w --sysroot=${CMAKE_SYSROOT}) # This little bit of magic wipes out __Pyx_check_single_interpreter() # Note: this is reproduced in distutils_install_cython_module list(APPEND PY_CPPFLAGS -D'void0=dead_function\(void\)') @@ -135,14 +128,8 @@ set(ENV{CEPH_LIBDIR} \"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}\") set(options --prefix=${CMAKE_INSTALL_PREFIX}) - if(DEFINED ENV{DESTDIR}) - if(EXISTS /etc/debian_version) - list(APPEND options --install-layout=deb) - endif() - list(APPEND options --root=\$ENV{DESTDIR}) - else() - list(APPEND options --root=/) - endif() + list(APPEND options --root=${CMAKE_DESTDIR}) + list(APPEND options --install-lib=${PYTHON_SITEPACKAGES_DIR}) execute_process( COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/setup.py Index: ceph-18.2.0/cmake/modules/FindRocksDB.cmake =================================================================== --- ceph-18.2.0.orig/cmake/modules/FindRocksDB.cmake +++ ceph-18.2.0/cmake/modules/FindRocksDB.cmake @@ -9,9 +9,9 @@ # ROCKSDB_VERSION_MINOR # ROCKSDB_VERSION_PATCH -find_path(ROCKSDB_INCLUDE_DIR rocksdb/db.h) +find_path(ROCKSDB_INCLUDE_DIR rocksdb/db.h ${CMAKE_SYSROOT}) -find_library(ROCKSDB_LIBRARIES rocksdb) +find_library(ROCKSDB_LIBRARIES rocksdb ${CMAKE_SYSROOT}) if(ROCKSDB_INCLUDE_DIR AND EXISTS "${ROCKSDB_INCLUDE_DIR}/rocksdb/version.h") foreach(ver "MAJOR" "MINOR" "PATCH") Index: ceph-18.2.0/src/pybind/cephfs/setup.py =================================================================== --- ceph-18.2.0.orig/src/pybind/cephfs/setup.py +++ ceph-18.2.0/src/pybind/cephfs/setup.py @@ -135,20 +135,6 @@ finally: shutil.rmtree(tmp_dir) - -if 'BUILD_DOC' in os.environ or 'READTHEDOCS' in os.environ: - ext_args = {} - cython_constants = dict(BUILD_DOC=True) - cythonize_args = dict(compile_time_env=cython_constants) -elif check_sanity(): - ext_args = get_python_flags(['cephfs']) - cython_constants = dict(BUILD_DOC=False) - include_path = [os.path.join(os.path.dirname(__file__), "..", "rados")] - cythonize_args = dict(compile_time_env=cython_constants, - include_path=include_path) -else: - sys.exit(1) - cmdclass = {} try: from Cython.Build import cythonize Index: ceph-18.2.0/src/pybind/rados/setup.py =================================================================== --- ceph-18.2.0.orig/src/pybind/rados/setup.py +++ ceph-18.2.0/src/pybind/rados/setup.py @@ -130,17 +130,6 @@ finally: shutil.rmtree(tmp_dir) - -if 'BUILD_DOC' in os.environ or 'READTHEDOCS' in os.environ: - ext_args = {} - cython_constants = dict(BUILD_DOC=True) -elif check_sanity(): - ext_args = get_python_flags(['rados']) - cython_constants = dict(BUILD_DOC=False) -else: - sys.exit(1) - -cmdclass = {} try: from Cython.Build import cythonize from Cython.Distutils import build_ext Index: ceph-18.2.0/src/pybind/rbd/setup.py =================================================================== --- ceph-18.2.0.orig/src/pybind/rbd/setup.py +++ ceph-18.2.0/src/pybind/rbd/setup.py @@ -133,20 +133,6 @@ finally: shutil.rmtree(tmp_dir) - -if 'BUILD_DOC' in os.environ or 'READTHEDOCS' in os.environ: - ext_args = {} - cython_constants = dict(BUILD_DOC=True) - cythonize_args = dict(compile_time_env=cython_constants) -elif check_sanity(): - ext_args = get_python_flags(['rados', 'rbd']) - cython_constants = dict(BUILD_DOC=False) - include_path = [os.path.join(os.path.dirname(__file__), "..", "rados")] - cythonize_args = dict(compile_time_env=cython_constants, - include_path=include_path) -else: - sys.exit(1) - cmdclass = {} try: from Cython.Build import cythonize Index: ceph-18.2.0/src/pybind/rgw/setup.py =================================================================== --- ceph-18.2.0.orig/src/pybind/rgw/setup.py +++ ceph-18.2.0/src/pybind/rgw/setup.py @@ -134,20 +134,6 @@ finally: shutil.rmtree(tmp_dir) - -if 'BUILD_DOC' in os.environ or 'READTHEDOCS' in os.environ: - ext_args = {} - cython_constants = dict(BUILD_DOC=True) - cythonize_args = dict(compile_time_env=cython_constants) -elif check_sanity(): - ext_args = get_python_flags(['rados', 'rgw']) - cython_constants = dict(BUILD_DOC=False) - include_path = [os.path.join(os.path.dirname(__file__), "..", "rados")] - cythonize_args = dict(compile_time_env=cython_constants, - include_path=include_path) -else: - sys.exit(1) - cmdclass = {} try: from Cython.Build import cythonize