[HowTo] Compile TrinityCore on Mac OS X using Homebrew

That looks like you are using mysql 8 which is not supported

Ok, installed mysql 5.7 and it went well until this:

Ld build/src/server/authserver/Release/authserver normal x86_64
cd /Users/synapse/Downloads/Trinity/TrinityCore
export MACOSX_DEPLOYMENT_TARGET=10.13
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -L/Users/synapse/Downloads/Trinity/TrinityCore/build/src/server/authserver/Release -F/Users/synapse/Downloads/Trinity/TrinityCore/build/src/server/authserver/Release -filelist /Users/synapse/Downloads/Trinity/TrinityCore/build/src/server/authserver/TrinityCore.build/Release/authserver.build/Objects-normal/x86_64/authserver.LinkFileList -mmacosx-version-min=10.13 -Wl,-search_paths_first -Wl,-headerpad_max_install_names /Users/synapse/Downloads/Trinity/TrinityCore/build/src/server/shared/Release/libshared.a /Users/synapse/Downloads/Trinity/TrinityCore/build/src/server/database/Release/libdatabase.a /Users/synapse/Downloads/Trinity/TrinityCore/build/src/common/Release/libcommon.a /usr/local/lib/libboost_system-mt.dylib /usr/local/lib/libboost_filesystem-mt.dylib /usr/local/lib/libboost_thread-mt.dylib /usr/local/lib/libboost_program_options-mt.dylib /usr/local/lib/libboost_iostreams-mt.dylib /usr/local/lib/libboost_regex-mt.dylib /Users/synapse/Downloads/Trinity/TrinityCore/build/dep/fmt/Release/libfmt.a /Users/synapse/Downloads/Trinity/TrinityCore/build/dep/g3dlite/Release/libg3dlib.a /Users/synapse/Downloads/Trinity/TrinityCore/build/dep/recastnavigation/Detour/Release/libDetour.a /usr/lib/libz.dylib /usr/local/opt/openssl/lib/libssl.dylib /usr/local/opt/openssl/lib/libcrypto.dylib /usr/local/mysql/lib/libmysqlclient_r.dylib -Xlinker -dependency_info -Xlinker /Users/synapse/Downloads/Trinity/TrinityCore/build/src/server/authserver/TrinityCore.build/Release/authserver.build/Objects-normal/x86_64/authserver_dependency_info.dat -o /Users/synapse/Downloads/Trinity/TrinityCore/build/src/server/authserver/Release/authserver
clang: error: no such file or directory: ‘/usr/local/mysql/lib/libmysqlclient_r.dylib’

** BUILD FAILED **

The following build commands failed:
Ld build/src/server/authserver/Release/authserver normal x86_64
(1 failure)

I don’t have any knowledge about building on mac, just repeating that mysql 8 is not supported on any platform (not related to mac specifically)

it can’t find libmysqlclient_r.dylib, so you need to check where it’s located and change your -DMYSQL_LIBRARY param accordingly during step “5) Generate the XCode project files

cmake $TRINITY/repo -G Xcode
-DMYSQL_ADD_INCLUDE_PATH=/usr/local/include
-DMYSQL_LIBRARY=/usr/local/Cellar/[email protected]/5.7.24/lib/libmysqlclient.dylib
-DREADLINE_INCLUDE_DIR=$TRINITY/include
-DREADLINE_LIBRARY=$TRINITY/lib/libreadline.dylib
-DBOOST_INCLUDEDIR=/usr/local/include
-DBOOST_LIBRARYDIR=/usr/local/lib
-DOPENSSL_SSL_LIBRARIES=$TRINITY/lib/libssl.dylib
-DOPENSSL_CRYPTO_LIBRARIES=$TRINITY/lib/libcrypto.dylib
-DZMQ_LIBRARY=/usr/local/opt/zeromq/lib/libzmq.dylib
-DZMQ_INCLUDE_DIR=/usr/local/opt/zeromq/include
-DOPENSSL_INCLUDE_DIR=$TRINITY/include
-DCMAKE_INSTALL_PREFIX=$TRINITY
-DWITH_WARNINGS=1
-DTOOLS=1
-DUSE_COREPCH=1
-DUSE_SCRIPTPCH=1
-DCMAKE_INSTALL_PREFIX=/Users/nixholas/tc-server \

