wolfpld / tracy

Frame profiler
https://tracy.nereid.pl/
Other
8.61k stars 592 forks source link

Werror: Tracy capture fails to build with gcc 14 #810

Closed PhilipDeegan closed 2 weeks ago

PhilipDeegan commented 3 weeks ago

standard cmake config via cd capture; mkdir build; cd build; cmake ..; make

In file included from /usr/include/c++/14/atomic:50,
                 from /path/to/git/phare/master/subprojects/tracy/capture/build/_deps/tbb-src/src/tbb/../../include/oneapi/tbb/detail/_utils.h:22,
                 from /path/to/git/phare/master/subprojects/tracy/capture/build/_deps/tbb-src/src/tbb/task_dispatcher.h:20,
                 from /path/to/git/phare/master/subprojects/tracy/capture/build/_deps/tbb-src/src/tbb/arena.cpp:17:
In member function ‘void std::__atomic_base<_IntTp>::store(__int_type, std::memory_order) [with _ITp = bool]’,
    inlined from ‘void std::atomic<bool>::store(bool, std::memory_order)’ at /usr/include/c++/14/atomic:109:20,
    inlined from ‘void tbb::detail::r1::concurrent_monitor_base<Context>::notify_one_relaxed() [with Context = long unsigned int]’ at /path/to/git/phare/master/subprojects/tracy/capture/build/_deps/tbb-src/src/tbb/concurrent_monitor.h:300:53:
/usr/include/c++/14/bits/atomic_base.h:477:25: error: ‘void __atomic_store_1(volatile void*, unsigned char, int)’ writing 1 byte into a region of size 0 overflows the destination [-Werror=stringop-overflow=]
  477 |         __atomic_store_n(&_M_i, __i, int(__m));

gcc

Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/14/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,m2,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-libstdcxx-backtrace --with-libstdcxx-zoneinfo=/usr/share/zoneinfo --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-14.1.1-20240522/obj-x86_64-redhat-linux/isl-install --enable-offload-targets=nvptx-none,amdgcn-amdhsa --enable-offload-defaulted --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux --with-build-config=bootstrap-lto --enable-link-serialization=1
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.1.1 20240522 (Red Hat 14.1.1-4) (GCC) 

tpp cmake config part

--   Package 'tbb', required by 'virtual:world', not found
-- CPM: Adding package tbb@2021.12.0 (v2021.12.0-rc2)
CMake Warning at build/_deps/tbb-src/CMakeLists.txt:119 (message):
  You are building oneTBB as a static library.  This is highly discouraged
  and such configuration is not supported.  Consider building a dynamic
  library to avoid unforeseen issues.
wolfpld commented 3 weeks ago

I can reproduce this, but I can't fix it. TBB is not even a requirement of Tracy, but of gcc / libstdc++, which depends on it to implement parallel STL, but doesn't even try to link with it, leaving the situation to be handled by projects that want to take advantage of parallel algorithms. There is even no way to check whether the STL implementation in use depends on TBB or not. It's a mess.

The recommended way to deal with this is to install TBB through the package manager, so that it can be picked up by pkg-config (which is also not always provided, as far as I can remember, it has to be added manually by distribution packagers), instead of fetching it through CMake and building it manually.

The problem with building is in TBB itself, and there has been no new releases since 2021.12.0, as you can see at https://github.com/oneapi-src/oneTBB/releases.

As a workaround, you can try compiling Tracy with the NO_PARALLEL_SORT define, which disables the use of parallel STL and removes the dependency on TBB. However, this is not currently exposed in the CMake build scripts, so some manual tinkering will be required.

wolfpld commented 3 weeks ago

With d9fe3ed9 you will be able to set NO_PARALLEL_STL.

PhilipDeegan commented 2 weeks ago

sounds like this can be closed so, I haven't checked but I will at some point