GameAnalytics / GA-SDK-GODOT

Official GameAnalytics Godot SDK repository
MIT License
42 stars 8 forks source link

Compiling error : 'mutex' was not declared in this scope; did you mean 'std::mutex'? #12

Closed lentsius-bark closed 3 years ago

lentsius-bark commented 3 years ago

I've been keeping up to date with the master 3.2 branch. It's always worked like a charm till just a few commits ago when I started getting the below pasted errors related to std:mutex

This only occurs when building the editor with the gameanalytics module.

In file included from /usr/include/c++/10/mutex:43,
                 from ./core/os/mutex.h:39,
                 from ./core/pool_vector.h:36,
                 from ./core/math/transform_2d.h:35,
                 from ./core/method_ptrcall.h:34,
                 from ./core/method_bind.h:35,
                 from ./core/class_db.h:34,
                 from modules/gameanalytics/register_types.cpp:2:
/usr/include/c++/10/bits/std_mutex.h:83:9: note: 'std::mutex' declared here
   83 |   class mutex : private __mutex_base
      |         ^~~~~
In file included from ./core/pool_vector.h:37,
                 from ./core/math/transform_2d.h:35,
                 from ./core/method_ptrcall.h:34,
                 from ./core/method_bind.h:35,
                 from ./core/class_db.h:34,
                 from modules/gameanalytics/register_types.cpp:2:
./core/os/rw_lock.h: In member function 'Error RWLock::write_try_lock()':
./core/os/rw_lock.h:71:10: error: 'mutex' was not declared in this scope; did you mean 'std::mutex'?
   71 |   return mutex.try_lock() ? OK : ERR_BUSY;
      |          ^~~~~
      |          std::mutex
In file included from /usr/include/c++/10/mutex:43,
                 from ./core/os/mutex.h:39,
                 from ./core/pool_vector.h:36,
                 from ./core/math/transform_2d.h:35,
                 from ./core/method_ptrcall.h:34,
                 from ./core/method_bind.h:35,
                 from ./core/class_db.h:34,
                 from modules/gameanalytics/register_types.cpp:2:
/usr/include/c++/10/bits/std_mutex.h:83:9: note: 'std::mutex' declared here
   83 |   class mutex : private __mutex_base
      |         ^~~~~
In file included from ./core/pool_vector.h:37,
                 from ./core/math/transform_2d.h:35,
                 from ./core/method_ptrcall.h:34,
                 from ./core/method_bind.h:35,
                 from ./core/class_db.h:34,
                 from ./core/reference.h:34,
                 from modules/gameanalytics/GameAnalytics.h:3,
                 from modules/gameanalytics/GameAnalytics.cpp:1:
./core/os/rw_lock.h:41:15: error: 'shared_timed_mutex' in namespace 'std' does not name a type
   41 |  mutable std::shared_timed_mutex mutex;
      |               ^~~~~~~~~~~~~~~~~~
./core/os/rw_lock.h:41:10: note: 'std::shared_timed_mutex' is only available from C++14 onwards
   41 |  mutable std::shared_timed_mutex mutex;
      |          ^~~
./core/os/rw_lock.h: In member function 'void RWLock::read_lock() const':
./core/os/rw_lock.h:46:3: error: 'mutex' was not declared in this scope; did you mean 'std::mutex'?
   46 |   mutex.lock_shared();
      |   ^~~~~
      |   std::mutex
In file included from /usr/include/c++/10/mutex:43,
                 from ./core/os/mutex.h:39,
                 from ./core/pool_vector.h:36,
                 from ./core/math/transform_2d.h:35,
                 from ./core/method_ptrcall.h:34,
                 from ./core/method_bind.h:35,
                 from ./core/class_db.h:34,
                 from ./core/reference.h:34,
                 from modules/gameanalytics/GameAnalytics.h:3,
                 from modules/gameanalytics/GameAnalytics.cpp:1:
/usr/include/c++/10/bits/std_mutex.h:83:9: note: 'std::mutex' declared here
   83 |   class mutex : private __mutex_base
      |         ^~~~~
