This is an automated email from the ASF dual-hosted git repository.

hulk pushed a commit to branch 2.5
in repository https://gitbox.apache.org/repos/asf/kvrocks.git

commit 3fe7b82752467f67d987ae52662320c72adf4031
Author: Ovais Tariq <[email protected]>
AuthorDate: Fri Jul 21 08:21:53 2023 -0700

    Fix  Docker image may crash if running on the AMD platform (#1602)
    
    RocksDB PORTABLE was set to 0 after #1516 and it may return an illegal 
instruction error
    when running on the AMD platform. This PR fixes this issue by changing the 
default value
    of PORTABLE to 1 so that it can compile the rocksdb without platform 
special instructions.
---
 Dockerfile | 2 +-
 x.py       | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 79c132bd..68a754e2 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -23,7 +23,7 @@ RUN apk update && apk add git gcc g++ make cmake ninja 
autoconf automake libtool
 WORKDIR /kvrocks
 
 COPY . .
-RUN ./x.py build -DENABLE_OPENSSL=ON -DCMAKE_BUILD_TYPE=Release -j $(nproc) 
$MORE_BUILD_ARGS
+RUN ./x.py build -DENABLE_OPENSSL=ON -DPORTABLE=1 -DCMAKE_BUILD_TYPE=Release 
-j $(nproc) $MORE_BUILD_ARGS
 
 FROM alpine:3.16
 
diff --git a/x.py b/x.py
index b8cae06b..a2490558 100755
--- a/x.py
+++ b/x.py
@@ -108,7 +108,7 @@ def build(dir: str, jobs: Optional[int], ghproxy: bool, 
ninja: bool, unittest: b
 
     makedirs(dir, exist_ok=True)
 
-    cmake_options = ["-DCMAKE_BUILD_TYPE=RelWithDebInfo", "-DPORTABLE=0"]
+    cmake_options = ["-DCMAKE_BUILD_TYPE=RelWithDebInfo"]
     if ghproxy:
         cmake_options.append("-DDEPS_FETCH_PROXY=https://ghproxy.com/";)
     if ninja:
@@ -119,6 +119,11 @@ def build(dir: str, jobs: Optional[int], ghproxy: bool, 
ninja: bool, unittest: b
         cmake_options += ["-DCMAKE_C_COMPILER=clang", 
"-DCMAKE_CXX_COMPILER=clang++"]
     if D:
         cmake_options += [f"-D{o}" for o in D]
+
+    portable_flag_enabled = any("DPORTABLE" in o for o in cmake_options)
+    if not portable_flag_enabled:
+        cmake_options.append("-DPORTABLE=0")
+
     run(cmake, str(basedir), *cmake_options, verbose=True, cwd=dir)
 
     if skip_build:

Reply via email to