Giter VIP home page Giter VIP logo

Comments (16)

bogdasar1985 avatar bogdasar1985 commented on August 11, 2024 2

@Pospelove commit changes (make got 95% compile!) and have next errors connected with espm library and maybe that issue #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.

from skymp.

Pospelove avatar Pospelove commented on August 11, 2024 1

@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)

from skymp.

Pospelove avatar Pospelove commented on August 11, 2024 1

@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.

from skymp.

bogdasar1985 avatar bogdasar1985 commented on August 11, 2024 1

@Pospelove Fixed (66bfb88). I just increased the local buffer from 128 to 512 bytes.

from skymp.

bogdasar1985 avatar bogdasar1985 commented on August 11, 2024
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.

from skymp.

bogdasar1985 avatar bogdasar1985 commented on August 11, 2024

@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.

from skymp.

bogdasar1985 avatar bogdasar1985 commented on August 11, 2024

@Pospelove So, should I commit my fixes even though the project is not going to be build?

from skymp.

bogdasar1985 avatar bogdasar1985 commented on August 11, 2024

@Pospelove Pull request: #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.

from skymp.

bogdasar1985 avatar bogdasar1985 commented on August 11, 2024

@Pospelove I fix one simple warning dff0a99

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));
      |       ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

from skymp.

Pospelove avatar Pospelove commented on August 11, 2024

@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.

from skymp.

bogdasar1985 avatar bogdasar1985 commented on August 11, 2024

@Pospelove What are you going to do with this JS library?

from skymp.

Pospelove avatar Pospelove commented on August 11, 2024

@bogdasar1985 Currently, on the server, it's used for scripting. For now, there are no plans to use it for other purposes.

from skymp.

bogdasar1985 avatar bogdasar1985 commented on August 11, 2024

@Pospelove I mean the problems of building on Linux, because of this library. That #95 (comment) and their windows-specific(as I understand) function JsStringToPointer.

from skymp.

Pospelove avatar Pospelove commented on August 11, 2024

@bogdasar1985 We could use this https://github.com/chakra-core/ChakraCore/wiki/JsCopyString

from skymp.

nic11 avatar nic11 commented on August 11, 2024

@bogdasar1985 I guess we can remove #if WIN32 there, and use non-experimental fs

from skymp.

Pospelove avatar Pospelove commented on August 11, 2024

I removed in my pr

from skymp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.