Merge lp:~widelands-dev/widelands/appveyor_fix into lp:widelands

Proposed by hessenfarmer
Status: Merged
Merged at revision: 8819
Proposed branch: lp:~widelands-dev/widelands/appveyor_fix
Merge into: lp:widelands
Diff against target: 134 lines (+61/-6)
5 files modified
appveyor.yml (+0/-3)
src/graphic/gl/initialize.cc (+44/-2)
src/graphic/gl/system_headers.h (+10/-0)
src/network/crypto.cc (+5/-1)
src/network/crypto.h (+2/-0)
To merge this branch: bzr merge lp:~widelands-dev/widelands/appveyor_fix
Reviewer Review Type Date Requested Status
GunChleoc Approve
Review via email: mp+354160@code.launchpad.net

Commit message

I need an appveyor build to further debug this

To post a comment you must log in.
Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 3881. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/423709137.
Appveyor build 3679. State: failed. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_appveyor_fix-3679.

Revision history for this message
hessenfarmer (stephan-lutz) wrote :

Ok first Appveyor build was succesful now

Probably I found a solution for the GlBinding issue in this Project:

https://github.com/Vita3K/Vita3K/commit/50d5f370ccb31f01931bbad8a61d56415bb26bf2#diff-a3d8e817ab0c2453cab1fd1f9a601e71

I will test this tonight as well.

Revision history for this message
GunChleoc (gunchleoc) wrote :

This doesn't work on Ubuntu 18.04:

/home/bratzbert/sources/widelands/appveyor_fix/src/network/crypto.cc:3:10: fatal error: boost/uuid/detail/sha1.hpp: No such file or directory
 #include <boost/uuid/detail/sha1.hpp>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

I have added another dirty hack, we need proper version detection here when we fix this properly.

Revision history for this message
hessenfarmer (stephan-lutz) wrote :

which Version of boost is included in Ubunbtu 18.04?

in Version 67 both files are present while

<boost/uuid/sha1.hpp> is only including

 <boost/uuid/detail/sha1.hpp>

from 68 onwards only the last one is available and until 66 only the first one was used.

Appveyor by the way is on win7 therefore it hasn't the Problem with the crypto API in boost67 or boost68.

Revision history for this message
hessenfarmer (stephan-lutz) wrote :

Hi,

I have a working solution for glbinding v3.0.x.x now. However as Ubuntu bionic is still on 2.1.1 this won't work in Ubuntu so we should probably stay with the downgrade of the packages to keep the code as compatible with different environments as possible.
Boost version could be queried and used for a ifdef statement but glbinding can't .
Perhaps we could save some time on appveyor if we just skip the original installation of boost and glbinding in their original version.
I will add the changes to the appveyor.yml to test this

Revision history for this message
GunChleoc (gunchleoc) wrote :

I'd be OK with not supporting older versions of glbinding, because we can still build with glew.

Revision history for this message
hessenfarmer (stephan-lutz) wrote :

which environments do we need to support then? That is I wasn't sure which version of glbinding is currently used by the travis environment.

For me it seems to be more efficient to stick to the old versions of glbinding and boost and every other possibly upgraded package until we can switch to newer ones for all supported building Environments.

As the MSYS repo will keep this versions for a long time there is no need to hurry. Only thing is we should add the glbinding downgrade to the MSYS build instructions on the homepage as well.

Although I have no idea what could be the implication on the travis environment.

we could do the upgrade for all environments when the environment with the lowest version of the 3rd party packages upgrades.

By the way building with glew only would have been possible with appveyor as well, but I would prefer to have both options available in every environment.

So I would prefer stay with the current libs as long as reasonable and afterwards do one migration task for all environments at once. (good thing is we already know how to do this for glbinding 3.0.x.x and boost 1.68), but in the end it is your decision so if you want me to incorporate the glbinding solution and the boost switch I can do this.

Otherwise we would need to maintain a huge bunch of switches in the code to support different versions of these packages.

Revision history for this message
GunChleoc (gunchleoc) wrote :

The Linux builds in Travis could not handle the new Boost header, while the Mac builds could.

I think having a switch for the Boost versions is still a good idea. Document the changes needed for glbinding in the bug, call it "modernize glbinding" or something and retarget it to Build 21?

I have already pushed a fix for the downgrading directly to trunk to get us going again with AppVeyor ASAP.

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 3896. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/424652169.
Appveyor build 3694. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_appveyor_fix-3694.

Revision history for this message
hessenfarmer (stephan-lutz) wrote :

ok I think I found a cool solution for glbinding as well. Let's wait for the CI results and then review please.
Locally it took Glbinding 3 code and boost 1.66 code (had to downgrade this as I am on Win10) so in msys2 environment the switches are working.

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 3902. State: errored. Details: https://travis-ci.org/widelands/widelands/builds/424998557.
Appveyor build 3700. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_appveyor_fix-3700.

