Skip to content

Commit d3ef254

Browse files
authored
Fix compiling error for Android, and installing error for cmake of low version. (#5660)
1 parent 313f845 commit d3ef254

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

cmake/external/openblas.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ IF(NOT ${CBLAS_FOUND})
9898
ENDIF()
9999
INSTALL(CODE "execute_process(
100100
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CBLAS_INSTALL_DIR}/lib
101-
destination ${CMAKE_INSTALL_PREFIX}/${TMP_INSTALL_DIR}
101+
${CMAKE_INSTALL_PREFIX}/${TMP_INSTALL_DIR}
102102
)"
103103
)
104104
INSTALL(CODE "MESSAGE(STATUS \"Installing: \"

paddle/gserver/layers/ROIPoolLayer.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,9 @@ void ROIPoolLayer::forward(PassType passType) {
100100
size_t roiEndH = round(bottomROIs[4] * spatialScale_);
101101
CHECK_GE(roiBatchIdx, 0UL);
102102
CHECK_LT(roiBatchIdx, batchSize);
103-
size_t roiHeight = std::max(roiEndH - roiStartH + 1, 1UL);
104-
size_t roiWidth = std::max(roiEndW - roiStartW + 1, 1UL);
103+
size_t roiHeight =
104+
std::max(roiEndH - roiStartH + 1, static_cast<size_t>(1));
105+
size_t roiWidth = std::max(roiEndW - roiStartW + 1, static_cast<size_t>(1));
105106
real binSizeH =
106107
static_cast<real>(roiHeight) / static_cast<real>(pooledHeight_);
107108
real binSizeW =
@@ -114,10 +115,14 @@ void ROIPoolLayer::forward(PassType passType) {
114115
size_t wstart = static_cast<size_t>(std::floor(pw * binSizeW));
115116
size_t hend = static_cast<size_t>(std::ceil((ph + 1) * binSizeH));
116117
size_t wend = static_cast<size_t>(std::ceil((pw + 1) * binSizeW));
117-
hstart = std::min(std::max(hstart + roiStartH, 0UL), height_);
118-
wstart = std::min(std::max(wstart + roiStartW, 0UL), width_);
119-
hend = std::min(std::max(hend + roiStartH, 0UL), height_);
120-
wend = std::min(std::max(wend + roiStartW, 0UL), width_);
118+
hstart = std::min(
119+
std::max(hstart + roiStartH, static_cast<size_t>(0)), height_);
120+
wstart = std::min(
121+
std::max(wstart + roiStartW, static_cast<size_t>(0)), width_);
122+
hend = std::min(std::max(hend + roiStartH, static_cast<size_t>(0)),
123+
height_);
124+
wend = std::min(std::max(wend + roiStartW, static_cast<size_t>(0)),
125+
width_);
121126

122127
bool isEmpty = (hend <= hstart) || (wend <= wstart);
123128
size_t poolIndex = ph * pooledWidth_ + pw;

paddle/scripts/docker/build_android.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ if [ $ANDROID_ABI == "armeabi-v7a" ]; then
4444
-DHOST_C_COMPILER=/usr/bin/gcc \
4545
-DHOST_CXX_COMPILER=/usr/bin/g++ \
4646
-DCMAKE_INSTALL_PREFIX=$DEST_ROOT \
47-
-DCMAKE_BUILD_TYPE=Release \
47+
-DCMAKE_BUILD_TYPE=MinSizeRel \
4848
-DUSE_EIGEN_FOR_BLAS=ON \
4949
-DWITH_C_API=ON \
5050
-DWITH_SWIG_PY=OFF \
@@ -58,7 +58,7 @@ elif [ $ANDROID_ABI == "arm64-v8a" ]; then
5858
-DHOST_C_COMPILER=/usr/bin/gcc \
5959
-DHOST_CXX_COMPILER=/usr/bin/g++ \
6060
-DCMAKE_INSTALL_PREFIX=$DEST_ROOT \
61-
-DCMAKE_BUILD_TYPE=Release \
61+
-DCMAKE_BUILD_TYPE=MinSizeRel \
6262
-DUSE_EIGEN_FOR_BLAS=OFF \
6363
-DWITH_C_API=ON \
6464
-DWITH_SWIG_PY=OFF \
@@ -72,7 +72,7 @@ elif [ $ANDROID_ABI == "armeabi" ]; then
7272
-DHOST_C_COMPILER=/usr/bin/gcc \
7373
-DHOST_CXX_COMPILER=/usr/bin/g++ \
7474
-DCMAKE_INSTALL_PREFIX=$DEST_ROOT \
75-
-DCMAKE_BUILD_TYPE=Release \
75+
-DCMAKE_BUILD_TYPE=MinSizeRel \
7676
-DWITH_C_API=ON \
7777
-DWITH_SWIG_PY=OFF \
7878
-DWITH_STYLE_CHECK=OFF \

0 commit comments

Comments
 (0)