Attempt to fix rpath issues, MacOs build get complicated, added step notes

This commit is contained in:
Harvey Fong 2026-01-04 02:53:14 +00:00
parent 0f19a691c2
commit c402bf5485
2 changed files with 40 additions and 17 deletions

View File

@ -61,7 +61,7 @@ endif
# Library flags
#LIB_PATHS = -L$(DPP_BUILD_DIR) -L../sqlite3
LIB_PATHS = -L$(DPP_BUILD_DIR) -L.
LIB_PATHS = -L$(DPP_BUILD_DIR) -L../libssl -L.
LIBRARIES = -ldpp -lsqlite3 -lssl -lcrypto
# Build type specific flags
@ -100,12 +100,12 @@ ifeq ($(PLATFORM), Darwin)
fi
@# Fix library paths for OpenSSL dependencies
@if [ -f $(BIN_DIR)/$(DPP_VERSIONED_FILE) ]; then \
install_name_tool -change /Users/harvey/learndir/libssl/install/lib/libssl.4.dylib @executable_path/libssl.dylib $(BIN_DIR)/$(DPP_VERSIONED_FILE); \
install_name_tool -change /Users/harvey/learndir/libssl/install/lib/libcrypto.4.dylib @executable_path/libcrypto.dylib $(BIN_DIR)/$(DPP_VERSIONED_FILE); \
install_name_tool -change ../libssl/libssl.4.dylib @executable_path/libssl.dylib $(BIN_DIR)/$(DPP_VERSIONED_FILE); \
install_name_tool -change ../libssl/libcrypto.4.dylib @executable_path/libcrypto.dylib $(BIN_DIR)/$(DPP_VERSIONED_FILE); \
fi
@install_name_tool -change /Users/harvey/learndir/libssl/install/lib/libssl.4.dylib @executable_path/libssl.dylib $(OUTPUT_FILE); \
install_name_tool -change /Users/harvey/learndir/libssl/install/lib/libcrypto.4.dylib @executable_path/libcrypto.dylib $(OUTPUT_FILE); \
cp libssl.dylib libcrypto.dylib $(BIN_DIR)/
@install_name_tool -change ../libssl/libssl.4.dylib @executable_path/libssl.dylib $(OUTPUT_FILE); \
install_name_tool -change ../libssl/libcrypto.4.dylib @executable_path/libcrypto.dylib $(OUTPUT_FILE); \
cp ../libssl/libssl.dylib ../libssl/libcrypto.dylib $(BIN_DIR)/
else
@# Linux: Handle versioned libraries (follow standard convention)
@if [ -f $(DPP_BUILD_DIR)/$(DPP_VERSIONED_FILE) ]; then \
@ -161,3 +161,4 @@ cleanall:
rmdir obj 2>/dev/null || true
rmdir bin 2>/dev/null || true

View File

@ -48,23 +48,45 @@ make all -j4
```
mkdir workdir && cd workdir
mkdir homebrew
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip-components 1 -C homebrew
eval "$(homebrew/bin/brew shellenv)"
brew update --force --quiet
brew install openssl
git clone https://github.com/brainboxdotcc/DPP.git
cd DPP
mkdir zlib libssl DPP poomer-discord sqlite3
# Build zlib
cd zlib && git clone https://github.com/madler/zlib.git .
./configure --static
make -j$(sysctl -n hw.ncpu)
# Build OpenSSL (creates dynamic .dylib libraries needed for DPP)
cd ../libssl && git clone https://github.com/openssl/openssl.git .
./Configure darwin64-arm64-cc
make -j$(sysctl -n hw.ncpu)
# Fix OpenSSL library install names for portability
# Run this after OpenSSL is built to make the libraries use @rpath instead of hardcoded paths
install_name_tool -id @rpath/libssl.dylib libssl.dylib
install_name_tool -id @rpath/libcrypto.dylib libcrypto.dylib
install_name_tool -change /tmp/openssl-install/lib/libcrypto.4.dylib @rpath/libcrypto.dylib libssl.dylib
# Build sqlite3
cd ../sqlite3
curl -LO https://www.sqlite.org/2025/sqlite-autoconf-3510100.tar.gz
tar xzf sqlite-autoconf-3510100.tar.gz --strip-components=1
./configure --enable-static --disable-shared && make -j$(sysctl -n hw.ncpu)
# Build DPP
cd ../DPP && git clone https://github.com/brainboxdotcc/DPP.git .
/Applications/CMake.app/Contents/bin/cmake -B ./build \
-DOPENSSL_INCLUDE_DIR="$PWD/../libssl/include" \
-DOPENSSL_CRYPTO_LIBRARY="$PWD/../libssl/lib/libcrypto.dylib" \
-DOPENSSL_SSL_LIBRARY="$PWD/../libssl/lib/libssl.dylib" \
-DOPENSSL_CRYPTO_LIBRARY="$PWD/../libssl/libcrypto.dylib" \
-DOPENSSL_SSL_LIBRARY="$PWD/../libssl/libssl.dylib" \
-DCMAKE_PREFIX_PATH="$PWD/../zlib"
/Applications/CMake.app/Contents/bin/cmake --build ./build -j8
/Applications/CMake.app/Contents/bin/cmake --build ./build -j$(sysctl -n hw.ncpu)
# Build poomer-discord
cd ../poomer-discord
git clone https://git.indoodle.com/oomer/poomer-discord.git .
curl -LO https://raw.githubusercontent.com/nothings/stb/master/stb_image.h
curl -LO https://raw.githubusercontent.com/nothings/stb/master/stb_image_write.h
make all -j4
make all -j$(sysctl -n hw.ncpu)
```