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

Compile error using gcc-10.3.0 on Ubuntu 21.04 #63

Closed
gitterdude opened this issue Apr 23, 2021 · 5 comments · Fixed by #67
Closed

Compile error using gcc-10.3.0 on Ubuntu 21.04 #63

gitterdude opened this issue Apr 23, 2021 · 5 comments · Fixed by #67

Comments

@gitterdude
Copy link

I get this when I try to compile the latest git source, 0.28.3-1667-g819c891e
../src/headers/gx_system.h: In instantiation of ‘bool gx_system::atomic_compare_and_exchange(T**, T*, T*) [with T = _jack_session_event]’: ../src/gx_head/engine/gx_jack.cpp:1110:79: required from here /usr/include/glib-2.0/glib/gatomic.h:206:45: warning: invalid conversion from ‘volatile void*’ to ‘void*’ [-fpermissive] 206 | __atomic_compare_exchange_n ((atomic), &gapcae_oldval, (newval), FALSE, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) ? TRUE : FALSE;
and it points to the &gapcae_oldval variable

My C-Fu isn't strong enough to figure out the proper solution but the quick-n-dirty fix was to add -fpermissive to CXXFLAGS in trunk/build/c4che/_cache.py

@brummer10
Copy link
Owner

brummer10 commented Apr 24, 2021

I can't reproduce it here with gcc 10.2 on debian/sid.
But I've seen that the Gnome folks have recently changed the type check for gapcae_oldval.
https://gitlab.gnome.org/GNOME/glib/-/tags/2.67.3
Could you try to edit gx_system.h line 135
change
return g_atomic_pointer_compare_and_exchange(reinterpret_cast<void* volatile*>(p), static_cast<void*>(oldv), newv);
to
return g_atomic_pointer_compare_and_exchange(reinterpret_cast<void* volatile*>(p), static_cast<volatile void*>(oldv), newv);

let me know if that avoid the error.

@brummer10
Copy link
Owner

after checking a bit more it seems that it should become
return g_atomic_pointer_compare_and_exchange(reinterpret_cast<void** >(p), static_cast<void*>(oldv), newv);
so, remove the volatile qualifier
https://github.com/GNOME/glib/blob/master/glib/gatomic.c#L390

@gitterdude
Copy link
Author

Yes, changing void* volatile* to void** made gcc much happier.
Thanks.

hfiguiere added a commit to hfiguiere/guitarix that referenced this issue Apr 25, 2021
brummer10 added a commit that referenced this issue May 1, 2021
@orivej
Copy link

orivej commented May 9, 2021

Apparently this issue was caused not by a gcc update but by glib 2.68.

@hfiguiere
Copy link
Collaborator

hfiguiere commented May 9, 2021

Maybe the std::atomic primitive should be used. I have a WiP patch to remove these g_atomic from the LV2 plugins.

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 a pull request may close this issue.

4 participants