Author Topic: Problem in Compile  (Read 7621 times)

Offline Marselleza

  • Squaddie
  • *
  • Posts: 6
    • View Profile
Problem in Compile
« on: April 09, 2020, 11:53:51 am »
How to compile a project an error comes out
There is a file in the directory

CMake Error at cmake/modules/FindSDL2.cmake:187 (file):
  file failed to open for reading (No such file or directory) :'( :-\ :-[

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8595
    • View Profile
Re: Problem in Compile
« Reply #1 on: April 09, 2020, 12:17:52 pm »
OXC or OXCE?
Which version/commitID?
Which platform?
Which compiler?
« Last Edit: April 09, 2020, 12:23:50 pm by Meridian »

Offline Marselleza

  • Squaddie
  • *
  • Posts: 6
    • View Profile
Re: Problem in Compile
« Reply #2 on: April 09, 2020, 12:48:19 pm »
OXC 430bf7cf47193ed8f104466562b105c14a05355e
Latest version
win7 64
build 32x
mingw32
 :-\

Offline Yankes

  • Commander
  • *****
  • Posts: 3192
    • View Profile
Re: Problem in Compile
« Reply #3 on: April 09, 2020, 02:08:29 pm »
if you try cmake and it do not work there is option for Makefile, you should have one like https://github.com/Yankes/OpenXcom/blob/OpenXcomExtended/src/Makefile.mingw
If not copy this I posted there, only thing that need be updated is:
Code: [Select]
SRCS_SDL = /C/MinGW/include/SDL/
SRCS_BOOST = ../../lib/boost/
SRCS_YAML = ../../lib/yaml-cpp/
To mach you machine configure.

Offline Marselleza

  • Squaddie
  • *
  • Posts: 6
    • View Profile
Re: Problem in Compile
« Reply #4 on: April 09, 2020, 03:16:39 pm »
fatal error  Cannot open include file: 'yaml-cpp/parser.h': No such file or directory

What should be here?
"SRCS_BOOST = ../../lib/boost/"
Where to look for this resource?
It would be very interesting to look at the step-by-step manual on how to compile open x-com :'(
« Last Edit: April 09, 2020, 03:19:06 pm by Marselleza »

Offline Yankes

  • Commander
  • *****
  • Posts: 3192
    • View Profile
Re: Problem in Compile
« Reply #5 on: April 09, 2020, 04:51:10 pm »
To compile OXC you need some external libs, like yaml-cpp, SDL, and if you compile old version of yaml-cpp you need some boost libs.

If you can use C++11 then you can drop all refereces to boost as yaml-cpp use only c++ stl code and nothing else.

What version of GCC you use?

for step-by-step will be bit hard for me because I manged to setup my toolchain years ago and do not touch it sins.

One case where I write down steps was mxe config: https://github.com/Yankes/OpenXcom/blob/OpenXcomExtended/src/Makefile.mxe
But this is mingw under linux not windows.

Offline Marselleza

  • Squaddie
  • *
  • Posts: 6
    • View Profile
Re: Problem in Compile
« Reply #6 on: April 09, 2020, 05:17:50 pm »
version <MinGW.org GCC-8.2.0-3>8.2.0
If standard 11 is used then boost is not needed?
I just don’t understand yet what SRCS_BOOST = ../../lib/boost/"

"fatal error  Cannot open include file: 'yaml-cpp/parser.h': No such file or directory"
This error appears due to the declaration <yaml-cpp / parser.h>; if you change it to "parser.h", the error disappears but there are too many such announcements to change them all. Where yaml should be located so that there is no error, I do not understand.


Gradually maybe I’ll figure it out until I can compile
« Last Edit: April 09, 2020, 05:24:50 pm by Marselleza »

Offline Yankes

  • Commander
  • *****
  • Posts: 3192
    • View Profile
Re: Problem in Compile
« Reply #7 on: April 09, 2020, 05:35:50 pm »
To compile old yaml-cpp it need some boost libs to work, if you set C++11 then you can use new version of yaml-cpp that drop dependency to boost, and compile without it. Src for new yaml-cpp can be get at https://github.com/jbeder/yaml-cpp/
Another approach is find precompiled version of yaml-cpp that do not need boos as it only implementation detail.
Code: [Select]
SRCS_BOOST = ../../lib/boost/"
this was directory where you should have put all needed boost libs (if you need it). As this makefile go route of compiling yaml-cpp yourself and it was old version that need boost

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2159
    • View Profile
