dougmencken / HeadOverHeels

The free and open source remake of the game “Head over Heels”
GNU General Public License v3.0
33 stars 10 forks source link

Building & running master on GNU/Linux #18

Closed rastersoft closed 6 years ago

rastersoft commented 6 years ago

When I try to compile the code in my Debian Linux with the "cygwin-build.sh" script, I receive these errors:

Mediator.cpp: In member function ‘void isomot::Mediator::update()’:
Mediator.cpp:134:59: error: ‘class isomot::FreeItem’ has no member named ‘setWhichMask’
                         dynamic_cast< FreeItem * >( *f )->setWhichMask( WantMask );
                                                           ^~~~~~~~~~~~
Mediator.cpp:134:73: error: ‘WantMask’ was not declared in this scope
                         dynamic_cast< FreeItem * >( *f )->setWhichMask( WantMask );
                                                                         ^~~~~~~~
Mediator.cpp: In member function ‘void isomot::Mediator::remaskFreeItem(isomot::FreeItem*)’:
Mediator.cpp:226:47: error: ‘class isomot::FreeItem’ has no member named ‘setWhichMask’
                                 thatFreeItem->setWhichMask( WantMask );
                                               ^~~~~~~~~~~~
Mediator.cpp:226:61: error: ‘WantMask’ was not declared in this scope
                                 thatFreeItem->setWhichMask( WantMask );
                                                             ^~~~~~~~
Mediator.cpp: In member function ‘void isomot::Mediator::remaskGridItem(isomot::GridItem*)’:
Mediator.cpp:254:51: error: ‘class isomot::FreeItem’ has no member named ‘setWhichMask’
                                         freeItem->setWhichMask( WantMask );
                                                   ^~~~~~~~~~~~
Mediator.cpp:254:65: error: ‘WantMask’ was not declared in this scope
                                         freeItem->setWhichMask( WantMask );
                                                                 ^~~~~~~~
Mediator.cpp: In member function ‘void isomot::Mediator::reshadeGridItem(isomot::GridItem*)’:
Mediator.cpp:276:35: error: ‘class isomot::GridItem’ has no member named ‘setWhichShade’
                         gridItem->setWhichShade( WantShadow );
                                   ^~~~~~~~~~~~~
Mediator.cpp:276:50: error: ‘WantShadow’ was not declared in this scope
                         gridItem->setWhichShade( WantShadow );
                                                  ^~~~~~~~~~
Mediator.cpp:284:40: error: ‘class isomot::FloorTile’ has no member named ‘setWhichShade’
                 room->floor[ column ]->setWhichShade( WantShadow );
                                        ^~~~~~~~~~~~~
Mediator.cpp:284:55: error: ‘WantShadow’ was not declared in this scope
                 room->floor[ column ]->setWhichShade( WantShadow );
                                                       ^~~~~~~~~~
Mediator.cpp: In member function ‘void isomot::Mediator::reshadeFreeItem(isomot::FreeItem*)’:
Mediator.cpp:311:51: error: ‘class isomot::GridItem’ has no member named ‘setWhichShade’
                                         gridItem->setWhichShade( WantShadow );
                                                   ^~~~~~~~~~~~~
Mediator.cpp:311:66: error: ‘WantShadow’ was not declared in this scope
                                         gridItem->setWhichShade( WantShadow );
                                                                  ^~~~~~~~~~
Mediator.cpp:317:56: error: ‘class isomot::FloorTile’ has no member named ‘setWhichShade’
                                 room->floor[ column ]->setWhichShade( WantShadow );
                                                        ^~~~~~~~~~~~~
Mediator.cpp:317:71: error: ‘WantShadow’ was not declared in this scope
                                 room->floor[ column ]->setWhichShade( WantShadow );
                                                                       ^~~~~~~~~~
Mediator.cpp: In member function ‘void isomot::Mediator::shadeFreeItemsBeneathItem(isomot::Item*)’:
Mediator.cpp:336:43: error: ‘class isomot::FreeItem’ has no member named ‘setWhichShade’
                                 freeItem->setWhichShade( WantShadow );
                                           ^~~~~~~~~~~~~
