brummer10 / guitarix

guitarix virtual versatile amplification for Jack/Linux
249 stars 26 forks source link

Compile error using gcc-10.3.0 on Ubuntu 21.04 #63

Closed gitterdude closed 3 years ago

gitterdude commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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

orivej commented 3 years ago

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

hfiguiere commented 3 years ago

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