In file included from ./core/pool_vector.h:37,
                 from ./core/math/transform_2d.h:35,
                 from ./core/method_ptrcall.h:34,
                 from ./core/method_bind.h:35,
                 from ./core/class_db.h:34,
                 from ./core/reference.h:34,
                 from modules/gameanalytics/GameAnalytics.h:3,
                 from modules/gameanalytics/GameAnalytics.cpp:1:
./core/os/rw_lock.h: In member function 'void RWLock::read_unlock() const':
./core/os/rw_lock.h:51:3: error: 'mutex' was not declared in this scope; did you mean 'std::mutex'?
   51 |   mutex.unlock_shared();
      |   ^~~~~
      |   std::mutex
In file included from /usr/include/c++/10/mutex:43,
                 from ./core/os/mutex.h:39,
                 from ./core/pool_vector.h:36,
                 from ./core/math/transform_2d.h:35,
                 from ./core/method_ptrcall.h:34,
                 from ./core/method_bind.h:35,
                 from ./core/class_db.h:34,
                 from ./core/reference.h:34,
                 from modules/gameanalytics/GameAnalytics.h:3,
                 from modules/gameanalytics/GameAnalytics.cpp:1:
/usr/include/c++/10/bits/std_mutex.h:83:9: note: 'std::mutex' declared here
   83 |   class mutex : private __mutex_base
      |         ^~~~~
In file included from ./core/pool_vector.h:37,
                 from ./core/math/transform_2d.h:35,
                 from ./core/method_ptrcall.h:34,
                 from ./core/method_bind.h:35,
                 from ./core/class_db.h:34,
                 from ./core/reference.h:34,
                 from modules/gameanalytics/GameAnalytics.h:3,
                 from modules/gameanalytics/GameAnalytics.cpp:1:
./core/os/rw_lock.h: In member function 'Error RWLock::read_try_lock() const':
./core/os/rw_lock.h:56:10: error: 'mutex' was not declared in this scope; did you mean 'std::mutex'?
   56 |   return mutex.try_lock_shared() ? OK : ERR_BUSY;
      |          ^~~~~
      |          std::mutex
In file included from /usr/include/c++/10/mutex:43,
                 from ./core/os/mutex.h:39,
                 from ./core/pool_vector.h:36,
                 from ./core/math/transform_2d.h:35,
                 from ./core/method_ptrcall.h:34,
                 from ./core/method_bind.h:35,
                 from ./core/class_db.h:34,
                 from ./core/reference.h:34,
                 from modules/gameanalytics/GameAnalytics.h:3,
                 from modules/gameanalytics/GameAnalytics.cpp:1:
lentsius-bark commented 3 years ago

Several pulls later, the issue remains. I've been thinking that it could have been a temporary issue but it looks like a permanent change that took place in the source.

the1schwartz commented 3 years ago

I usually only builds against the stable versions, so if the issue still persists on the stable version of 3.2.4 then I will have a look at it.

lentsius-bark commented 3 years ago

@the1schwartz absolutely understandable. Updating the module before a stable release makes little to no sense.

On a side note as heads up, this may be of service to you once the time comes to look into this, I suspect the issue stems from this PR that was pushed into Godot 3.2.4, 5 days ago: https://github.com/godotengine/godot/pull/45618

Ozzadar commented 3 years ago

https://github.com/GameAnalytics/GA-SDK-GODOT/blob/master/gameanalytics/SCsub#L9

I was getting the same error in my godot_dragonbones plugin -- we were both enabling c++11 in our SCsub. It seems to have been only an issue on x11 builds. At least my windows builds were fine

I seem to be compiling fine now without this line as I think theyve brought newer c++ standards in for 3.3.

Maybe give that a shot

(I made it here when trying to find help through Google)

akien-mga commented 3 years ago

You should remove https://github.com/GameAnalytics/GA-SDK-GODOT/blob/master/gameanalytics/SCsub#L9 indeed. Godot 3.3 requires C++14.

lentsius-bark commented 3 years ago

I can confirm that removing the mentioned lines works.

the1schwartz commented 3 years ago

Ok thanks. I will try to get the SDK updated soon.

lentsius-bark commented 3 years ago

thanks!