Re: Problem in Compile
« Reply #8 on: April 10, 2020, 10:16:22 pm »

Offline Constantine

  • Sergeant
  • **
  • Posts: 30
    • View Profile
Re: Problem in Compile
« Reply #9 on: May 02, 2020, 04:45:27 pm »
I've got just the same problem as Marselleza did: I try to build OXC commit 3d092c227fbd4d4ef0a7a58ff31dcca399b693ef on

Windows 7 x64
MinGW 9.2.0 (x86)
CMake 3.17.2


Using instructions at https://www.ufopaedia.org/index.php/Compiling_with_MinGW_(OpenXcom) I downloaded

SDL_gfx-2.0.26
SDL_image-1.2.12
SDL_mixer-1.2.12
SDL-1.2.15
yaml-cpp-0.6.3


and successfully compiled SDL_gfx.dll & libyaml-cpp.a not using boost.

But running cmake produces the same error as Marselleza's one:

Code: [Select]
d:\Constantine\Code\OpenXcom\OpenXcom-master>cmake -G "MinGW Makefiles" .
-- The C compiler identification is GNU 9.2.0
-- The CXX compiler identification is GNU 9.2.0
-- Check for working C compiler: D:/Constantine/Programs/MinGW/bin/gcc.exe
-- Check for working C compiler: D:/Constantine/Programs/MinGW/bin/gcc.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: D:/Constantine/Programs/MinGW/bin/g++.exe
-- Check for working CXX compiler: D:/Constantine/Programs/MinGW/bin/g++.exe - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
CMake Error at cmake/modules/FindSDL2.cmake:187 (file):
  file failed to open for reading (No such file or directory):

    D:/Constantine/Code/OpenXcom/OpenXcom-master/SDL_INCLUDE_DIR-NOTFOUND/SDL_version.h
Call Stack (most recent call first):
  cmake/modules/FindSDL2.cmake:278 (find_sdl_version)
  CMakeLists.txt:64 (find_package)

-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
CMake Error at CMakeLists.txt:69 (message):
  Can't find SDL which is required

I tried Yankes makefile. It didn't worked out also. I think it is irrelevant here: it is intended for OXCE (not for OXC) and there are even no links to SDL_mixer, SDL_image etc.
   
Ok, I took makefile from the guide, set up my libs versions, removed AppDep call, because 'make depends' worked fine. But 'make all' compiled a lot of sources and then failed:

Code: [Select]
D:/Constantine/Programs/MinGW/bin/g++ -DWINVER=0x0400 -I..\SDL-1.2.15\include\SD
L -I..\SDL_mixer-1.2.12 -I..\SDL_image-1.2.12 -I..\SDL_gfx-2.0.26 -I..\yaml-cpp-
0.6.3\include -Wall -Wextra -Wno-unused-function -O2 -o src/Engine/CrossPlatform
.o -c src/Engine/CrossPlatform.cpp src/Engine/CrossPlatform.cpp:44:10: fatal err
or: dbghelp.h: No such file or directory
   44 | #include <dbghelp.h>
      |          ^~~~~~~~~~~
compilation terminated.
Makefile:41: recipe for target 'src/Engine/CrossPlatform.o' failed
make: *** [src/Engine/CrossPlatform.o] Error 1

I cannot find that header in OXC, dependencies or MinGW directories. It can be found in MinGW-x64.

Ok, let's go to src/Engine/CrossPlatform.cpp:
Code: [Select]
43 #ifndef __NO_DBGHELP
44 #include <dbghelp.h>
45 #endif

I added -D__NO_DBGHELP to CXXFLAGS and get new error on the same file:

Code: [Select]
d:\Constantine\Code\OpenXcom\OpenXcom-master>make all
D:/Constantine/Programs/MinGW/bin/g++ -DWINVER=0x0400 -I..\SDL-1.2.15\include\SD
L -I..\SDL_mixer-1.2.12 -I..\SDL_image-1.2.12 -I..\SDL_gfx-2.0.26 -I..\yaml-cpp-
0.6.3\include -Wall -Wextra -Wno-unused-function -O2 -D__NO_DBGHELP -o src/Engin
e/Sound.o -c src/Engine/Sound.cpp
D:/Constantine/Programs/MinGW/bin/g++ -DWINVER=0x0400 -I..\SDL-1.2.15\include\SD
L -I..\SDL_mixer-1.2.12 -I..\SDL_image-1.2.12 -I..\SDL_gfx-2.0.26 -I..\yaml-cpp-
0.6.3\include -Wall -Wextra -Wno-unused-function -O2 -D__NO_DBGHELP -o src/Engin
e/CrossPlatform.o -c src/Engine/CrossPlatform.cpp
src/Engine/CrossPlatform.cpp: In function 'std::string OpenXcom::CrossPlatform::
now()':
src/Engine/CrossPlatform.cpp:1095:21: error: 'LOCALE_INVARIANT' was not declared
 in this scope; did you mean 'LANG_INVARIANT'?
 1095 |  if (GetDateFormatA(LOCALE_INVARIANT, 0, 0, "dd'-'MM'-'yyyy", date, MAX_
LEN) == 0)
      |                     ^~~~~~~~~~~~~~~~
      |                     LANG_INVARIANT
