Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.

Commit 227866f

Browse files
author
TeleGhost Dev
committed
Fix Android i2pd build: absolute final Boost discovery fix with explicit lib paths
1 parent 718e0a1 commit 227866f

1 file changed

Lines changed: 38 additions & 29 deletions

File tree

‎scripts/build_i2pd_android.sh‎

Lines changed: 38 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -45,33 +45,39 @@ for i in "${!ARCHS[@]}"; do
4545
OPENSSL_LIB="$OPENSSL_ROOT/$ARCH/lib"
4646

4747
# Locate Boost for this Arch
48-
# Check different path patterns
49-
if [ -d "$BOOST_ROOT/include/boost" ]; then
50-
BOOST_INCLUDE="$BOOST_ROOT/include"
51-
elif [ -d "$BOOST_ROOT/boost" ]; then
52-
BOOST_INCLUDE="$BOOST_ROOT"
53-
elif [ -d "$BOOST_ROOT/$ARCH/include/boost" ]; then
54-
BOOST_INCLUDE="$BOOST_ROOT/$ARCH/include"
55-
else
56-
echo "Warning: No boost headers folder found in $BOOST_ROOT or subdirs"
57-
BOOST_INCLUDE="$BOOST_ROOT/include"
48+
echo "--- Boost Discovery for $ARCH ---"
49+
50+
# Find headers (version.hpp)
51+
BOOST_INCLUDE_PATH=$(find "$BOOST_ROOT" -name "version.hpp" | grep "boost/version.hpp" | head -n 1 | sed 's|/boost/version.hpp||')
52+
if [ -z "$BOOST_INCLUDE_PATH" ]; then
53+
echo "Warning: find could not locate version.hpp, using fallback paths"
54+
if [ -d "$BOOST_ROOT/include/boost" ]; then BOOST_INCLUDE_PATH="$BOOST_ROOT/include";
55+
elif [ -d "$BOOST_ROOT/boost" ]; then BOOST_INCLUDE_PATH="$BOOST_ROOT";
56+
else BOOST_INCLUDE_PATH="$BOOST_ROOT/include"; fi
5857
fi
58+
echo " Boost Include: $BOOST_INCLUDE_PATH"
5959

60-
# Locate Boost libs for this Arch
61-
if [ -d "$BOOST_ROOT/lib/$ARCH" ]; then
62-
BOOST_LIB="$BOOST_ROOT/lib/$ARCH"
63-
elif [ -d "$BOOST_ROOT/$ARCH/lib" ]; then
64-
BOOST_LIB="$BOOST_ROOT/$ARCH/lib"
65-
else
66-
echo "Warning: No boost libs folder found for $ARCH in $BOOST_ROOT"
67-
BOOST_LIB="$BOOST_ROOT/$ARCH/lib"
60+
# Find libs (search for filesystem lib in arch folder)
61+
# PurpleI2P structure is varied, so we look for libboost_filesystem.a specifically in a path containing the arch name
62+
BOOST_LIB_PATH=$(find "$BOOST_ROOT" -name "libboost_filesystem.a" | grep "/$ARCH/" | head -n 1 | xargs dirname)
63+
if [ -z "$BOOST_LIB_PATH" ]; then
64+
echo "Warning: find could not locate libboost_filesystem.a for $ARCH, using fallback paths"
65+
if [ -d "$BOOST_ROOT/lib/$ARCH" ]; then BOOST_LIB_PATH="$BOOST_ROOT/lib/$ARCH";
66+
elif [ -d "$BOOST_ROOT/$ARCH/lib" ]; then BOOST_LIB_PATH="$BOOST_ROOT/$ARCH/lib";
67+
else BOOST_LIB_PATH="$BOOST_ROOT/$ARCH/lib"; fi
6868
fi
69+
echo " Boost Lib Dir: $BOOST_LIB_PATH"
70+
echo " Boost Lib contents:"
71+
ls -l "$BOOST_LIB_PATH" 2>/dev/null | grep "libboost" | head -n 5 || echo " (no libboost files found!)"
72+
73+
# Export for environment detection (some CMake versions use this)
74+
export BOOST_ROOT="$BOOST_ROOT"
75+
export BOOST_INCLUDEDIR="$BOOST_INCLUDE_PATH"
76+
export BOOST_LIBRARYDIR="$BOOST_LIB_PATH"
6977

70-
echo " Using OpenSSL: $OPENSSL_INCLUDE"
71-
echo " Using Boost Include: $BOOST_INCLUDE"
72-
echo " Using Boost Lib: $BOOST_LIB"
73-
echo " Boost Lib contents (first 10 files):"
74-
ls -p "$BOOST_LIB" 2>/dev/null | grep -v / | head -n 10 || echo " (empty or non-existent)"
78+
# Precise library paths for CMake as a last resort
79+
LIB_FS="$BOOST_LIB_PATH/libboost_filesystem.a"
80+
LIB_PO="$BOOST_LIB_PATH/libboost_program_options.a"
7581

7682
# CMake Configure
7783
cmake -B "$ARCH_BUILD_DIR" -S "$I2PD_SRC/build" \
@@ -86,15 +92,18 @@ for i in "${!ARCHS[@]}"; do
8692
-DWITH_STATIC=ON \
8793
-DOPENSSL_ROOT_DIR="$OPENSSL_ROOT/$ARCH" \
8894
-DBOOST_ROOT="$BOOST_ROOT" \
89-
-DBOOST_INCLUDEDIR="$BOOST_INCLUDE" \
90-
-DBOOST_LIBRARYDIR="$BOOST_LIB" \
91-
-DBoost_INCLUDE_DIR="$BOOST_INCLUDE" \
92-
-DBoost_LIBRARY_DIRS="$BOOST_LIB" \
95+
-DBOOST_INCLUDEDIR="$BOOST_INCLUDE_PATH" \
96+
-DBOOST_LIBRARYDIR="$BOOST_LIB_PATH" \
97+
-DBoost_INCLUDE_DIR="$BOOST_INCLUDE_PATH" \
98+
-DBoost_LIBRARY_DIR_RELEASE="$BOOST_LIB_PATH" \
99+
-DBoost_LIBRARY_DIR_DEBUG="$BOOST_LIB_PATH" \
100+
-DBoost_FILESYSTEM_LIBRARY_RELEASE="$LIB_FS" \
101+
-DBoost_PROGRAM_OPTIONS_LIBRARY_RELEASE="$LIB_PO" \
102+
-DBoost_FILESYSTEM_LIBRARY_DEBUG="$LIB_FS" \
103+
-DBoost_PROGRAM_OPTIONS_LIBRARY_DEBUG="$LIB_PO" \
93104
-DBoost_NO_BOOST_CMAKE=ON \
94105
-DBoost_NO_SYSTEM_PATHS=ON \
95106
-DBoost_USE_STATIC_LIBS=ON \
96-
-DBoost_COMPILER="" \
97-
-DBoost_ARCHITECTURE="" \
98107
-DBoost_DEBUG=ON \
99108
-DCMAKE_BUILD_TYPE=Release
100109

0 commit comments

Comments
 (0)