1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
From 9b97824ad0da2c0d3dcc0cf41f4506aa7e458e9f Mon Sep 17 00:00:00 2001
From: Dengke Du <dengke.du@windriver.com>
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 <dengke.du@windriver.com>
Adjust context for v14.2.3
Signed-off-by: He Zhe <zhe.he@windriver.com>
---
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(-)
diff --git a/cmake/modules/Distutils.cmake b/cmake/modules/Distutils.cmake
index f70265f..b2f4223 100644
--- a/cmake/modules/Distutils.cmake
+++ b/cmake/modules/Distutils.cmake
@@ -16,17 +16,8 @@ function(distutils_install_module name)
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)
- if(NOT \"${DU_INSTALL_SCRIPT}\" STREQUAL \"\")
- list(APPEND options --install-script=${DU_INSTALL_SCRIPT})
- endif()
- endif()
+ list(APPEND options --root=${CMAKE_DESTDIR})
+ list(APPEND options --install-lib=${PYTHON_SITEPACKAGES_DIR})
execute_process(
COMMAND ${PYTHON${PYTHON_VERSION}_EXECUTABLE}
setup.py install \${options}
@@ -48,7 +39,7 @@ function(distutils_add_cython_module name src)
# Note: no quotes, otherwise distutils will execute "/usr/bin/ccache gcc"
# CMake's implicit conversion between strings and lists is wonderful, isn't it?
string(REPLACE " " ";" cflags ${CMAKE_C_FLAGS})
- list(APPEND cflags -iquote${CMAKE_SOURCE_DIR}/src/include -w)
+ list(APPEND cflags -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 cflags -D'void0=dead_function\(void\)')
@@ -89,14 +80,8 @@ function(distutils_install_cython_module name)
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
${PYTHON${PYTHON_VERSION}_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/setup.py
diff --git a/cmake/modules/FindRocksDB.cmake b/cmake/modules/FindRocksDB.cmake
index c5dd3df..be38597 100644
--- a/cmake/modules/FindRocksDB.cmake
+++ b/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")
diff --git a/src/compressor/zstd/CMakeLists.txt b/src/compressor/zstd/CMakeLists.txt
index 76709bb..95bba4a 100644
--- a/src/compressor/zstd/CMakeLists.txt
+++ b/src/compressor/zstd/CMakeLists.txt
@@ -9,7 +9,7 @@ ExternalProject_Add(zstd_ext
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_C_FLAGS=${ZSTD_C_FLAGS}
- -DCMAKE_AR=${CMAKE_AR}
+ -DCMAKE_SYSROOT=${CMAKE_SYSROOT}
-DCMAKE_POSITION_INDEPENDENT_CODE=${ENABLE_SHARED}
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/libzstd
BUILD_COMMAND $(MAKE) libzstd_static
diff --git a/src/pybind/cephfs/setup.py b/src/pybind/cephfs/setup.py
index 1f95005..8a6d136 100755
--- a/src/pybind/cephfs/setup.py
+++ b/src/pybind/cephfs/setup.py
@@ -142,14 +142,6 @@ def check_sanity():
finally:
shutil.rmtree(tmp_dir)
-
-if 'BUILD_DOC' in os.environ.keys():
- pass
-elif check_sanity():
- pass
-else:
- sys.exit(1)
-
cmdclass = {}
try:
from Cython.Build import cythonize
diff --git a/src/pybind/rados/setup.py b/src/pybind/rados/setup.py
index 75081df..4d1591c 100755
--- a/src/pybind/rados/setup.py
+++ b/src/pybind/rados/setup.py
@@ -138,14 +138,6 @@ def check_sanity():
finally:
shutil.rmtree(tmp_dir)
-
-if 'BUILD_DOC' in os.environ.keys():
- pass
-elif check_sanity():
- pass
-else:
- sys.exit(1)
-
cmdclass = {}
try:
from Cython.Build import cythonize
diff --git a/src/pybind/rbd/setup.py b/src/pybind/rbd/setup.py
index 8dd5c12..b8f4d91 100755
--- a/src/pybind/rbd/setup.py
+++ b/src/pybind/rbd/setup.py
@@ -141,14 +141,6 @@ def check_sanity():
finally:
shutil.rmtree(tmp_dir)
-
-if 'BUILD_DOC' in os.environ.keys():
- pass
-elif check_sanity():
- pass
-else:
- sys.exit(1)
-
cmdclass = {}
try:
from Cython.Build import cythonize
diff --git a/src/pybind/rgw/setup.py b/src/pybind/rgw/setup.py
index 4ee4f49..91dc7d4 100755
--- a/src/pybind/rgw/setup.py
+++ b/src/pybind/rgw/setup.py
@@ -143,14 +143,6 @@ def check_sanity():
finally:
shutil.rmtree(tmp_dir)
-
-if 'BUILD_DOC' in os.environ.keys():
- pass
-elif check_sanity():
- pass
-else:
- sys.exit(1)
-
cmdclass = {}
try:
from Cython.Build import cythonize
--
2.7.4
|