4ian / GDevelop

🎮 Open-source, cross-platform 2D/3D/multiplayer game engine designed for everyone.
https://gdevelop.io
Other
10.83k stars 849 forks source link

Problem with compiling GD on Mint 17.3 #494

Closed tdolphin-org closed 3 years ago

tdolphin-org commented 6 years ago

Hi

I have such problem with compiling GD (based on latest sources). I have such errors:

-- VersionPriv.h already up-to-date.
[  0%] Built target GDVersion
[  1%] Built target sfml-system
[  4%] Built target sfml-window
[  5%] Built target sfml-network
[  8%] Built target sfml-graphics
[ 10%] Built target sfml-audio
[ 10%] Building CXX object Core/CMakeFiles/GDCore.dir/GDCore/Events/Event.cpp.o
In file included from /home/armo/Pobrane/gdevelop-dev/GD/Core/./GDCore/Extensions/Metadata/ExpressionMetadata.h:12:0,
                 from /home/armo/Pobrane/gdevelop-dev/GD/Core/./GDCore/Extensions/Metadata/BehaviorMetadata.h:9,
                 from /home/armo/Pobrane/gdevelop-dev/GD/Core/./GDCore/Extensions/PlatformExtension.h:14,
                 from /home/armo/Pobrane/gdevelop-dev/GD/Core/GDCore/Events/Event.cpp:11:
/home/armo/Pobrane/gdevelop-dev/GD/Core/./GDCore/Extensions/Metadata/InstructionMetadata.h:411:12: error: field ‘icon’ has incomplete type
   wxBitmap icon;
            ^
/home/armo/Pobrane/gdevelop-dev/GD/Core/./GDCore/Extensions/Metadata/InstructionMetadata.h:412:12: error: field ‘smallicon’ has incomplete type
   wxBitmap smallicon;
            ^
In file included from /home/armo/Pobrane/gdevelop-dev/GD/Core/./GDCore/Extensions/Metadata/ExpressionMetadata.h:12:0,
                 from /home/armo/Pobrane/gdevelop-dev/GD/Core/./GDCore/Extensions/Metadata/BehaviorMetadata.h:9,
                 from /home/armo/Pobrane/gdevelop-dev/GD/Core/./GDCore/Extensions/PlatformExtension.h:14,
                 from /home/armo/Pobrane/gdevelop-dev/GD/Core/GDCore/Events/Event.cpp:11:
/home/armo/Pobrane/gdevelop-dev/GD/Core/./GDCore/Extensions/Metadata/InstructionMetadata.h: In member function ‘const wxBitmap& gd::InstructionMetadata::GetBitmapIcon() const’:
/home/armo/Pobrane/gdevelop-dev/GD/Core/./GDCore/Extensions/Metadata/InstructionMetadata.h:127:50: error: ‘icon’ was not declared in this scope
   const wxBitmap &GetBitmapIcon() const { return icon; }
[...]

I have installed libwxbase3.0-dev. Any ideas?

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/58285510-problem-with-compiling-gd-on-mint-17-3?utm_campaign=plugin&utm_content=tracker%2F3677421&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F3677421&utm_medium=issues&utm_source=github).
4ian commented 6 years ago

I think you must install all the wxwidgets 3 libraries, not only libwxbase?

Nnarol commented 6 years ago

@tdolphin-org Hi! The same issue happened to me on Ubuntu 18.04, with a different header file. If this has not yet been solved, I'll look into it on sunday. Until then, could you try adding the line "#include <wx/bitmap.h>" to the file "/home/armo/Pobrane/gdevelop-dev/GD/Core/./GDCore/Extensions/Metadata/InstructionMetadata.h" ?

Actually, I doubt that libwxbase3.0-dev did not contain the definition for wxBitmap for the following reason:

If the type was completely missing, then the preprocessor (which acts before the compiler or linker) would have already complained that it cannot find the header "bitmap.h". However, if the package does include the header, then that would imply that this development package gives you the declaration of a type in a header for which it does not give you an object file where the type is actually defined, which would be weird in my opinion.

