Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do no include glib.h with extern C #2972

Merged
merged 1 commit into from
Mar 9, 2021

Conversation

ivaradi
Copy link
Contributor

@ivaradi ivaradi commented Mar 6, 2021

Compilation fails on Hirsute with errors like:

In file included from /usr/include/glib-2.0/glib/gatomic.h:31,
                 from /usr/include/glib-2.0/glib/gthread.h:32,
                 from /usr/include/glib-2.0/glib/gasyncqueue.h:32,
                 from /usr/include/glib-2.0/glib.h:32,
                 from /<<PKGBUILDDIR>>/src/gui/cloudproviders/cloudprovidermanager.cpp:16:
/usr/include/c++/10/type_traits:56:3: error: template with C linkage
   56 |   template<typename _Tp, _Tp __v>
      |   ^~~~~~~~
/<<PKGBUILDDIR>>/src/gui/cloudproviders/cloudprovidermanager.cpp:15:1: note: ‘extern "C"’ linkage started here
   15 | extern "C" {
      | ^~~~~~~~~~

This is due to glib/gatomic.h now including <type_traits> when being compiled with C++. I think glib.h and similar headers can be safely included into C++ code without extern "C" nowadays. Hence this patch removes it from cloudprovidermanager.cpp.

Signed-off-by: István Váradi <[email protected]>
@ivaradi ivaradi requested a review from FlexW March 9, 2021 09:29
@nextcloud-desktop-bot
Copy link

AppImage file: Nextcloud-PR-2972-db321d25ef65cc75d9fa1970e9eb09d33f7b9ca4-x86_64.AppImage

To test this change/fix you can simply download above AppImage file and test it.

Please make sure to quit your existing Nextcloud app and backup your data.

@FlexW
Copy link

FlexW commented Mar 9, 2021

Thank you for that fix. According to here https://gitlab.gnome.org/GNOME/glib/-/issues/2331 it is even not supported to compile with extern C.

@ivaradi ivaradi merged commit 17e27ce into nextcloud:master Mar 9, 2021
@ivaradi ivaradi deleted the no-externc-glib branch March 9, 2021 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants