Compiling FluffOS v2019 under OSX & Windows(msys2 + mingw64)

Hello there,

Some of your might know that I’ve been putting some work in FluffOS v2019 lately, adding some long craven features to it (full UTF8 support, yay), and also, I want to make it easier to development and experiment with.

That’s why today I am posting the current steps to build and play with fluffos on OSX and Mingw64.

For OSX:
Thanks to github, fluffOS now has OSX CI that will check all commits, this is also where you want to look on how to build the driver if the information here is outdated:

So, checkout https://github.com/fluffos/fluffos/blob/master/.github/workflows/ci-osx.yml

Basically, in order to build FluffOS under OSX, you need to install https://brew.sh/ first.

Then you would want to install all the libraries you need

$ brew install cmake pkg-config mysql pcre libevent openssl jemalloc

One caveat is that Homebrew don’t install openssl into the usual places, so you need extra ENV param when doing cmake

$ mkdir build
$ cd build
$ OPENSSL_ROOT_DIR="/usr/local/opt/openssl" cmake ..
$ make install

Find your OSX binary at build/bin !

For Windows (MSYS2/Mingw64):

So, Github Actions doesn’t come with MSYS2 by default yet, so we haven’t add an CI, keep an eye out though.

First, you need to install MSYS2, from offical website here , pick X86_64 version if you are on 64 bit windows, i686 if you are on 32bit. (Note that it doesn’t matter what you compile into, FluffOS LPC VM is always 64bit! The only difference is that you can’t use more than 4G memory in 32bit.)

Next, you need to open msys2.exe and sync and update MSYS2 with pacman. Do

$ pacman -Syu

and you might need to close msys window and reopen, keep running that command until there is nothing to upgrade anymore.

image

Secondly, you want to install mingw64 devtoolchain, do this

$ pacman -S git mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake
$ pacman -S mingw-w64-x86_64-zlib mingw-w64-x86_64-libevent mingw-w64-x86_64-pcre mingw-w64-x86_64-icu mingw-w64-x86_64-openssl

$ pacman -S bison

Once this is over, remember to close MSYS2 window, find MINGW64.exe in the same directory and open that instead. Very Important!

Now, build things as usual!

$ mkdir build
$ cd build
$ cmake -G "MSYS Makefiles" -DPACKAGE_DB=OFF ..
$ make install

If you want PACKAGE_DB=ON , install additonal mysql package with

pacman -S mingw-w64-x86_64-libmariadbclient

Or if you want sqlite3

pacman -S mingw-w64-x86_64-sqlite3

That’s it!

Note

Remember both platform are experimental right now (For example, eval limit timer won’t trigger), especially on Windows, so report any bug you might have seen!

edited to reflect latest changes [thefallentree]

下面是中文版的编译流程

安装完msys2 64之后,运行msys2.exe,并且同步更新系统环境
pacman -Syu
中间可能好几次,根据提示,直接点右上角的X关闭窗口,然后再次打开继续更新,直到提示今日无事可做为止。

安装相关的编译工具
pacman -S git mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake
pacman -S mingw-w64-x86_64-zlib mingw-w64-x86_64-libevent mingw-w64-x86_64-pcre mingw-w64-x86_64-icu
pacman -S bison
pacman -S make

直接关掉msys2.exe
将mysql开发包解压缩到C盘根目录,结果应该如下:C:\MySql\mysql-connector-c-6.1.11-winx64
以管理员权限运行mingw64.exe
git clone/pull不用说了吧
mkdir build
cd build
cmake -G “MSYS Makefiles” -DPACKAGE_CRYPTO=OFF …
make install

生成的driver.exe在build\bin下面,同时依赖以下dll:
libevent-2-1-7.dll
libevent_core-2-1-7.dll
libevent_extra-2-1-7.dll
libevent_openssl-2-1-7.dll
libgcc_s_seh-1.dll
libmysql.dll
libpcre-1.dll
libssp-0.dll
libstdc+±6.dll
libwinpthread-1.dll
zlib1.dll
libjemalloc.dll
除了libmysql.dll在C:\MySql\mysql-connector-c-6.1.11-winx64\lib以外,别的全都在C:\msys64\mingw64\bin下面

after running :

cmake -G “MSYS Makefiles” -DPACKAGE_CRYPTO=OFF …

I got the result as below:
CMake Error: The source directory “C:/msys64/home/Kam” does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

any step I miss or wrong?