src/Engine/CrossPlatform.cpp:1097:21: error: 'LOCALE_INVARIANT' was not declared
 in this scope; did you mean 'LANG_INVARIANT'?
 1097 |  if (GetTimeFormatA(LOCALE_INVARIANT, TIME_FORCE24HOURFORMAT, 0, "HH'-'m
m'-'ss", time, MAX_LEN) == 0)
      |                     ^~~~~~~~~~~~~~~~
      |                     LANG_INVARIANT
Makefile:41: recipe for target 'src/Engine/CrossPlatform.o' failed
make: *** [src/Engine/CrossPlatform.o] Error 1



LOCALE_INVARIANT can be found in winnt.h again in MinGW-x64. winnt.h in MinGW doesn't have
LOCALE_INVARIANT macro.

How do you guys compile OpenXcom under x86? ))


P. S. I would highly appreciate if smb updated mentioned compiling manual. Its very old: 'Copy original game directories in <project>\OpenXcom-master\bin\data directory'. OG is supposed to be copied into TFTD and UFO directories for a long time.
« Last Edit: May 02, 2020, 05:10:00 pm by Constantine »

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2159
    • View Profile
Re: Problem in Compile
« Reply #10 on: May 20, 2020, 04:57:48 pm »
We just use Visual Studio. If you don't like it, I recommend MinGW-w64 (despite the name it does compile x86) with MSYS2, it's much easier to use and better supported: https://www.msys2.org/

Offline osd_daedalus

  • Sergeant
  • **
  • Posts: 31
    • View Profile
Re: Problem in Compile
« Reply #11 on: May 27, 2020, 09:04:58 pm »
Something changed in one of latest commits...

Code: [Select]
deda@neon:~/Coding/OpenXcom/build$ git pull
Already up to date.
deda@neon:~/Coding/OpenXcom/build$ make clean
deda@neon:~/Coding/OpenXcom/build$ cmake .
-- OpenGL libraries: /usr/lib/x86_64-linux-gnu/libGL.so;/usr/lib/x86_64-linux-gnu/libGLU.so
-- PKG_DEPS_LDFLAGS: -lSDL;-lz;-lSDL_image;-lSDL;-lSDL_gfx;-lSDL;-lSDL_mixer;-lSDL;-lyaml-cpp;/usr/lib/x86_64-linux-gnu/libGL.so;/usr/lib/x86_64-linux-gnu/libGLU.so;dl
-- doxygen: /usr/bin/doxygen
-- Configuring done
-- Generating done
-- Build files have been written to: /home/deda/Coding/OpenXcom/build
deda@neon:~/Coding/OpenXcom/build$ make
[  0%] Building C object src/CMakeFiles/openxcom.dir/__/libs/miniz/miniz.c.o
[  0%] Building CXX object src/CMakeFiles/openxcom.dir/lodepng.cpp.o
[  1%] Building CXX object src/CMakeFiles/openxcom.dir/main.cpp.o
[  1%] Building CXX object src/CMakeFiles/openxcom.dir/md5.cpp.o
[  1%] Building CXX object src/CMakeFiles/openxcom.dir/Basescape/BaseInfoState.cpp.o
In file included from /home/deda/Coding/OpenXcom/src/Basescape/BaseInfoState.cpp:24:0:
/home/deda/Coding/OpenXcom/src/Basescape/../Mod/Mod.h: In constructor ‘OpenXcom::LoadRuleException::LoadRuleException(const string&, const YAML::Node&, const string&)’:
/home/deda/Coding/OpenXcom/src/Basescape/../Mod/Mod.h:127:189: error: ‘const class YAML::Node’ has no member named ‘Mark’
 ode, const std::string& message) : Exception{ "Error for '" + parent + "': " + message + " at line " + std::to_string(node.Mark().line)}
                                                                                                                            ^~~~