Revision history for this message
GunChleoc (gunchleoc) wrote :

We have a new compiler warning on AppVeyor:

../src/graphic/gl/initialize.cc:101:9: warning: format '%s' expects argument of type 'char*', but argument 2 has type 'std::unique_ptr<glbinding::AbstractValue>::pointer' {aka 'glbinding::AbstractValue*'} [-Wformat=]
     log("%s", call.parameters[i].get());
         ^~~~ ~~~~~~~~~~~~~~~~~~~~~~~~
../src/graphic/gl/initialize.cc:107:9: warning: format '%s' expects argument of type 'char*', but argument 2 has type 'std::unique_ptr<glbinding::AbstractValue>::pointer' {aka 'glbinding::AbstractValue*'} [-Wformat=]
     log(" -> %s", call.returnValue.get());
         ^~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~

See if you can get something interesting to log from the objects - do they still have ->asString().c_str() available?

Revision history for this message
hessenfarmer (stephan-lutz) wrote :

they deleted asString unfortunately.
I found the solution above that throws the warning in some other project on the internet.
I don't know how to test it, nor how to avoid it, cause I dont't understand the intention behind these code blocks.

Revision history for this message
GunChleoc (gunchleoc) wrote :

I have downloaded the source code for glbinding and there is nothing else to use, so I have changed the placeholder to %p. If it now will complain about the pointers not being void* and about nothing else, we can surround it with a macro that I created to shut it up, like this:

    FORMAT_WARNINGS_OFF;
    molog("Some log %p\n", pointer);
    FORMAT_WARNINGS_ON;

I'd like to see the compiler output first though.

Revision history for this message
hessenfarmer (stephan-lutz) wrote :

The Solution with .get was used in their examples. But I have created an issue about that in their github repo

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 3917. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/426307714.
Appveyor build 3715. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_appveyor_fix-3715.

Revision history for this message
GunChleoc (gunchleoc) wrote :

Compiler warnings are gone now. I also tested that it still compiles with older glbinding version and with glew on my machine.

Thanks for figuring this one out!

@bunnybot merge

review: Approve
Revision history for this message
GunChleoc (gunchleoc) wrote :

This has now landed with commit message "I need an appveyor build to further debug this". Please take care in the future to set a proper commit message and add such comments in the comment/description section. I don't always catch them all ;)

Revision history for this message
hessenfarmer (stephan-lutz) wrote :

Sorry for the commit message.
However it seems that the code style script for the master release has broken the GLbinding switch in Grapic/gl/system_headers.h, cause it introduced some spaces in the detection if glbing/glbinding.h is present

Revision history for this message
hessenfarmer (stephan-lutz) wrote :

