Skip to content

Commit 213a519

Browse files
committed
[TEMPORARY] cherry-pick of 35148ac from branch: eb/feature/docker-build-for-GCC11+
1 parent 3405f4f commit 213a519

1 file changed

Lines changed: 24 additions & 15 deletions

File tree

java/crossbuild/docker-build-linux.sh

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,36 @@ rm -rf /rocksdb-local-build/{*,.[!.]*,..?*}
1616
cp -r /rocksdb-host/. /rocksdb-local-build
1717
pushd /rocksdb-local-build
1818

19-
# Use scl devtoolset if available
19+
# Detect and enable devtoolset if available
20+
DEVTOOLSET=""
2021
if hash scl 2>/dev/null; then
21-
if scl --list | grep -q 'devtoolset-8'; then
22-
# CentOS 6+
23-
scl enable devtoolset-8 'make clean-not-downloaded'
24-
scl enable devtoolset-8 "PORTABLE=1 J=$J make -j$J rocksdbjavastatic"
22+
# Check for devtoolsets in order of preference (newer first)
23+
if scl --list | grep -q 'devtoolset-12'; then
24+
DEVTOOLSET="devtoolset-12"
25+
elif scl --list | grep -q 'devtoolset-11'; then
26+
DEVTOOLSET="devtoolset-11"
27+
elif scl --list | grep -q 'devtoolset-10'; then
28+
DEVTOOLSET="devtoolset-10"
29+
elif scl --list | grep -q 'devtoolset-9'; then
30+
DEVTOOLSET="devtoolset-9"
31+
elif scl --list | grep -q 'devtoolset-8'; then
32+
DEVTOOLSET="devtoolset-8"
2533
elif scl --list | grep -q 'devtoolset-7'; then
26-
# CentOS 6+
27-
scl enable devtoolset-7 'make clean-not-downloaded'
28-
scl enable devtoolset-7 "PORTABLE=1 J=$J make -j$J rocksdbjavastatic"
34+
DEVTOOLSET="devtoolset-7"
2935
elif scl --list | grep -q 'devtoolset-2'; then
30-
# CentOS 5 or 6
31-
scl enable devtoolset-2 'make clean-not-downloaded'
32-
scl enable devtoolset-2 "PORTABLE=1 J=$J make -j$J rocksdbjavastatic"
33-
else
34-
echo "Could not find devtoolset"
35-
exit 1;
36+
DEVTOOLSET="devtoolset-2"
3637
fi
38+
fi
39+
40+
# Build with devtoolset if available, otherwise use system compiler
41+
if [ -n "$DEVTOOLSET" ]; then
42+
echo "Using $DEVTOOLSET"
43+
scl enable $DEVTOOLSET "bash -c 'make clean-not-downloaded'"
44+
scl enable $DEVTOOLSET "bash -c 'PORTABLE=1 J=$J make -j$J rocksdbjavastatic'"
3745
else
46+
echo "No SCL devtoolset found, falling back to system compiler"
3847
make clean-not-downloaded
39-
PORTABLE=1 make -j$J rocksdbjavastatic
48+
PORTABLE=1 J=$J make -j$J rocksdbjavastatic
4049
fi
4150

4251
cp java/target-native/librocksdbjni-linux*.so /rocksdb-java-target

0 commit comments

Comments
 (0)