Yeah, you still need to run

  1. git clone …
  2. cd fluffos
  3. mkdir build
  4. cd build
  5. cmake … -G “…”

Note that you need to create another build directory, and run cmake command in that directory with reference of the source directory (you maybe adding … before)

Thanks, I was finally able to compile on Windows with this instructions adding
mingw-w64-x86_64-cmake
to the list of pacman packages.

Note, it seems that you need to install mingw- packages or things get messed up, e.g. don’t install cmake, install mingw-w64-x86_64-cmake.

Congrats! Let me know if you have any more issues :smiley:

Everything works fine if I build with -DPACKAGE_DB=OFF
However, if I leave this option out to try and build with MySQL, the cmake step completes without error but “make install” fails at

[ 98%] Building CXX object src/CMakeFiles/lpcc.dir/main_lpcc.cc.obj

with the error

C:/msys64/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/9.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: internal error …/…/binutils-2.34/ld/ldlang.c 7101
collect2.exe: error: ld returned 1 exit status
make[2]: *** [src/CMakeFiles/lpcc.dir/build.make:130: src/lpcc.exe] Error 1
make[2]: Leaving directory ‘/home/fluff/fluffos/build’
make[1]: *** [CMakeFiles/Makefile2:805: src/CMakeFiles/lpcc.dir/all] Error 2
make[1]: Leaving directory ‘/home/fluff/fluffos/build’
make: *** [Makefile:169: all] Error 2

I’m using mysql-connector-c-6.1.11-winx64 for the MySQL include and lib files.

Are there any hints for quick partial building and running with a debugger?

Thanks

You need to see what was outputed when you run cmake . especially the mysql part.

For now, under windows, to compile you need to install mysql-connector under c:\mysql (that is what cmake output will tell you if it finds it or not).

Please post what cmake step outputs if you couldn’t figure out

Actually, it doesn’t appear this has anything to do with Mysql errors. make sure you run pacman -Syuu to upgrade everything and retry. Some time latest GCC upgrade could have issue compiling

Thanks, still no luck. There were two mysqlclient.lib files in the mysql-connector-c-6.1.11-winx64.msi install. One in vs12 and the other in vs14. I tried both with cmake finishing without error but make install giving the same error building main_lpcc.cc.obj.

I see some posts suggesting that mysql-connector needs to be built from source for the mingw64 environment. I tried to do so but have yet been unable to.

Like I mentioned before, the error doesn’t relate to mysql. If you see errors like this

C:/msys64/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/9.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: internal error …/…/binutils-2.34/ld/ldlang.c 7101
collect2.exe: error: ld returned 1 exit status

it means GCC is having trouble linking the final library. There could be myriad reasons, but mostly you should make sure to reinstall/update GCC first , check if you have enough memory available memory (usually you need at least 4G free memory)

You could also -DMARCH_NATIVE=OFF to get an generic binary instead if you want to copy it to run on another machine.

If nothing works, you actually don’t need lpcc to run things. just make sure you have driver binary in bin/ and you are good.

1 Like

Hey guys,

The solution being that under windows we just need to use
pacman -S mingw-w64-x86_64-libmariadbclient and the driver will automatically work.

I have tried all the suggestions above, without success. I would be happy if someone made an updated list of all the steps needed for Windows. Some expected result of important steps would also be nice.

Thanks.

Sorry to hear that you are having issues, can you tell me what exactly is the issue you are having?

BTW, for quicker response you can hop in https://gitter.im/fluffos/community?source=orgpage to chat as well.

I got confused since I didn’t fully understod when to do what (in what directory, etc). But I’m happy now since I found http://dead-souls.net. I have already started coding. Doing stuff I wanted to do +20 years ago. :wink:

Thanks for your support!

Is there a way to get github to compile fluffos? We have a pro github repository owner, so we have access to all of the github pro tools. No one knows how to set this stuff up though.

What we’d like is some way for github to compile fluffos, and push it to our servers when we get a new fluffos version. We need to compile fluffos ourselves since we have driver code included, but currently it takes our mud owner all day to manually compile everything, and he has to pay attention to it.

tl;dr Can we please have a github script or CI, or jenkins, or travis, or some sort of knowledge about how to automatically compile fluffos with our driver changes?

you can reuse the github action files https://github.com/fluffos/fluffos/tree/master/.github/workflows

by default these action files runs the testsuite on every changes, but if you want, you can modify these files in your own fork to retain the artifact being built.

1 Like