That worked best for me. Using zshell, so here goes.

export TRINITY=/Volumes/RedOne/TrinityCore
export PATH=$TRINITY/bin:/usr/local/Cellar/[email protected]/5.7.24/bin:$PATH

brew link zlib --force

give me  :

Warning: Refusing to link macOS-provided software: zlib

For compilers to find zlib you may need to set:

export LDFLAGS=“-L/usr/local/opt/zlib/lib”

export CPPFLAGS=“-I/usr/local/opt/zlib/include”

how i can to solve?

Hi all and thanks for this help thread.

I also get the same error as [itsirc] above, on September 20, and you suggest mysql 8 is not supported. But I did not install it mysql, Homebrew did. I followed Homebrew commands, and this is the mysql Homebrew installed (I believe).

So how do I start over with a different mysql version from Homebrew, and what changes do I need to make in my commands?

Thanks,

Aescleal

Update: I figured out how to uninstall mysql 8 via Brew command, and then remove a few extra leftovers. I don’t know how 8 got on there really. Anyway, afterward I installed mysql 5.7 with “Brew install [email protected]”. That worked a charm. So things are improving… except I can’t find libmysqlclient_r.dylib anywhere on my Mac.

Hi, update with more questions…

It seems I can now get things compiled. However I had to use libmysqlclient.dylib, and not libmysqlclient_r.dylib.

It compiles!!! Yay. However, when I use the extractors on the WotLK client, it tells me map extractor is wrong version.

This was built with Homebrew and checked out the 3.3.5. So I’m not sure what is different except libmysqlclient.dylib.

Is there something I’m missing?

Thanks


$ mapextractor

TrinityCore rev. e9bcae1fada6 2018-12-09 16:07:38 +0100 (master branch) (MacOSX, RelWithDebInfo, Static) (Map & DBC Extractor)

to stop.

http://TrinityCore.org

MPQ files found in Data directory!

This tool works only with World of Warcraft: Legion

To extract maps for Wrath of the Lich King, rebuild tools using 3.3.5 branch!

Press ENTER to exit…

I’m success build on Mac OS 12.6 Monterey and old Mojave

after install all brew packages

one more thing to do with Monterey is I need copy ssl config

cp /usr/local/opt/openssl/lib/pkgconfig/*.pc /usr/local/lib/pkgconfig/

when I run this command

brew link zlib --force

It shows these message , but seems no effect anything 

Warning: Refusing to link macOS-provided software: zlib

For compilers to find zlib you may need to set:

export LDFLAGS=“-L/usr/local/opt/zlib/lib”

export CPPFLAGS=“-I/usr/local/opt/zlib/include”

this is what I use for build settings , works for both OS  

cmake …/ -GXcode
-DMYSQL_ADD_INCLUDE_PATH=/usr/local/include
-DMYSQL_LIBRARY=/usr/local/lib/libmysqlclient.dylib
-DREADLINE_INCLUDE_DIR=/usr/local/opt/readline/include
-DREADLINE_LIBRARY=/usr/local/opt/readline/lib/libreadline.dylib
-DBOOST_INCLUDEDIR=/usr/local/include
-DBOOST_LIBRARYDIR=/usr/local/lib
-DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl@3/include
-DOPENSSL_SSL_LIBRARIES=/usr/local/opt/openssl@3/lib/libssl.dylib
-DOPENSSL_CRYPTO_LIBRARIES=/usr/local/opt/openssl@3/lib/libcrypto.dylib
-DZMQ_LIBRARY=/usr/local/opt/zeromq/lib/libzmq.dylib
-DZMQ_INCLUDE_DIR=/usr/local/opt/zeromq/include
-DZLIB_ROOT=/usr/local/Cellar/zlib/1.2.13
-DACE_INCLUDE_DIR=/usr/local/opt/ace/include
-DACE_LIBRARY=/usr/local/opt/ace/lib/libACE.dylib
-DCMAKE_INSTALL_PREFIX=/Applications/Trinity
-DWITH_WARNINGS=1

the key is change oepnssl to openssl@3

and Mojave require Xcode 11 , don’t use Xcode 10