PsyDoom icon indicating copy to clipboard operation
PsyDoom copied to clipboard

Linux compile errors with GCC

Open Apollyon094 opened this issue 4 years ago • 4 comments

These could be resolved with adding #include to: ./baselib/FatalErrors.cpp, ./simple_spu/Spu.cpp ./game/PcPsx/Config.cpp ./game/PcPsx/DiscReader.cpp ./game/PcPsx/PlayerPrefs.cpp ./game/PcPsx/PsxVm.cpp ./game/PsyQ/LIBGPU.cpp ./game/PsyQ/LIBSPU.cpp ./game/Wess/psxcd.cpp

Additional notes: GCC fails at ./game/PcPsx/Input.cpp line 803 with sqrtf. Replace it with sqrt and it works. I don't think cmath is supposed to do that. GCC fails at ./game/PcPsx/Input.cpp line 253 with powf. Replace it with pow and it works. I don't think cmath is supposed to do that. Pretty much everything in ./third_party_libs/ fails to build too. Any help?

Apollyon094 avatar Dec 17 '20 05:12 Apollyon094

Hi @Apollyon094 thanks for checking out the project. At the moment Linux is not a supported platform and I haven't done any work to port it to that OS - it is not surprising there are a lot of errors! You may see fragments of stuff relating to Linux in the cmake files but that is stuff I carried over from the PhoenixDoom project which will hopefully be useful later.

It's on my TODO list to add support for Linux in a future release so I can leave this ticket open until then.

BodbDearg avatar Dec 17 '20 06:12 BodbDearg

I gave it a go (before reading that ticket) and not much work was necessary to make it compile (it starts but I don't have doom.cue so I can't check if it works or not).

several files are missing cstring (for memset/memcpy/strlen) and a couple are missing cmath (like p_ceiling.cpp). a couple of CMake modifications: switched the embedded SDL for the system one and added -lpthread to ASIO.

minirop avatar Nov 10 '21 14:11 minirop

I've also been doing my own compiling with github actions. I've compiled with gcc and clang with some errors on both. I've also got the internal sdl2 to compile and I've also updated the SDL_config_linux.h to sdl 2.0.14.

Here's the link to the patch to get sdl2 to compile.

Sdl_cmakelists.patch

Not sure if I've got it all but, Here's the link to the patch to the new SDL_config_linux.h

sdl_config_linux.patch

gcc error:

2022-05-24T20:59:39.8947499Z /home/runner/work/PsyDoom-Linux/PsyDoom-Linux/PsyDoom/game/Doom/RendererVk/rv_main.cpp:109:22: error: ‘cosf’ is not a member of ‘std’; did you mean ‘cosh’?
2022-05-24T20:59:39.8964268Z   109 |     gViewCosf = std::cosf(gViewAnglef);
2022-05-24T20:59:39.8965422Z       |                      ^~~~
2022-05-24T20:59:39.8965663Z       |                      cosh
2022-05-24T20:59:39.8966497Z /home/runner/work/PsyDoom-Linux/PsyDoom-Linux/PsyDoom/game/Doom/RendererVk/rv_main.cpp:110:22: error: ‘sinf’ is not a member of ‘std’; did you mean ‘isinf’?
2022-05-24T20:59:39.8967469Z   110 |     gViewSinf = std::sinf(gViewAnglef);
2022-05-24T20:59:39.8967752Z       |                      ^~~~
2022-05-24T20:59:39.8967994Z       |                      isinf

clang error:

2022-05-24T17:36:54.6956221Z /home/runner/work/PsyDoom-Linux/PsyDoom-Linux/PsyDoom/game/./Doom/Game/p_weak.h:36:5: error: 'inline' can only appear on functions and non-local variables
2022-05-24T17:36:54.6958534Z     inline MobjWeakPtr(nullptr_t) noexcept : weakCountIdx(NULL_WEAK_COUNT_IDX) {}
2022-05-24T17:36:54.6959099Z     ^
2022-05-24T17:36:54.6959960Z /home/runner/work/PsyDoom-Linux/PsyDoom-Linux/PsyDoom/game/./Doom/Game/p_weak.h:36:24: error: field has incomplete type 'MobjWeakPtr'
2022-05-24T17:36:54.6960610Z     inline MobjWeakPtr(nullptr_t) noexcept : weakCountIdx(NULL_WEAK_COUNT_IDX) {}
2022-05-24T17:36:54.6961014Z                        ^
2022-05-24T17:36:54.6961790Z /home/runner/work/PsyDoom-Linux/PsyDoom-Linux/PsyDoom/game/./Doom/Game/p_weak.h:29:7: note: definition of 'MobjWeakPtr' is not complete until the closing '}'
2022-05-24T17:36:54.6962777Z class MobjWeakPtr {
2022-05-24T17:36:54.6963058Z       ^
2022-05-24T17:36:54.6963715Z /home/runner/work/PsyDoom-Linux/PsyDoom-Linux/PsyDoom/game/./Doom/Game/p_weak.h:36:34: error: expected ';' at end of declaration list
2022-05-24T17:36:54.6964307Z     inline MobjWeakPtr(nullptr_t) noexcept : weakCountIdx(NULL_WEAK_COUNT_IDX) {}
2022-05-24T17:36:54.6964691Z                                  ^
2022-05-24T17:36:54.6964973Z                                  ;
2022-05-24T17:36:54.6966705Z /home/runner/work/PsyDoom-Linux/PsyDoom-Linux/PsyDoom/game/./Doom/Game/p_weak.h:35:37: error: member initializer 'weakCountIdx' does not name a non-static data member or base class
2022-05-24T17:36:54.6967716Z     inline MobjWeakPtr() noexcept : weakCountIdx(NULL_WEAK_COUNT_IDX) {}
2022-05-24T17:36:54.6968173Z                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

7dog123 avatar May 24 '22 22:05 7dog123

Linux support will be coming soon in the next release. If you wait until then all these issues will be gone 😀

BodbDearg avatar May 25 '22 05:05 BodbDearg

Linux support is now added as of 1.0.0. Closing ticket.

BodbDearg avatar Oct 01 '22 06:10 BodbDearg