Although it would not be the first weird thing about the library wxWidgets I encountered: for instance, the file "properties.h" (I believe it was that header?) uses wxBitmap, but does not include "bitmap.h" even indirectly, so if you use properties.h, which is a public header, directly, you have to manually resolve the dependency by including bitmap.h yourself.

(Strange, I've already written this once... I must have forgotten to click on the "Comment" button before logging out.)

tdolphin-org commented 6 years ago

Thanks in advance for all Your help. As suggested firstly by @4ian I have installed all libraries for wxwidgets 3. Many errors have gone .. but I have stuck with those:

[ 10%] Building CXX object Core/CMakeFiles/GDCore.dir/GDCore/IDE/wxTools/FileProperty.cpp.o
In file included from /home/armo/Pobrane/gdevelop-dev/GD/Core/GDCore/IDE/wxTools/FileProperty.h:10:0,
                 from /home/armo/Pobrane/gdevelop-dev/GD/Core/GDCore/IDE/wxTools/FileProperty.cpp:7:
/usr/include/wx-3.0-unofficial/wx/propgrid/property.h:212:17: error: field ‘m_bitmap’ has incomplete type
     wxBitmap    m_bitmap;
                 ^
/usr/include/wx-3.0-unofficial/wx/propgrid/property.h: In member function ‘void wxPGCellData::SetBitmap(const wxBitmap&)’:
/usr/include/wx-3.0-unofficial/wx/propgrid/property.h:203:48: error: ‘m_bitmap’ was not declared in this scope
     void SetBitmap( const wxBitmap& bitmap ) { m_bitmap = bitmap; }
                                                ^
/usr/include/wx-3.0-unofficial/wx/propgrid/property.h: In member function ‘const wxBitmap& wxPGCell::GetBitmap() const’:
/usr/include/wx-3.0-unofficial/wx/propgrid/property.h:288:59: error: ‘const class wxPGCellData’ has no member named ‘m_bitmap’
     const wxBitmap& GetBitmap() const { return GetData()->m_bitmap; }

And it seems it related to version of wxWidgets. I have installed 3.0.2 and it is to low version. But I didn't manage to install newer version on Mint 17.3 (which is based on Ubuntu 14.04).

4ian commented 6 years ago

Can you add #include <wx/bitmap.h> after #include <wx/control.h> in FileProperty.h? Then recompile.

Nnarol commented 6 years ago

I also scoured the code yesterday, although I didn't have time to try it with the base libraries only and you were right indeed @4ian, since wx/bitmap.h was included at the place where the original error occured already.

I think it is very strange to provide a public header in a package that has types for which the package provides no definition, but lesson learned: I'll always be suspicious when it comes to wxWidgets in existing code that is supposed to be working.

Nnarol commented 6 years ago

Actually something downed on me: if you just switch the position of #include <wx/propgrid/props.h> and #include <wx/propgrid/propgrid.h>, it should most probably work as well. You can even remove #include <wx/control.h> completely, since propgrid.h already includes it. Of course, there could be other dependency issues after this.

For the other part, props.h indirectly includes bitmap.h, since it uses button.h and other widgets.

When I had this problem, I first also included wx/bitmap.h, but then asked around on wxWidgets' IRC and they advised me to just remove the redundant header (wx/propgrid/property.h, also included by propgrid.h). It worked, so I stuck with it. If that is a good decision, only you know, 4ian.

4ian commented 6 years ago

@Nnarol Could you create a PR with this change like you did the last time? If removing an extra header is what wxWidgets folks recommend, then I'm ok with doing it :)

Nnarol commented 6 years ago

@4ian Sure, I'll try a full rebuild with modified includes within 1-2 hours. I finally have some time on my hands.

Nnarol commented 6 years ago

Ok, so it looks like there is indeed another dependency issue later down the road in "editors.h" if the inclusions of propgrid.h and props.h are swapped, but control.h is not needed. Although to be fair, I used Ubuntu 18.04, not Mint 17.3, with a probably different set of libraries, and the build was successful even in the current state of "master", without any change.

@4ian I do not know if removing unneeded extraneous headers is the recommended way by the wxWidgets guys, although in that one specific case, it was recommended by someone at their IRC channel.

Nnarol commented 6 years ago

@tdolphin-org: Could you try to either pull from Nnarol:bugfix/fix_incomplete_wxwidgets_type_error or just manually delete "#include <wx/control.h>" and add "#include <wx/bitmap.h>" as the first include in Core/GDCore/IDE/wxTools/FileProperty.h ? Your environment is different from mine, and I didn't have your issue in the first place. I hope I didn't introduce more issues.

Nnarol commented 6 years ago

@tdolphin-org Now you can just pull from master if you want to try it, since the modification has been merged.

tdolphin-org commented 6 years ago

Hi, On Saturday I have upgraded my Mint 17.3 to Mint 18.3 (based on Ubuntu 16.04). I have installed wx3.0.4. And have got following error:

[ 19%] Building CXX object Core/CMakeFiles/GDCore.dir/GDCore/IDE/wxTools/FileProperty.cpp.o
In file included from /home/armo/Pobrane/gdevelop-dev/GD/Core/GDCore/IDE/wxTools/FileProperty.h:10:0,
                 from /home/armo/Pobrane/gdevelop-dev/GD/Core/GDCore/IDE/wxTools/FileProperty.cpp:7:
/usr/include/wx-3.0-unofficial/wx/propgrid/property.h:212:17: error: field ‘m_bitmap’ has incomplete type ‘wxBitmap’
     wxBitmap    m_bitmap;
                 ^
In file included from /usr/include/wx-3.0-unofficial/wx/event.h:20:0,
                 from /usr/include/wx-3.0-unofficial/wx/window.h:18,
                 from /usr/include/wx-3.0-unofficial/wx/control.h:22,
                 from /home/armo/Pobrane/gdevelop-dev/GD/Core/GDCore/IDE/wxTools/FileProperty.h:9,
                 from /home/armo/Pobrane/gdevelop-dev/GD/Core/GDCore/IDE/wxTools/FileProperty.cpp:7:
/usr/include/wx-3.0-unofficial/wx/gdicmn.h:29:28: note: forward declaration of ‘class wxBitmap’
 class WXDLLIMPEXP_FWD_CORE wxBitmap;

So my suspesion about wx version is not true :( Now I am going to check the latest code on master and Your changes.

tdolphin-org commented 6 years ago

Compilation succeeded (there were some warnings but that's all). So thanks for Your changes.

Besides that GD crashes after start and creating any project ... :/

4ian commented 6 years ago

What's the error displayed in the console? I should have said that earlier, but the compatibility for Linux for GD4 is really a huuuuge pain. I highly recommend to switch to GDevelop 5 which is 100% cross platform and should work flawlessly on any recent Linux distro - it's still in beta but already almost as powerful as GD4.

If you're interested in contributing/tweaking the IDE, GDevelop 5 is also much more easier to modify (see https://github.com/4ian/GD/tree/master/newIDE), with nearly instant live reload on changes (and other things like "Storybook" for rapid UI development).

Nnarol commented 6 years ago

@tdolphin-org If your problem was an X Window System error with error code 10, request code 2, which is a typical cause of crash on Linux after project creation, my answer to this issue might help you:

https://github.com/4ian/GD/issues/392

Just make sure to apply it for your case, because the above issue was filed for Ubuntu, not Mint. Although I think the wx library packages should be called the same for the two systems, since most variants of Mint are based on Ubuntu. It is just 4 install/uninstall commands.

tdolphin-org commented 6 years ago

@Nnarol Yes I have go error code 10, request 2. I was trying to remove and install suggested packages ... but I have problem to find libwxgtk3.0-gtk3-dev. It seems that this is only available for Ubuntu 18+ .. My Mint 18.3 is based on Ubuntu 16.04 :( Let's leave it. I will give a try to new IDE.

Silver-Streak commented 3 years ago

GD4 issue, closing due to inactivity.