• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Compiling Compiling error tfs 1.4.2 FMT and STD

XiolenceOT

New Member
Joined
Jun 5, 2023
Messages
42
Reaction score
4
Trying to compile the server but I'm getting these issues, followed a tutorial for the same version but it's just not working, 2 errors, 160 messages and 50 warnings.

Code:
 Severity	Code	Description	Project	File	Line	Suppression State
Error	C2338	static_assert failed: 'Cannot format an argument. To make type T formattable provide a formatter<T> specialization: https://fmt.dev/latest/api.html#udt' (compiling source file ..\src\iomarket.cpp)	theforgottenserver	D:\vcpkg\installed\x64-windows\include\fmt\core.h	1691	
Severity	Code	Description	Project	File	Line	Suppression State
Error	C2338	static_assert failed: 'Cannot format an argument. To make type T formattable provide a formatter<T> specialization: https://fmt.dev/latest/api.html#udt' (compiling source file ..\src\iomapserialize.cpp)	theforgottenserver	D:\vcpkg\installed\x64-windows\include\fmt\core.h	1691
Severity	Code	Description	Project	File	Line	Suppression State
Message		see declaration of 'std::runtime_error' (compiling source file ..\src\iomarket.cpp)	theforgottenserver	C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\stdexcept	101	
Severity	Code	Description	Project	File	Line	Suppression State
Message		see declaration of 'fmt::v10::format_error' (compiling source file ..\src\iomarket.cpp)	theforgottenserver	D:\vcpkg\installed\x64-windows\include\fmt\format.h	1055
 
Check this out:

It's due to change in FMT 10.x
Removed deprecated implicit conversions for enums and conversions to primitive types for compatibility with std::format and to prevent potential ODR violations. Use format_as instead.
 
Check this out:

It's due to change in FMT 10.x


Is the VCPKG.JSON file I'm editing supposed to be in workflows? I'm not seeing it or is it in vcpkg?
 
use vcpkg manifest and downgrade FMT version, that resolve 95% of problems with compiling raw tfs version
 
use vcpkg manifest and downgrade FMT version, that resolve 95% of problems with compiling raw tfs version
This also makes them use double the storage space if they have already used vcpkg to install the dependencies, as it now downloads them all directly to tfs project folder... which is a waste of time and storage, and is a crap fix IMO. (we should be moving forward with our dependencies, not halting them at a version that is outdated)

I highly suggest taking the 1 minute it takes to make those edits, and then recompiling. Then there will be 100% of the errors gone.
 
This also makes them use double the storage space if they have already used vcpkg to install the dependencies, as it now downloads them all directly to tfs project folder... which is a waste of time and storage, and is a crap fix IMO. (we should be moving forward with our dependencies, not halting them at a version that is outdated)

I highly suggest taking the 1 minute it takes to make those edits, and then recompiling. Then there will be 100% of the errors gone.
Yeah, didn't work...
Trying to compile TFS 1.4.2, had to downgrade Boost, did it by manually linking with 1.79 version then boost errors gone.
Now this fmt problem, edited everything like says in the commit 61452aa, cleaned project, deleted cached files, opened visual studio again and ->
C#:
The constexpr function 'tfs::to_underlying' cannot result in a constant expression
a parameter cannot have a type that contains 'auto'
'=' binary : no operator found that receives a right-hand side operand of type 'int64_t' (or there is no acceptable conversion)
'=' binary : no operator found that receives a right-hand side operand of type 'double' (or there is no acceptable conversion)
'fmt::v11::format': no corresponding overloaded function found
 
Yeah, didn't work...
Trying to compile TFS 1.4.2, had to downgrade Boost, did it by manually linking with 1.79 version then boost errors gone.
Now this fmt problem, edited everything like says in the commit 61452aa, cleaned project, deleted cached files, opened visual studio again and ->
C#:
The constexpr function 'tfs::to_underlying' cannot result in a constant expression
a parameter cannot have a type that contains 'auto'
'=' binary : no operator found that receives a right-hand side operand of type 'int64_t' (or there is no acceptable conversion)
'=' binary : no operator found that receives a right-hand side operand of type 'double' (or there is no acceptable conversion)
'fmt::v11::format': no corresponding overloaded function found
You got it to link sure, because it's still locked into OLD DEPENDENCIES and so you linked using OLD DEPENDENCIES exactly like I said... If you remove that lock (by removing/updating the baseline) and do like I said, it will also link, and those 1k boost errors would be gone.


The error you are getting says it's problem. It tells you that to_underlying cannot be the results of a constant expression. It's basically telling you what to remove from which function within the first 4 words... constexpr from tfs::to_underlying

there you go... that's all you should have to do.. good job on making it this far, this last part should get you the rest the way... there are other examples of how to rewrite this specific method if removing the constexpr removed leaves you with another error... I believe the C++language you are targetting matters... in fact as I'm righting this, I'm pretty sure most of use the constexpr without a problem and so it's likely you still have your version targetting C++17 and this fix requires switching to C++20, that's the most appropriate fix I do believe...
 
