Skip to content

Instantly share code, notes, and snippets.

@Nezteb
Last active April 11, 2023 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nezteb/ae28e97d4cc8b3faea5038272f7916df to your computer and use it in GitHub Desktop.
Save Nezteb/ae28e97d4cc8b3faea5038272f7916df to your computer and use it in GitHub Desktop.
For building https://github.com/pgmodeler/pgmodeler from source
# Install/run these first:
# sudo xcrun xcodebuild -license accept
# xcode-select --install
# brew install postgresql@15 libxml2 openssl@1.1 qt
git clone git@github.com:pgmodeler/pgmodeler.git
cd pgmodeler
git clone git@github.com:pgmodeler/plugins.git
# TODO: Figure out error with sampleplugin? (Or maybe this is expected because it's a sample...)
# Could not load the plugin `sampleplugin' from the library `/Applications/pgModeler.app/Contents/MacOS/plugins/sampleplugin/libsampleplugin.dylib'! Message returned by plugin manager: `Cannot load library /Applications/pgModeler.app/Contents/MacOS/plugins/sampleplugin/libsampleplugin.dylib: (dlopen(/Applications/pgModeler.app/Contents/MacOS/plugins/sampleplugin/libsampleplugin.dylib, 0x0006): Library not loaded: @loader_path/../Frameworks/libgui.1.dylib
# Referenced from: <39744287-46BC-3A68-A630-95D644BF52D8> /Applications/pgModeler.app/Contents/MacOS/plugins/sampleplugin/libsampleplugin.dylib
# Reason: tried: '/Applications/pgModeler.app/Contents/MacOS/plugins/sampleplugin/../Frameworks/libgui.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS@loader_path/../Frameworks/libgui.1.dylib' (no such file), '/Applications/pgModeler.app/Contents/MacOS/plugins/sampleplugin/../Frameworks/libgui.1.dylib' (no such file), '/usr/local/lib/libgui.1.dylib' (no such file), '/usr/lib/libgui.1.dylib' (no such file, not in dyld cache))'
export QT_ROOT=/opt/homebrew/Cellar/qt/6.4.3_1
export INSTALLATION_ROOT=/Applications/pgModeler.app
export PGSQL_ROOT=/opt/homebrew/Cellar/postgresql@15/15.2_3
export OPENSSL_ROOT=/opt/homebrew/Cellar/openssl@1.1/1.1.1t
# Edit pgmodeler.pri like so:
# macx {
# PGSQL_LIB = /opt/homebrew/opt/postgresql@15/lib/libpq.dylib
# PGSQL_INC = /opt/homebrew/opt/postgresql@15/include
# XML_INC = /opt/homebrew/opt/libxml2/include
# XML_LIB = /opt/homebrew/opt/libxml2/lib/libxml2.dylib
# # ...
# }
$QT_ROOT/bin/qmake -r CONFIG+=release pgmodeler.pro
make
make install
# STOP HERE
# See https://github.com/pgmodeler/pgmodeler/issues/1751 for details
# Keeping the lines below for completeness sake (even if they don't work for me)
$QT_ROOT/bin/macdeployqt $INSTALLATION_ROOT \
$INSTALLATION_ROOT/Contents/MacOS/pgmodeler-ch \
$INSTALLATION_ROOT/Contents/MacOS/pgmodeler-cli
cp $PGSQL_ROOT/lib/libpq.5.dylib \
$OPENSSL_ROOT/lib/libssl.1.* \
$OPENSSL_ROOT/lib/libcrypto.1.* \
$INSTALLATION_ROOT/Contents/Frameworks
install_name_tool -change "@loader_path/../lib/libcrypto.1.1.dylib" "@loader_path/../Frameworks/libcrypto.1.1.dylib" $INSTALLATION_ROOT/Contents/Frameworks/libssl.1.1.dylib
install_name_tool -change "@loader_path/../lib/libcrypto.1.1.dylib" "@loader_path/../Frameworks/libcrypto.1.1.dylib" $INSTALLATION_ROOT/Contents/Frameworks/libpq.5.dylib
install_name_tool -change "@loader_path/../lib/libssl.1.1.dylib" "@loader_path/../Frameworks/libssl.1.1.dylib" $INSTALLATION_ROOT/Contents/Frameworks/libpq.5.dylib
# TODO: This fails for me: error: /Library/Developer/CommandLineTools/usr/bin/install_name_tool: can't open file: /Applications/pgModeler.app/Contents/Frameworks/libpgconnector.dylib (No such file or directory)
install_name_tool -change libpq.5.dylib "@loader_path/../Frameworks/libpq.5.dylib" $INSTALLATION_ROOT/Contents/Frameworks/libpgconnector.dylib
# TODO: PlugIns doesn't exist, when I guess it should?
mkdir $INSTALLATION_ROOT/PlugIns
mkdir $INSTALLATION_ROOT/PlugIns/tls
# TODO: no matches found: /opt/homebrew/Cellar/qt/6.4.3_1/macos/plugins/platforms/tls/*
cp -r $QT_ROOT/macos/plugins/platforms/tls/* $INSTALLATION_ROOT/PlugIns/tls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment