Skip to content

Commit

Permalink
Inherit cmocka after c++ system headers due to symbol conflicts
Browse files Browse the repository at this point in the history
LLVM alternative C++ standard library is happier if it can hide its own
symbols first without preprocessor macros complicating things.

FAILED: amdgpu.p/tests_test_amdgpu.cpp.o
clang++ -Iamdgpu.p -I. -I.. -I../include -I../subprojects/spdlog-1.14.1/include -Isubprojects/implot-0.16 -I../subprojects/implot-0.16 -Isubprojects/imgui-1.89.9 -I../subprojects/imgui-1.89.9 -I../subprojects/imgui-1.89.9/backends -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c++14 -O3 -Werror=missing-declarations -Werror=return-type -Wno-unused-parameter -Qunused-arguments -fno-math-errno -fno-trapping-math -Wno-non-virtual-dtor -Wno-missing-field-initializers -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS '-DPACKAGE_VERSION="v0.7.2"' -DSPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_DEBUG -D_GNU_SOURCE -DHAVE_PTHREAD -DUSE_GCC_ATOMIC_BUILTINS -DHAVE_TIMESPEC_GET -DHAVE___BUILTIN_BSWAP32 -DHAVE___BUILTIN_BSWAP64 -DHAVE___BUILTIN_CLZ -DHAVE___BUILTIN_CLZLL -DHAVE___BUILTIN_CTZ -DHAVE___BUILTIN_EXPECT -DHAVE___BUILTIN_FFS -DHAVE___BUILTIN_FFSLL -DHAVE___BUILTIN_POPCOUNT -DHAVE___BUILTIN_POPCOUNTLL -DHAVE___BUILTIN_UNREACHABLE -O2 -pipe '-DIMGUI_API=__attribute__((visibility("default")))' -pthread -DSPDLOG_COMPILED_LIB -DTEST_ONLY -MD -MQ amdgpu.p/tests_test_amdgpu.cpp.o -MF amdgpu.p/tests_test_amdgpu.cpp.o.d -o amdgpu.p/tests_test_amdgpu.cpp.o -c ../tests/test_amdgpu.cpp
In file included from ../tests/test_amdgpu.cpp:9:
In file included from ../tests/../src/amdgpu.h:6:
In file included from ../tests/../src/overlay_params.h:6:
In file included from /usr/include/c++/v1/vector:3023:
In file included from /usr/include/c++/v1/locale:212:
/usr/include/c++/v1/ios:343:30: error: expected parameter declarator
  343 |   _LIBCPP_HIDE_FROM_ABI bool fail() const;
      |                              ^
/usr/include/cmocka.h:1616:22: note: expanded from macro 'fail'
 1616 | #define fail() _fail(__FILE__, __LINE__)
      |                      ^
<scratch space>:2:1: note: expanded from here
    2 | "/usr/include/c++/v1/ios"

Signed-off-by: Alfred Wingate <parona@protonmail.com>
  • Loading branch information
parona-source committed Dec 26, 2024
1 parent 579d79c commit 49a6501
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/test_amdgpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
#include <stddef.h>
#include <setjmp.h>
#include <stdint.h>
#include "stdio.h"
#include "../src/amdgpu.h"
// cmocka and libc++ have clashing symbols which causes issues if the symbols
// are defined before libc++ can hide its own with _LIBCPP_HIDE_FROM_ABI.
extern "C" {
#include <cmocka.h>
}
#include "stdio.h"
#include "../src/amdgpu.h"

#define UNUSED(x) (void)(x)

Expand Down

0 comments on commit 49a6501

Please sign in to comment.