Trying to compile TFS 1.4.2
If you want to use TFS 1.4.2 with some bug fixes from TFS 1.6+ and compilation like TFS 1.6 (vcpkg manifest etc.), you can use my branch 'compilation':
Compilation instruction is like:
but you can skip step 4, as my VS project uses vcpkg manifest and it will install all libraries, when you run complation for first time.
 
@Gesior.pl
@Codinablack

Actually, I managed to install Boost and FMT in an older version separated from vcpkg... I saw that to use older version with vcpkg should use a .json file but it feels like more a workaround...

Anyway, I download Boost 1.79 and FMT 9.1 in individual folders and linked them libraries to Visual Studio and the errors were kinda gone.
Now I got this error
Code:
could not open input file 'libboost_atomic-vc142-mt-s-x64-1_79.lib'

I asked chatGPT and it told me to correctly link the libraries into C/C++ General, External Dependencies, and also at Vinculator and so I did, but without success.

I didn't try your branch yet. Will it keep 10.98 Tibia protocol if I use it?
Besides, is possible to help me out with what else can I do to compile it without having to try your branch yet? Should I change something at cmakelist?
 
I saw that to use older version with vcpkg should use a .json file but it feels like more a workaround...
Problem with using old versions of vcpkg C++ packages is that, they are sometimes removed from servers from which vcpkg tries to download them.
So you need vcpkg.json to specify that you want to use old version (or use 'git checkout XXXX.XX' in vcpkg folder), but you may get errors during vcpkg packages installation, if you pick too old version ex. from 2020.

My branch has C++ code of TFS updated, to make it work with newer versions of C++ libraries without errors:

It uses vcpkg commit 215a2535590f1f63788ac9bd2ed58ad15e6afdff from Mar 2, 2024. Official TFS 1.4 expects vcpkg from 2022, which may no longer work.

Will it keep 10.98 Tibia protocol if I use it?
Yes. I keep my branch on 10.98.
If I will add some change that breaks compatibility with clean 1.4.2 datapack, note will be added in 'doc' folder.

Besides, is possible to help me out with what else can I do to compile it without having to try your branch yet? Should I change something at cmakelist?
IDK. I spent feeew hours to update my branch to work with newer versions of C++ libraries. I didn't try to force it to work with old libraries that are hard to install.

cmake in TFS is configured for Linux by default (use system C++ libraries, not vcpkg).
Everyone - except some experienced C++ users - on Windows use Visual Studio project with vcpkg to compile TFS.
In new version of TFS with CMakePresets.json, you can switch cmake config to vcpkg and compile on Windows. My branch has this file and rest of cmake config, to make it work:
I compile on Windows using cmake project in CLion IDE:
I prefere this IDE to edit C++ code, but compilation in Visual Studio is faster, because it configures valid number of 'units' for unity build for my CPU and cmake always uses ~10 cores on Windows.
 
Problem with using old versions of vcpkg C++ packages is that, they are sometimes removed from servers from which vcpkg tries to download them.
So you need vcpkg.json to specify that you want to use old version (or use 'git checkout XXXX.XX' in vcpkg folder), but you may get errors during vcpkg packages installation, if you pick too old version ex. from 2020.

My branch has C++ code of TFS updated, to make it work with newer versions of C++ libraries without errors:

It uses vcpkg commit 215a2535590f1f63788ac9bd2ed58ad15e6afdff from Mar 2, 2024. Official TFS 1.4 expects vcpkg from 2022, which may no longer work.


Yes. I keep my branch on 10.98.
If I will add some change that breaks compatibility with clean 1.4.2 datapack, note will be added in 'doc' folder.


IDK. I spent feeew hours to update my branch to work with newer versions of C++ libraries. I didn't try to force it to work with old libraries that are hard to install.

cmake in TFS is configured for Linux by default (use system C++ libraries, not vcpkg).
Everyone - except some experienced C++ users - on Windows use Visual Studio project with vcpkg to compile TFS.
In new version of TFS with CMakePresets.json, you can switch cmake config to vcpkg and compile on Windows. My branch has this file and rest of cmake config, to make it work:
I compile on Windows using cmake project in CLion IDE:
I prefere this IDE to edit C++ code, but compilation in Visual Studio is faster, because it configures valid number of 'units' for unity build for my CPU and cmake always uses ~10 cores on Windows.

It worked flawlessly, thank you very much


Just to understand better: so basically you updated all the functions/methods in each part of the code needed to work with the latest versions of vcpkg libraries like boost and fmt?
 
It worked flawlessly, thank you very much


Just to understand better: so basically you updated all the functions/methods in each part of the code needed to work with the latest versions of vcpkg libraries like boost and fmt?
Mark it as best answer to prevent the same question appearing again.
 
Back
Top