something has been changed in network/crypto.cc as well to make travis unhappy

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'appveyor.yml'
2--- appveyor.yml 2018-09-05 05:51:36 +0000
3+++ appveyor.yml 2018-09-09 09:55:19 +0000
4@@ -20,9 +20,6 @@
5 - cmd: "bash --login -c \"pacman -Su --noconfirm\""
6 # Installed required libs
7 - cmd: "bash --login -c \"pacman --noconfirm -S mingw-w64-%MINGWSUFFIX%-ninja mingw-w64-%MINGWSUFFIX%-boost mingw-w64-%MINGWSUFFIX%-SDL2_ttf mingw-w64-%MINGWSUFFIX%-SDL2_mixer mingw-w64-%MINGWSUFFIX%-SDL2_image mingw-w64-%MINGWSUFFIX%-glbinding\""
8- - cmd: "bash --login -c \"pacman --noconfirm -U http://repo.msys2.org/mingw/%MINGWSUFFIX%/mingw-w64-%MINGWSUFFIX%-glbinding-2.1.4-1-any.pkg.tar.xz\""
9- # Downgrade Boost, because they changed the crypto API include path
10- - cmd: "bash --login -c \"pacman --noconfirm -U http://repo.msys2.org/mingw/%MINGWSUFFIX%/mingw-w64-%MINGWSUFFIX%-boost-1.66.0-2-any.pkg.tar.xz\""
11
12 shallow_clone: true
13
14
15=== modified file 'src/graphic/gl/initialize.cc'
16--- src/graphic/gl/initialize.cc 2018-08-28 07:53:33 +0000
17+++ src/graphic/gl/initialize.cc 2018-09-09 09:55:19 +0000
18@@ -48,6 +48,7 @@
19 SDL_GL_MakeCurrent(sdl_window, gl_context);
20
21 #ifdef USE_GLBINDING
22+# ifndef GLBINDING3
23 glbinding::Binding::initialize();
24
25 // The undocumented command line argument --debug_gl_trace will set
26@@ -56,8 +57,8 @@
27 // is built using -DOPTION_USE_GLBINDING:BOOL=ON. It is a NoOp for GLEW.
28 if (trace == Trace::kYes) {
29 setCallbackMaskExcept(
30- glbinding::CallbackMask::After | glbinding::CallbackMask::ParametersAndReturnValue,
31- {"glGetError"});
32+ glbinding::CallbackMask::After | glbinding::CallbackMask::ParametersAndReturnValue,
33+ {"glGetError"});
34 glbinding::setAfterCallback([](const glbinding::FunctionCall& call) {
35 log("%s(", call.function->name());
36 for (size_t i = 0; i < call.parameters.size(); ++i) {
37@@ -80,6 +81,47 @@
38 // }
39 });
40 }
41+# else
42+ const glbinding::GetProcAddress get_proc_address = [](const char *name) {
43+ return reinterpret_cast<glbinding::ProcAddress>(SDL_GL_GetProcAddress(name));
44+ };
45+ glbinding::Binding::initialize(get_proc_address, true);
46+
47+ // The undocumented command line argument --debug_gl_trace will set
48+ // Trace::kYes. This will log every OpenGL call that is made, together with
49+ // arguments, return values and glError status. This requires that Widelands
50+ // is built using -DOPTION_USE_GLBINDING:BOOL=ON. It is a NoOp for GLEW.
51+ if (trace == Trace::kYes) {
52+ glbinding::setCallbackMaskExcept(
53+ glbinding::CallbackMask::After | glbinding::CallbackMask::ParametersAndReturnValue,
54+ {"glGetError"});
55+ glbinding::setAfterCallback([](const glbinding::FunctionCall& call) {
56+ log("%s(", call.function->name());
57+ for (size_t i = 0; i < call.parameters.size(); ++i) {
58+ FORMAT_WARNINGS_OFF;
59+ log("%p", call.parameters[i].get());
60+ FORMAT_WARNINGS_ON;
61+ if (i < call.parameters.size() - 1)
62+ log(", ");
63+ }
64+ log(")");
65+ if (call.returnValue) {
66+ FORMAT_WARNINGS_OFF;
67+ log(" -> %p", call.returnValue.get());
68+ FORMAT_WARNINGS_ON;
69+ }
70+ const auto error = glGetError();
71+ log(" [%s]\n", gl_error_to_string(error));
72+ // The next few lines will terminate Widelands if there was any OpenGL
73+ // error. This is useful for super aggressive debugging, but probably
74+ // not for regular builds. Comment it in if you need to understand
75+ // OpenGL problems.
76+ // if (error != GL_NO_ERROR) {
77+ // std::raise(SIGINT);
78+ // }
79+ });
80+ }
81+# endif
82 #else
83 // See graphic/gl/system_headers.h for an explanation of the next line.
84 glewExperimental = GL_TRUE;
85
86=== modified file 'src/graphic/gl/system_headers.h'
87--- src/graphic/gl/system_headers.h 2018-04-07 16:59:00 +0000
88+++ src/graphic/gl/system_headers.h 2018-09-09 09:55:19 +0000
89@@ -37,6 +37,16 @@
90 #ifdef USE_GLBINDING
91 #include <glbinding/Binding.h>
92 #include <glbinding/gl/gl.h>
93+
94+// testing for the presence of glbinding.h to determine whether we have a glbinding version newer then 2.1.4
95+#ifdef __has_include
96+# if __has_include(<glbinding/glbinding.h>)
97+# include <glbinding/glbinding.h>
98+# include <glbinding/ProcAddress.h>
99+# define GLBINDING3
100+# endif
101+#endif
102+
103 // This fakes that most other gl bindings define gl functions in the public namespace.
104 CLANG_DIAG_OFF("-Wheader-hygiene")
105 using namespace gl;
106
107=== modified file 'src/network/crypto.cc'
108--- src/network/crypto.cc 2017-11-26 20:55:56 +0000
109+++ src/network/crypto.cc 2018-09-09 09:55:19 +0000
110@@ -1,6 +1,10 @@
111 #include "network/crypto.h"
112
113-#include <boost/uuid/sha1.hpp>
114+#if BOOST_VERSION > 106700
115+ #include "boost/uuid/detail/sha1.hpp"
116+#else
117+ #include "boost/uuid/sha1.hpp"
118+#endif
119
120 namespace crypto {
121
122
123=== modified file 'src/network/crypto.h'
124--- src/network/crypto.h 2018-04-07 16:59:00 +0000
125+++ src/network/crypto.h 2018-09-09 09:55:19 +0000
126@@ -22,6 +22,8 @@
127
128 #include <string>
129
130+#include "boost/version.hpp"
131+
132 namespace crypto {
133
134 /**

Subscribers

People subscribed via source and target branches

to status/vote changes: