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

Fails with gcc 12 compiler #611

Closed
marxin opened this issue Jan 17, 2022 · 8 comments
Closed

Fails with gcc 12 compiler #611

marxin opened this issue Jan 17, 2022 · 8 comments
Assignees
Milestone

Comments

@marxin
Copy link

marxin commented Jan 17, 2022

Fails here:
https://build.opensuse.org/package/live_build_log/openSUSE:Factory:Staging:Gcc7/galera-4/standard/x86_64

with:

[  188s] galera_check: galera/tests/../src/key_set.hpp:323: static size_t galera::KeySet::KeyPart::base_size(galera::KeySet::Version, const gu::byte_t*, size_t): Assertion `0' failed.
[  188s] galera_check: galera/tests/../src/key_set.hpp:323: static size_t galera::KeySet::KeyPart::base_size(galera::KeySet::Version, const gu::byte_t*, size_t): Assertion `0' failed.
[  188s] galera_check: galera/tests/../src/key_set.hpp:323: static size_t galera::KeySet::KeyPart::base_size(galera::KeySet::Version, const gu::byte_t*, size_t): Assertion `0' failed.
[  188s] galera_check: galera/tests/../src/key_set.hpp:323: static size_t galera::KeySet::KeyPart::base_size(galera::KeySet::Version, const gu::byte_t*, size_t): Assertion `0' failed.
[  188s] 71%: Checks: 14, Failures: 0, Errors: 4
[  188s] galera/tests/ist_check.cpp:565:E:test_ist_v7:test_ist_v7:0: (after this point) Received signal 6 (Aborted)
[  188s] galera/tests/ist_check.cpp:565:E:test_ist_v8:test_ist_v8:0: (after this point) Received signal 6 (Aborted)
[  188s] galera/tests/ist_check.cpp:565:E:test_ist_v9:test_ist_v9:0: (after this point) Received signal 6 (Aborted)
[  188s] galera/tests/ist_check.cpp:565:E:test_ist_v10:test_ist_v10:0: (after this point) Received signal 6 (Aborted)

It started with the following GCC revision:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=e3ef832a9e8d6a950a439e34e576eb4cb202dc48

which is an optimization for libstdc++.

I bet the root cause are the following warnings:

/home/marxin/Programming/galera/gcache/src/gcache_mem_store.hpp:129:27: warning: pointer ‘bh’ used after ‘void free(void*)’ [-Wuse-after-free]
/home/marxin/Programming/galera/gcache/src/gcache_mem_store.hpp:108:31: warning: pointer ‘bh’ may be used after ‘void* realloc(void*, size_t)’ [-Wuse-after-free]
/home/marxin/Programming/galera/gcache/src/gcache_mem_store.hpp:129:27: warning: pointer ‘bh’ used after ‘void free(void*)’ [-Wuse-after-free]
/home/marxin/Programming/galera/gcache/src/gcache_mem_store.hpp:108:31: warning: pointer ‘bh’ may be used after ‘void* realloc(void*, size_t)’ [-Wuse-after-free]
/home/marxin/Programming/galera/gcache/src/gcache_mem_store.hpp:129:27: warning: pointer ‘bh’ used after ‘void free(void*)’ [-Wuse-after-free]
@ayurchen
Copy link
Member

The warnings are harmless (and arguably wrong) - removal of the pointer from a set, memory is not accessed. But that GCC change seems quite related. Perhaps the warnings appeared as a result of that change.

@temeo
Copy link
Contributor

temeo commented Jan 18, 2022

We are able to reproduce this with gcc/g++ 12 on Fedora 36, but only if SCons is used to build the code. Given that Galera SCons scritps are not actively maintained, it would be better to switch the build to use CMake if possible.

@marxin
Copy link
Author

marxin commented Jan 18, 2022

We are able to reproduce this with gcc/g++ 12 on Fedora 36, but only if SCons is used to build the code. Given that Galera SCons scritps are not actively maintained, it would be better to switch the build to use CMake if possible.

Correct, we cannot build the package with cmake due to:

[   18s] cd /home/abuild/rpmbuild/BUILD/galera-4-26.4.10/build/galerautils/src && /usr/bin/cmake -E cmake_link_script CMakeFiles/galerautils_hw_crc32c.dir/link.txt --verbose=1
[   18s] /usr/bin/cc -fPIC -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g -Wno-implicit-fallthrough -DNDEBUG -Wall -Wextra -g -D_XOPEN_SOURCE=600 -O2 -g -DNDEBUG -flto=auto -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now -shared -Wl,-soname,libgalerautils_hw_crc32c.so -o libgalerautils_hw_crc32c.so CMakeFiles/galerautils_hw_crc32c.dir/gu_crc32c_x86.c.o 
[   18s] /usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: /tmp/ccQgS77t.ltrans0.ltrans.o: in function `gu_crc32c_hardware':
[   18s] /home/abuild/rpmbuild/BUILD/galera-4-26.4.10/galerautils/src/gu_crc32c_x86.c:113: undefined reference to `gu_log'
[   18s] collect2: error: ld returned 1 exit status
[   18s] make[2]: *** [galerautils/src/CMakeFiles/galerautils_hw_crc32c.dir/build.make:100: galerautils/src/libgalerautils_hw_crc32c.so] Error 1
[   18s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/galera-4-26.4.10/build'
[   18s] make[1]: *** [CMakeFiles/Makefile2:1175: galerautils/src/CMakeFiles/galerautils_hw_crc32c.dir/all] Error 2
[   18s] make[1]: *** Waiting for unfinished jobs....
[   18s] make[2]: Entering directory '/home/abuild/rpmbuild/BUILD/galera-4-26.4.10/build'
[   18s] [  3%] Linking C executable wsrep_test

https://bugzilla.suse.com/show_bug.cgi?id=1194827

@temeo
Copy link
Contributor

temeo commented Jan 18, 2022

https://bugzilla.suse.com/show_bug.cgi?id=1194827

Is there a link to complete build log containing this error?

@marxin
Copy link
Author

marxin commented Jan 18, 2022

Is there a link to complete build log containing this error?

Sure, I built it locally and complete build log is here:
https://gist.githubusercontent.com/marxin/03f0d8eb8ffd6030334e85b00cbd7b1a/raw/52c0ca1a129ed6e5292e1ad53b24636701320eaa/gistfile1.txt

@temeo
Copy link
Contributor

temeo commented Jan 18, 2022

The build failure is caused by -DBUILD_SHARED_LIBS:BOOL=ON, which I believe comes from build system. With this build option defined, the intermediate libraries must be added explicitly as STATIC in order to build to work. Additionally there is a cyclic dependency between galerautils and crc32c HW libs in galerautils/src/CMakeLists.txt.

The attached patch made the build pass for me

gh-611.txt

@temeo temeo self-assigned this Jan 18, 2022
@temeo temeo added this to the 3.36, 4.11 milestone Jan 18, 2022
@marxin
Copy link
Author

marxin commented Jan 18, 2022

Thanks, I can confirm the patch fixed cmake build for me.

@temeo
Copy link
Contributor

temeo commented Feb 23, 2022

Fixed in 4.11

@temeo temeo closed this as completed Feb 23, 2022
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

No branches or pull requests

3 participants