Closed Pospelove closed 3 years ago
CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:797 (_find_package):
Could not find a package configuration file provided by "directxtk" with
any of the following names:
directxtkConfig.cmake
directxtk-config.cmake
Add the installation prefix of "directxtk" to CMAKE_PREFIX_PATH or set
"directxtk_DIR" to a directory containing one of the above files. If
"directxtk" provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
skyrim-platform/src/platform_se/CMakeLists.txt:220 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/bogdasar/Documents/Programming/C++_Programming/skymp/build/CMakeFiles/CMakeOutput.log".
No, it shouldn't. Linux is not support DirectX.
@bogdasar1985 Thanks for the clarification! You are right. We only need the server to build on Linux, not the client with all Windows-specific stuff.
For now, try comment excess add_subdirectory
calls in CMakeLists.txt
like this:
#add_subdirectory(chakra-wrapper)
#add_subdirectory(skyrim-platform)
#add_subdirectory(skymp5-client)
#add_subdirectory(skymp5-front)
#add_subdirectory(skymp5-functions-lib)
#add_subdirectory(skymp5-scripts)
#add_subdirectory(client-deps)
add_subdirectory(skymp5-server)
@Pospelove I fixed some errors. Two of them related to the Chakra library and its wrapper.
Firstly, I am of course include directory with that lib:
In file skymp/skymp5-server/cpp/CMakeLists.txt
add include_directories("../../chakra-wrapper")
on server_guest_lib
build scenario.
Then I have an errors:
The first was associated with an invalid typedef
:
In file included from /home/bogdasar/Documents/Programming/C++_Programming/skymp/skymp5-server/cpp/../../chakra-wrapper/JsEngine.h:3,
from /home/bogdasar/Documents/Programming/C++_Programming/skymp/skymp5-server/cpp/server_guest_lib/DynamicFields.cpp:2:
/home/bogdasar/Documents/Programming/C++_Programming/skymp/build/vcpkg_installed/x64-linux/include/ChakraCore.h:1969:21: error: expected ‘)’ before ‘*’ token
1969 | typedef void(__cdecl *ArrayBufferFreeFn)(void*);
| ~ ^~
| )
/home/bogdasar/Documents/Programming/C++_Programming/skymp/build/vcpkg_installed/x64-linux/include/ChakraCore.h:1983:11: error: ‘ArrayBufferFreeFn’ has not been declared
1983 | _Out_ ArrayBufferFreeFn* freeFn);
I fixed them by remove explicit calling convention as __cdecl
, inside library file ChakraCore.h
whats mean, if I remove build
dir with vcpkg cache and downloaded libraries, I will wanna do it again.
I also fixed some simple errors, in particular just typos. But there are one mistake, which I can't fix:
In file included from /home/bogdasar/Documents/Programming/C++_Programming/skymp/skymp5-server/cpp/server_guest_lib/DynamicFields.cpp:2:
/home/bogdasar/Documents/Programming/C++_Programming/skymp/skymp5-server/cpp/../../chakra-wrapper/JsEngine.h: In member function ‘JsValue::operator std::wstring() const’:
/home/bogdasar/Documents/Programming/C++_Programming/skymp/skymp5-server/cpp/../../chakra-wrapper/JsEngine.h:267:26: error: ‘JsStringToPointer’ was not declared in this scope
267 | SafeCall(JS_ENGINE_F(JsStringToPointer), value, &stringPtr, &stringSize);
| ^~~~~~~~~~~~~~~~~
/home/bogdasar/Documents/Programming/C++_Programming/skymp/skymp5-server/cpp/../../chakra-wrapper/JsEngine.h:11:27: note: in definition of macro ‘JS_ENGINE_F’
11 | #define JS_ENGINE_F(func) func, #func
| ^~~~
make[2]: *** [skymp5-server/cpp/CMakeFiles/server_guest_lib.dir/build.make:132: skymp5-server/cpp/CMakeFiles/server_guest_lib.dir/server_guest_lib/DynamicFields.cpp.o] Ошибка 1
make[1]: *** [CMakeFiles/Makefile2:299: skymp5-server/cpp/CMakeFiles/server_guest_lib.dir/all] Ошибка 2
make: *** [Makefile:101: all] Ошибка 2
Chackra can't find function JsStringToPointer
. I looked in the documentation and found out that Chakra has 4 main header files. And the one in which the JsStringToPointer
function is declared, namely ChakraCommonWindows.h
, is apparently not available on Linux, which is clear from the file name.
Also if I try to find Chakra files in directory I found olny that:
bogdasar@bogdasar-Aspire-V3-571G:~/Documents/Programming/C++_Programming/skymp/build$ find .. -name 'Chakra*'
../vcpkg/packages/chakracore_x64-linux/include/ChakraCore.h
../vcpkg/packages/chakracore_x64-linux/include/ChakraCommon.h
../vcpkg/packages/chakracore_x64-linux/include/ChakraDebug.h
../build/vcpkg_installed/x64-linux/include/ChakraCore.h
../build/vcpkg_installed/x64-linux/include/ChakraCommon.h
../build/vcpkg_installed/x64-linux/include/ChakraDebug.h
Which means that vcpkg does not download ChakraCommonWindows.h
because of platform.
If my assumptions are correct, then I think that we will have to change JsEngine.h
or/and setup Chakra manually and change it according to the needs of our project.
So, I hope I have not forgotten anything and I have presented the results of the work correctly.
@Pospelove So, should I commit my fixes even though the project is not going to be build?
@bogdasar1985 Thanks for looking into it. I think you should submit a pull request even if the project is still unbuildable. So we would be able to see what we can do then.
@Pospelove Pull request: https://github.com/skyrim-multiplayer/skymp/pull/102
The problem with __cdelc
is here, explicit calling convention should be removed :
https://github.com/chakra-core/ChakraCore/blob/e264cb81cb6e04c34725fc8de206b599b91d2bbf/lib/Jsrt/ChakraCore.h#L1969
Decide whether to make a Pull Request and wait until it is updated library in vcpkg
or make your own custom version of the library.
Also the problem with JsStringToPointer
persists.
@Pospelove I fix one simple warning https://github.com/skyrim-multiplayer/skymp/pull/102/commits/dff0a9932013ab93947ec2c264e2e154c7b18afa
But there is also this:
/home/bogdasar/Documents/Programming/C++_Programming/skymp/skymp5-server/cpp/papyrus_vm_lib/ActivePexInstance.cpp: In function ‘VarValue CastToString(const VarValue&)’:
/home/bogdasar/Documents/Programming/C++_Programming/skymp/skymp5-server/cpp/papyrus_vm_lib/ActivePexInstance.cpp:153:41: warning: ‘%.*g’ directive output may be truncated writing between 1 and 310 bytes into a region of size 128 [-Wformat-truncation=]
153 | snprintf(buffer, sizeof(buffer), "%.*g", 9000, static_cast<double>(var));
| ^~~~
/home/bogdasar/Documents/Programming/C++_Programming/skymp/skymp5-server/cpp/papyrus_vm_lib/ActivePexInstance.cpp:153:40: note: assuming directive output of 309 bytes
153 | snprintf(buffer, sizeof(buffer), "%.*g", 9000, static_cast<double>(var));
| ^~~~~~
/home/bogdasar/Documents/Programming/C++_Programming/skymp/skymp5-server/cpp/papyrus_vm_lib/ActivePexInstance.cpp:153:15: note: ‘snprintf’ output between 2 and 311 bytes into a destination of size 128
153 | snprintf(buffer, sizeof(buffer), "%.*g", 9000, static_cast<double>(var));
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@bogdasar1985 Cool. Would be nice to fix these sprintf
warnings without functionality changes. Btw, this behavior is covered by unit tests as I can remember.
@Pospelove Fixed (https://github.com/skyrim-multiplayer/skymp/pull/102/commits/66bfb8893aeea6e6301d4938a029579723cbabed). I just increased the local buffer from 128 to 512 bytes.
@Pospelove What are you going to do with this JS library?
@bogdasar1985 Currently, on the server, it's used for scripting. For now, there are no plans to use it for other purposes.
@Pospelove I mean the problems of building on Linux, because of this library. That https://github.com/skyrim-multiplayer/skymp/issues/95#issuecomment-886162836 and their windows-specific(as I understand) function JsStringToPointer
.
@bogdasar1985 We could use this https://github.com/chakra-core/ChakraCore/wiki/JsCopyString
@Pospelove commit changes (make
got 95% compile!) and have next errors connected with espm
library and maybe that issue https://github.com/skyrim-multiplayer/skymp/issues/100
[ 95%] Building CXX object skymp5-server/CMakeFiles/skymp5-server.dir/cpp/addon/main.cc.o
/home/bogdasar/Documents/Programming/C++_Programming/skymp/skymp5-server/cpp/addon/main.cc: In constructor ‘ScampServer::ScampServer(const Napi::CallbackInfo&)’:
/home/bogdasar/Documents/Programming/C++_Programming/skymp/skymp5-server/cpp/addon/main.cc:361:45: error: no matching function for call to ‘espm::Loader::Loader(std::vector<std::filesystem::__cxx11::path>&)’
361 | auto espm = new espm::Loader(pluginPaths);
| ^
In file included from /home/bogdasar/Documents/Programming/C++_Programming/skymp/skymp5-server/cpp/server_guest_lib/MpObjectReference.h:9,
from /home/bogdasar/Documents/Programming/C++_Programming/skymp/skymp5-server/cpp/server_guest_lib/MpActor.h:3,
from /home/bogdasar/Documents/Programming/C++_Programming/skymp/skymp5-server/cpp/server_guest_lib/PartOne.h:4,
from /home/bogdasar/Documents/Programming/C++_Programming/skymp/skymp5-server/cpp/addon/main.cc:12:
/home/bogdasar/Documents/Programming/C++_Programming/skymp/skymp5-server/cpp/lib_espm/Loader.h:41:3: note: candidate: ‘espm::Loader::Loader(const std::vector<std::experimental::filesystem::v1::__cxx11::path>&, espm::Loader::OnProgress)’
41 | Loader(const std::vector<fs::path>& filePaths_,
| ^~~~~~
/home/bogdasar/Documents/Programming/C++_Programming/skymp/skymp5-server/cpp/lib_espm/Loader.h:41:39: note: no known conversion for argument 1 from ‘std::vector<std::filesystem::__cxx11::path>’ to ‘const std::vector<std::experimental::filesystem::v1::__cxx11::path>&’
41 | Loader(const std::vector<fs::path>& filePaths_,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
/home/bogdasar/Documents/Programming/C++_Programming/skymp/skymp5-server/cpp/lib_espm/Loader.h:35:3: note: candidate: ‘espm::Loader::Loader(const std::experimental::filesystem::v1::__cxx11::path&, const std::vector<std::experimental::filesystem::v1::__cxx11::path>&, espm::Loader::OnProgress)’
35 | Loader(const fs::path& dataDir, const std::vector<fs::path>& fileNames,
| ^~~~~~
/home/bogdasar/Documents/Programming/C++_Programming/skymp/skymp5-server/cpp/lib_espm/Loader.h:35:3: note: candidate expects 3 arguments, 1 provided
/home/bogdasar/Documents/Programming/C++_Programming/skymp/skymp5-server/cpp/lib_espm/Loader.h:22:7: note: candidate: ‘espm::Loader::Loader(espm::Loader&&)’
22 | class Loader
| ^~~~~~
/home/bogdasar/Documents/Programming/C++_Programming/skymp/skymp5-server/cpp/lib_espm/Loader.h:22:7: note: no known conversion for argument 1 from ‘std::vector<std::filesystem::__cxx11::path>’ to ‘espm::Loader&&’
make[2]: *** [skymp5-server/CMakeFiles/skymp5-server.dir/build.make:76: skymp5-server/CMakeFiles/skymp5-server.dir/cpp/addon/main.cc.o] Ошибка 1
make[1]: *** [CMakeFiles/Makefile2:162: skymp5-server/CMakeFiles/skymp5-server.dir/all] Ошибка 2
Didn't go into details, but apparently the problem is the incompatibility of std::filesystem
and std::experimantal::filesystem
.
@bogdasar1985 I guess we can remove #if WIN32
there, and use non-experimental fs
I removed in my pr
The server should be buildable on Linux without that flag. Remove this line and try to build on Linux, fix all build errors. https://github.com/skyrim-multiplayer/skymp/blob/main/CMakeLists.txt#L42