You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had some trouble getting this to work with MariaDB, which is default on XAMPP and is where I already have a number of databases, such as my webserver, so I didn't want to just swap to MySQL 8 or something.
I'm not good with Git (I need to Git good?), but I made it work anyways. First, I cloned the repository at "https://github.com/trickerer/TrinityCore-3.3.5-with-NPCBots" (I wasn't sure how to clone a specific commit though). Then I ran CMAKE. I modified some files there so they would point to my MariaDB files, then did a fresh install of MariaDB 10.4.24 (to match my XAMPP-supplied version) so it would put info in the registry. Because the MariaDB install doesn't come with libmariadb.lib, I had to go find that and compile myself, then put it where CMAKE expected it. From there I was able to compile the server and make it work.
Following are detailed instructions on how I made it work. I'm using Windows 10, VS 2019, and MariaDB 10.4. Instructions will obviously differ if you're using something else, but it should be fairly straightforward to adjust as needed.
My Setup and Terms I'm Using
So we're on the same page, I have 5 main folders I'm using for the install, and I'm calling them Client, Core, Build, Extract, and Server.
Client has the client software with Wow.exe in it. We won't care about it here.
Core has the base code and CMAKE files you GitCloned or downloaded from this GitHub project.
Build has the Visual Studio (or other IDE) project files you created using CMAKE.
Extract has the DB extractors used later. We won't care about it here.
Server has the files used to actually run your server, including authserver.exe and worldserver.exe.
Find Your MariaDB Version
Open up XAMPP, then the MySQL Admin panel, then find the version number on the web page.
Get the Appropriate MariaDB Dev Files
I have MariaDB 10.4.17. I couldn't find that exact revision, but any version 10.4 should be compatible. I went to the MariaDB website and downloaded version 10.4.24, found here.
I used the MSI installer so it would create registry entries, but you can always just extract it somewhere and point CMAKE directly at the folder. As long as you can get the header files, nothing else matters. (We already have MariaDB with XAMPP or we wouldn't be doing this, so we just need the dev files.)
Find your MariaDB Folders
The folders we care about are the header and library folders. CMAKE should already know how to find the folders if you installed MariaDB with the installer, but if you also have MySQL 8 or something installed, it will use that instead.
We'll find the include\mysql folder with mysql.h, and the lib folder with libmariadb.pdb.
Get libmariadb.lib and libmariadb.dll
We need libmariadb.lib so TrinityCore will compile properly. Unfortunately, I couldn't find it in my MariaDB install anywhere. So I had to get it from the source.
If you happen to be using 10.4.24 you can just download these compiled .dll and .lib files: libmariadb 10.4.24.zip. You can then skip to the next heading, Copy libmariadb to the Correct Folder. Otherwise, you'll have to compile it yourself. Read on!
The file is part of the MariaDB Connector-C project, which is open source, and available here on GitHub. First, I went to the MariaDB website to find which connector belongs in my version of MariaDB. This page lists all the connector versions and tells us which MariaDB versions use it.
Since I downloaded MariaDB 10.4.24, I want to use connector version 3.1.16.
Go to the Tags section of the Connector-C project, found here, and find the version you like. Click the download for whatever version you prefer.
Extract the file somewhere you can access it, then use CMAKE to generate a project file. I didn't have any issues with dependencies or anything here.
Go to the folder with your VS project file. You (probably) need to edit the version numbers, found in include\mariadb_version.h.
You can also find it by opening the solution in Visual Studio and going into one of the external dependency tabs. The async project has it for sure.
I think if you went through Git properly, this wouldn't be necessary (it appears the original project pulls the version numbers from elsewhere), but I'm not sure how to do that. So you'll want to change the version numbers in Connector-C so they match the numbers you compiled against in your MariaDB headers.
There are two places you want to set the version number and two places for the version ID, all in the same file. It's a short file so it's easy to find.
The strings just use the version number as-is. The IDs use the version number without the dots. I assume this works for all versions, but I don't know that for a fact. It does work this way for MySQL 5.5, so it's pretty common.
Compile the solution. I used Release, x64. Now you can find two files you'll need. libmariadb.lib will get used to compile TrinityCore, then you'll need libmariadb.dll to run the server later. You can find both of them in libmariadb\Release (assuming you compiled to Release).
Copy libmariadb to the Correct Folder
You can point CMAKE to whatever folder you want, but for simplicity I put libmariadb.lib in the MariaDB\lib folder so CMAKE can find it using the registry. Also, it's very possible TrinityCore needs other libraries in this folder to properly compile (CMAKE looks for mariadbclient.lib, so it probably needs at least that).
libmariadb.dll will get copied to the Server folder during a later step, so remember what you did with it. (Or cheat and copy it now. I won't tell.)
Point CMAKE to the New Files
If you've never installed MySQL on your system, CMAKE should find everything automatically at this point and you can skip this step. If you have MySQL, CMAKE will prefer to target that platform, so you need to change things.
You can manually enter the paths in the CMAKE interface, or you can adjust the CMAKE macro file to point at the correct folder. For one-off compiles it's probably faster to just do it manually, but you might want to edit the CMAKE file if you're planning to update TrinityCore using CMAKE later. (I think you need to save a copy of the CMAKE file in this case, so you might make a script to copy the modified file into the newest update of TrinityCore if you're using this method.)
To edit the CMAKE file, you'll want to edit Core\cmake\macros\FindMySQL.cmake. Search for the line "find_path(MYSQL_INCLUDE_DIR".
Now delete all the lines related to MySQL rather than MariaDB. Alternately, you could push the lines for MariaDB to the top. If you're targeting a version other than 10.4 or 10.5, you'll also have to edit the MariaDB lines as needed.
Do the same thing for the line "find_library(MYSQL_LIBRARY". There's a UNIX line and a WIN32 line so choose appropriately.
If you just want to input the paths directly, simply change the paths as needed in CMAKE. Open CMAKE, point Source to your Core folder, Build to Build folder, then hit Configure. Scroll down the list to find the entries you need and point them to the right places. Mine found MYSQL_EXECUTABLE, but you'll want to make sure it's pointing to XAMPP or whatever instead of MySQL.
At this point, you should be able to hit Configure once more then Generate to create the Build files.
Compile TrinityCore
Open the solution in the Build folder and compile it. The original instructions recommend RelWithDebug, x64. It took me 5 or 10 minutes to finish the compile. If you screwed something up with the library, it will yell at you immediately. Troubleshoot until you get everything compiled.
Move Libraries Into the Server Folder
At this point in the main instructions, you'll already be copying your server files, including authserver.exe and worldserver.exe, from the Build folder to the Server folder. But instead of copying libmysql.dll like the instructions say, you need to copy the libmariadb.dll library you compiled earlier.
Finish Up and Enjoy
You still need to setup your .conf files, make changes to the database's realmlist table, etc. as detailed in the main instructions. But you should now be able to correctly access your MariaDB-based XAMPP server, once you get to that part of the setup.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I had some trouble getting this to work with MariaDB, which is default on XAMPP and is where I already have a number of databases, such as my webserver, so I didn't want to just swap to MySQL 8 or something.
I'm not good with Git (I need to Git good?), but I made it work anyways. First, I cloned the repository at "https://github.com/trickerer/TrinityCore-3.3.5-with-NPCBots" (I wasn't sure how to clone a specific commit though). Then I ran CMAKE. I modified some files there so they would point to my MariaDB files, then did a fresh install of MariaDB 10.4.24 (to match my XAMPP-supplied version) so it would put info in the registry. Because the MariaDB install doesn't come with libmariadb.lib, I had to go find that and compile myself, then put it where CMAKE expected it. From there I was able to compile the server and make it work.
Following are detailed instructions on how I made it work. I'm using Windows 10, VS 2019, and MariaDB 10.4. Instructions will obviously differ if you're using something else, but it should be fairly straightforward to adjust as needed.
My Setup and Terms I'm Using
So we're on the same page, I have 5 main folders I'm using for the install, and I'm calling them Client, Core, Build, Extract, and Server.
Client has the client software with Wow.exe in it. We won't care about it here.
Core has the base code and CMAKE files you GitCloned or downloaded from this GitHub project.
Build has the Visual Studio (or other IDE) project files you created using CMAKE.
Extract has the DB extractors used later. We won't care about it here.
Server has the files used to actually run your server, including authserver.exe and worldserver.exe.
Find Your MariaDB Version
Open up XAMPP, then the MySQL Admin panel, then find the version number on the web page.
Get the Appropriate MariaDB Dev Files
I have MariaDB 10.4.17. I couldn't find that exact revision, but any version 10.4 should be compatible. I went to the MariaDB website and downloaded version 10.4.24, found here.
I used the MSI installer so it would create registry entries, but you can always just extract it somewhere and point CMAKE directly at the folder. As long as you can get the header files, nothing else matters. (We already have MariaDB with XAMPP or we wouldn't be doing this, so we just need the dev files.)
Find your MariaDB Folders
The folders we care about are the header and library folders. CMAKE should already know how to find the folders if you installed MariaDB with the installer, but if you also have MySQL 8 or something installed, it will use that instead.
We'll find the include\mysql folder with mysql.h, and the lib folder with libmariadb.pdb.
Get libmariadb.lib and libmariadb.dll
We need libmariadb.lib so TrinityCore will compile properly. Unfortunately, I couldn't find it in my MariaDB install anywhere. So I had to get it from the source.
If you happen to be using 10.4.24 you can just download these compiled .dll and .lib files:
libmariadb 10.4.24.zip. You can then skip to the next heading, Copy libmariadb to the Correct Folder. Otherwise, you'll have to compile it yourself. Read on!
The file is part of the MariaDB Connector-C project, which is open source, and available here on GitHub. First, I went to the MariaDB website to find which connector belongs in my version of MariaDB. This page lists all the connector versions and tells us which MariaDB versions use it.
Since I downloaded MariaDB 10.4.24, I want to use connector version 3.1.16.
Go to the Tags section of the Connector-C project, found here, and find the version you like. Click the download for whatever version you prefer.
Extract the file somewhere you can access it, then use CMAKE to generate a project file. I didn't have any issues with dependencies or anything here.
Go to the folder with your VS project file. You (probably) need to edit the version numbers, found in include\mariadb_version.h.
You can also find it by opening the solution in Visual Studio and going into one of the external dependency tabs. The async project has it for sure.
I think if you went through Git properly, this wouldn't be necessary (it appears the original project pulls the version numbers from elsewhere), but I'm not sure how to do that. So you'll want to change the version numbers in Connector-C so they match the numbers you compiled against in your MariaDB headers.
There are two places you want to set the version number and two places for the version ID, all in the same file. It's a short file so it's easy to find.
#define MARIADB_CLIENT_VERSION_STR "10.4.24"
#define MARIADB_VERSION_ID 100424
#define MYSQL_VERSION_ID 100424
#define MYSQL_SERVER_VERSION "10.4.24-MariaDB"
The strings just use the version number as-is. The IDs use the version number without the dots. I assume this works for all versions, but I don't know that for a fact. It does work this way for MySQL 5.5, so it's pretty common.
Compile the solution. I used Release, x64. Now you can find two files you'll need. libmariadb.lib will get used to compile TrinityCore, then you'll need libmariadb.dll to run the server later. You can find both of them in libmariadb\Release (assuming you compiled to Release).
Copy libmariadb to the Correct Folder
You can point CMAKE to whatever folder you want, but for simplicity I put libmariadb.lib in the MariaDB\lib folder so CMAKE can find it using the registry. Also, it's very possible TrinityCore needs other libraries in this folder to properly compile (CMAKE looks for mariadbclient.lib, so it probably needs at least that).
libmariadb.dll will get copied to the Server folder during a later step, so remember what you did with it. (Or cheat and copy it now. I won't tell.)
Point CMAKE to the New Files
If you've never installed MySQL on your system, CMAKE should find everything automatically at this point and you can skip this step. If you have MySQL, CMAKE will prefer to target that platform, so you need to change things.
You can manually enter the paths in the CMAKE interface, or you can adjust the CMAKE macro file to point at the correct folder. For one-off compiles it's probably faster to just do it manually, but you might want to edit the CMAKE file if you're planning to update TrinityCore using CMAKE later. (I think you need to save a copy of the CMAKE file in this case, so you might make a script to copy the modified file into the newest update of TrinityCore if you're using this method.)
To edit the CMAKE file, you'll want to edit Core\cmake\macros\FindMySQL.cmake. Search for the line "find_path(MYSQL_INCLUDE_DIR".
Now delete all the lines related to MySQL rather than MariaDB. Alternately, you could push the lines for MariaDB to the top. If you're targeting a version other than 10.4 or 10.5, you'll also have to edit the MariaDB lines as needed.
Do the same thing for the line "find_library(MYSQL_LIBRARY". There's a UNIX line and a WIN32 line so choose appropriately.
If you just want to input the paths directly, simply change the paths as needed in CMAKE. Open CMAKE, point Source to your Core folder, Build to Build folder, then hit Configure. Scroll down the list to find the entries you need and point them to the right places. Mine found MYSQL_EXECUTABLE, but you'll want to make sure it's pointing to XAMPP or whatever instead of MySQL.
MYSQL_EXECUTABLE -> XAMPP's mysql.exe binary
MYSQL_INCLUDE_DIR -> MariaDB's include\mysql folder
MYSQL_LIBRARY -> Our compiled libmariadb.lib binary
At this point, you should be able to hit Configure once more then Generate to create the Build files.
Compile TrinityCore
Open the solution in the Build folder and compile it. The original instructions recommend RelWithDebug, x64. It took me 5 or 10 minutes to finish the compile. If you screwed something up with the library, it will yell at you immediately. Troubleshoot until you get everything compiled.
Move Libraries Into the Server Folder
At this point in the main instructions, you'll already be copying your server files, including authserver.exe and worldserver.exe, from the Build folder to the Server folder. But instead of copying libmysql.dll like the instructions say, you need to copy the libmariadb.dll library you compiled earlier.
Finish Up and Enjoy
You still need to setup your .conf files, make changes to the database's realmlist table, etc. as detailed in the main instructions. But you should now be able to correctly access your MariaDB-based XAMPP server, once you get to that part of the setup.
Beta Was this translation helpful? Give feedback.
All reactions