/home/deda/Coding/OpenXcom/src/Basescape/../Mod/Mod.h:127:201: error: no matching function for call to ‘OpenXcom::Exception::Exception(<brace-enclosed initializer list>)’
 e, const std::string& message) : Exception{ "Error for '" + parent + "': " + message + " at line " + std::to_string(node.Mark().line)}
                                                                                                                                      ^
In file included from /home/deda/Coding/OpenXcom/src/Basescape/../Engine/../Savegame/../Engine/Script.h:31:0,
                 from /home/deda/Coding/OpenXcom/src/Basescape/../Engine/../Savegame/Soldier.h:24,
                 from /home/deda/Coding/OpenXcom/src/Basescape/../Engine/State.h:23,
                 from /home/deda/Coding/OpenXcom/src/Basescape/BaseInfoState.h:20,
                 from /home/deda/Coding/OpenXcom/src/Basescape/BaseInfoState.cpp:19:
/home/deda/Coding/OpenXcom/src/Basescape/../Engine/../Savegame/../Engine/Exception.h:33:2: note: candidate: OpenXcom::Exception::Exception(const string&)
  Exception(const std::string &msg);
  ^~~~~~~~~
/home/deda/Coding/OpenXcom/src/Basescape/../Engine/../Savegame/../Engine/Exception.h:33:2: note:   conversion of argument 1 would be ill-formed:
/home/deda/Coding/OpenXcom/src/Basescape/../Engine/../Savegame/../Engine/Exception.h:30:7: note: candidate: OpenXcom::Exception::Exception(const OpenXcom::Exception&)
 class Exception : public std::runtime_error
       ^~~~~~~~~
/home/deda/Coding/OpenXcom/src/Basescape/../Engine/../Savegame/../Engine/Exception.h:30:7: note:   conversion of argument 1 would be ill-formed:
/home/deda/Coding/OpenXcom/src/Basescape/../Engine/../Savegame/../Engine/Exception.h:30:7: note: candidate: OpenXcom::Exception::Exception(OpenXcom::Exception&&)
/home/deda/Coding/OpenXcom/src/Basescape/../Engine/../Savegame/../Engine/Exception.h:30:7: note:   conversion of argument 1 would be ill-formed:
src/CMakeFiles/openxcom.dir/build.make:158: recipe for target 'src/CMakeFiles/openxcom.dir/Basescape/BaseInfoState.cpp.o' failed
make[2]: *** [src/CMakeFiles/openxcom.dir/Basescape/BaseInfoState.cpp.o] Error 1
CMakeFiles/Makefile2:135: recipe for target 'src/CMakeFiles/openxcom.dir/all' failed
make[1]: *** [src/CMakeFiles/openxcom.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2


No clue on what could I do...  maybe do I have to install a new required library?

Offline Yankes

  • Commander
  • *****
  • Posts: 3192
    • View Profile
Re: Problem in Compile
« Reply #12 on: May 28, 2020, 12:04:43 pm »
Looking on yaml-cpp it have this function from yaml-cpp-0.5.3 onward, you probably have some older version

Offline osd_daedalus

  • Sergeant
  • **
  • Posts: 31
    • View Profile
Re: Problem in Compile
« Reply #13 on: May 31, 2020, 01:20:37 pm »
Looking on yaml-cpp it have this function from yaml-cpp-0.5.3 onward, you probably have some older version

That's why... KDE neon linux repositories are sitll distributing yaml-cpp 0.5.2. I just need to do some manual updates and I'm OK again  :)

Offline xracer

  • Commander
  • *****
  • Posts: 564
  • X-COM lover, we've gone at it everywhere
    • View Profile
Re: Problem in Compile
« Reply #14 on: August 28, 2020, 04:46:00 am »
Hello all,

sorry stupid question, been out of the game for a long time have a little branch that i wanted to work on, based on an old commit of OXC.
inin Win10 with VS2019 i retargeted the project got all dependencies, when trying to compile i get the error

Severity   Code   Description   Project   File   Line   Suppression State
Error   C1083   Cannot open include file: 'yaml-cpp/yaml.h': No such file or directory   OpenXcom   C:\Users\Xracer\source\repos\Xracer\OXCHD\src\pch.cpp   1   

I believed i did get yaml right, clearly i didn't.

Any help is greatly appreciated.