Mediator.cpp:336:58: error: ‘WantShadow’ was not declared in this scope
                                 freeItem->setWhichShade( WantShadow );
                                                          ^~~~~~~~~~
Mediator.cpp: In member function ‘void isomot::Mediator::mask(isomot::FreeItem*)’:
Mediator.cpp:581:45: error: ‘class isomot::FreeItem’ has no member named ‘whichMask’
                                 ( freeItem->whichMask() != NoMask && itemToMaskWith->getTransparency() == 0 ) ||
                                             ^~~~~~~~~
Mediator.cpp:581:60: error: ‘NoMask’ was not declared in this scope
                                 ( freeItem->whichMask() != NoMask && itemToMaskWith->getTransparency() == 0 ) ||
                                                            ^~~~~~
Mediator.cpp:581:60: note: suggested alternative: ‘mask’
                                 ( freeItem->whichMask() != NoMask && itemToMaskWith->getTransparency() == 0 ) ||
                                                            ^~~~~~
                                                            mask
Mediator.cpp:582:51: error: ‘class isomot::FreeItem’ has no member named ‘whichMask’
                                 ( itemToMaskWith->whichMask() != NoMask && freeItem->getTransparency() == 0 ) )
                                                   ^~~~~~~~~
Mediator.cpp:612:24: error: ‘class isomot::FreeItem’ has no member named ‘whichMask’
         if ( freeItem->whichMask() != NoMask )
                        ^~~~~~~~~
Mediator.cpp:612:39: error: ‘NoMask’ was not declared in this scope
         if ( freeItem->whichMask() != NoMask )
                                       ^~~~~~
Mediator.cpp:612:39: note: suggested alternative: ‘mask’
         if ( freeItem->whichMask() != NoMask )
                                       ^~~~~~
                                       mask

"setWhichMask", "whichMask", "setWhichShade" and so on only appear in "Mediator.cpp" file, nowhere else...

rastersoft commented 6 years ago

Also neither "1.1" nor "1.2" branches compile.

dougmencken commented 6 years ago

master is unbuildable yet ( yeah, I’m too lazy to create branch for unfinished stuff )

may you try git checkout 12f06a4707518b3c7ec17c976c11189d8ba8c648 and then build?

dougmencken commented 6 years ago

okay, I split stuff in progress into https://github.com/dougmencken/HeadOverHeels/tree/shadowcaster so since yet master is buildable again

your experience of building it would be very welcome

rastersoft commented 6 years ago

Building after the checkout returns

In file included from gui/GuiManager.cpp:12:0:
gui/Screen.hpp:73:29: error: ‘constexpr’ needed for in-class initialization of static data member ‘const double gui::Screen::delayBetweenFrames’ of non-integral type [-fpermissive]
         static const double delayBetweenFrames = 0.1 ;
                             ^~~~~~~~~~~~~~~~~~

will try master again...

rastersoft commented 6 years ago

Receive exactly the same error when building master...

In file included from gui/GuiManager.cpp:12:0:
gui/Screen.hpp:73:29: error: ‘constexpr’ needed for in-class initialization of static data member ‘const double gui::Screen::delayBetweenFrames’ of non-integral type [-fpermissive]
         static const double delayBetweenFrames = 0.1 ;
                             ^~~~~~~~~~~~~~~~~~
dougmencken commented 6 years ago

some compilers ( by teh way, which one do you use? ) don’t accept “java-like” static const initialization, wait for fix

rastersoft commented 6 years ago

I'm using GCC 7.2.0

rastersoft commented 6 years ago

Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 7.2.0-19' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 7.2.0 (Debian 7.2.0-19)

dougmencken commented 6 years ago

how is it yet?

rastersoft commented 6 years ago

It compiles. But now I do a "sudo make install" and it installs everything into "/game", but doens't work. I go to the folder "/game/bin" and run "./headoverheels" and receive:

PathToGame is "./headoverheels"
FullPathToGame is "/game/bin/./headoverheels"
SharePath is "share/headoverheels/"
reading from file "share/headoverheels/font.png" to create font "regular-white"
headoverheels: gui/Font.cpp:20: gui::Font::Font(const string&, const string&, int, bool): La declaración `bitmapFont' no se cumple.
Shutting down Allegro due to signal #6
Abortado
rastersoft commented 6 years ago

And if I try with full path: /game/bin/headoverheels

PathToGame is "/game/bin/headoverheels"
FullPathToGame is "/game/bin/headoverheels"
terminate called after throwing an instance of 'std::length_error'
  what():  basic_string::_M_create
Shutting down Allegro due to signal #6
Abortado
dougmencken commented 6 years ago

if you use cygwin-build.sh you may run it via ./_rootdir/game/bin/headoverheels just from directory of building

how about using gdb to see backtrace to look what’s with that std::length_error

dougmencken commented 6 years ago

I got where the problem is, it’s at https://github.com/dougmencken/HeadOverHeels/blob/master/src/Ism.cpp#L123 std::string sharePath ()

@rastersoft, do you have “enough coding skills” to fix it yourself? ( I just don’t have GNU/Linux on my boxes yet ) if not, it would be a long series of tries&misses when I write possible solutions and you try them

rastersoft commented 6 years ago

I'll try...

dougmencken commented 6 years ago

well, let’s begin with https://github.com/dougmencken/HeadOverHeels/commit/f47bbc1210160b4d695934facaf61761dc0d7f01#diff-4d3e748a6e44c0630c7272f23bc2a122

rastersoft commented 6 years ago

I already added some debugs, but never reaches them. It's like the error is in other place...

rastersoft commented 6 years ago
(gdb) r
Starting program: /home/raster/juegos/HeadOverHeels/_rootdir/game/bin/headoverheels 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
PathToGame is "/home/raster/juegos/HeadOverHeels/_rootdir/game/bin/headoverheels"
FullPathToGame is "/home/raster/juegos/HeadOverHeels/_rootdir/game/bin/headoverheels"
[New Thread 0x7fffed01e700 (LWP 31669)]
terminate called after throwing an instance of 'std::length_error'
  what():  basic_string::_M_create

Thread 1 "headoverheels" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51  ../sysdeps/unix/sysv/linux/raise.c: No existe el fichero o el directorio.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff5970cf7 in __GI_abort () at abort.c:90
#2  0x00007ffff62e4b85 in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007ffff62e2956 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007ffff62e29a1 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007ffff62e2be4 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007ffff630b1df in std::__throw_length_error(char const*) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#7  0x00007ffff6371bcc in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#8  0x00005555555bff1f in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*> (this=this@entry=0x7fffffffe4d0, 
    __beg=__beg@entry=0x55555593f290 "/usr/share/locale/es_ES.UTF-8.utf8/LC_MESSAGES/messages.mo", __end=<optimized out>) at /usr/include/c++/7/bits/basic_string.tcc:219
#9  0x00005555555c0b2e in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct_aux<char const*> (__end=<optimized out>, 
    __beg=0x55555593f290 "/usr/share/locale/es_ES.UTF-8.utf8/LC_MESSAGES/messages.mo", this=0x7fffffffe4d0) at /usr/include/c++/7/bits/basic_string.h:236
#10 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*> (__end=<optimized out>, 
    __beg=0x55555593f290 "/usr/share/locale/es_ES.UTF-8.utf8/LC_MESSAGES/messages.mo", this=0x7fffffffe4d0) at /usr/include/c++/7/bits/basic_string.h:255
#11 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string (__a=..., __n=<optimized out>, __s=0x55555593f290 "/usr/share/locale/es_ES.UTF-8.utf8/LC_MESSAGES/messages.mo", 
    this=0x7fffffffe4d0) at /usr/include/c++/7/bits/basic_string.h:502
#12 isomot::sharePath[abi:cxx11]() () at Ism.cpp:147
#13 0x00005555555f8438 in gui::GuiManager::GuiManager (this=0x555555908dd0) at gui/GuiManager.cpp:56
#14 0x00005555555f8efb in gui::GuiManager::getInstance () at gui/GuiManager.cpp:92
#15 0x0000555555565065 in main (argc=<optimized out>, argv=<optimized out>) at main.cpp:19
rastersoft commented 6 years ago

If I launch it with Valgrind, it returns several invalid accesses, but seems to start...

dougmencken commented 6 years ago

in gui::GuiManager::GuiManager (this=0x555555908dd0) at gui/GuiManager.cpp:56 is std::string pathToFont = isomot::sharePath();

so may you re-pull master and try it ?

on my side it outputs

PathToGame is "./headoverheelsroot/game/bin/headoverheels"
FullPathToGame is "/Volumes/hfsplushd/Development/HeadOverHeels/boo/./headoverheelsroot/game/bin/headoverheels"
2018-01-14 14:30:18.003 headoverheels[11875:3803] Warning once: This application, or a library it uses, is using NSQuickDrawView, which has been deprecated. Apps should cease use of QuickDraw and move to Quartz.
>:> getting SharePath... cpath is "./headoverheelsroot/game/bin/headoverheels"
>:> getting SharePath... filename is "headoverheels"
>:> getting SharePath... containername is "bin"
SharePath is "./headoverheelsroot/game/share/headoverheels/"
reading from file "./headoverheelsroot/game/share/headoverheels/font.png" to create font "regular-white"
reading from file "./headoverheelsroot/game/share/headoverheels/font.png" to create font "big-white"
reading from file "./headoverheelsroot/game/share/headoverheels/font.png" to create font "regular-orange"
reading from file "./headoverheelsroot/game/share/headoverheels/font.png" to create font "regular-cyan"
reading from file "./headoverheelsroot/game/share/headoverheels/font.png" to create font "regular-yellow"
reading from file "./headoverheelsroot/game/share/headoverheels/font.png" to create font "big-orange"
reading from file "./headoverheelsroot/game/share/headoverheels/font.png" to create font "big-cyan"
reading from file "./headoverheelsroot/game/share/headoverheels/font.png" to create font "big-yellow"
parse "./headoverheelsroot/game/share/headoverheels/sounds.xml"
read list of sounds from sounds.xml
parse "/Users/powermac/.headoverheels/preferences.xml"
language "de_DE"
parse "./headoverheelsroot/game/share/headoverheels/text/de_DE.xml"
parse "./headoverheelsroot/game/share/headoverheels/text/en_US.xml"
dougmencken commented 6 years ago

as for several invalid accesses I want to see that too, because there’s no valgrind on osx@ppc, nor -fsanitize=address

rastersoft commented 6 years ago

Ok, the error seems to be at

std::string container = std::string( cpath, strlen( cpath ) - strlen( filename ) - 1 );

rastersoft commented 6 years ago

cpath is an empty string, so strlen(cpath) is 0, and strlen(filename) is also 0...

rastersoft commented 6 years ago

Ok, it seems that it is not recognizing nor CYGWIN neither __WIN32, because it is calling

const char* cpath = pathToGame().c_str ();

instead of

const char* cpath = FullPathToGame.c_str ();
dougmencken commented 6 years ago

They’re equal on your side, as I see

rastersoft commented 6 years ago

Yes, if I remove the lines

#if defined ( __CYGWIN__ ) || defined ( __WIN32 )
            const char* cpath = FullPathToGame.c_str ();
#else
            const char* cpath = pathToGame().c_str ();
#endif

and replace them with just

    const char* cpath = FullPathToGame.c_str ();

It seems to work.

dougmencken commented 6 years ago

May you try updated master?

dougmencken commented 6 years ago

Looks like new GCCs “optimize out” functions like that pathToGame()

rastersoft commented 6 years ago

It works!!!! Thanks!!!!

dougmencken commented 6 years ago

nice, so some screencap of game from your side, and maybe open other bug for bad memory accesses, okay?

dougmencken commented 6 years ago

okay to close this, @rastersoft ?

rastersoft commented 6 years ago

Yes, 100% ok