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

sizeof(Butex) == BAIDU_CACHELINE_SIZE static assertion failed #2699

Open
sepcity opened this issue Jul 17, 2024 · 1 comment
Open

sizeof(Butex) == BAIDU_CACHELINE_SIZE static assertion failed #2699

sepcity opened this issue Jul 17, 2024 · 1 comment

Comments

@sepcity
Copy link

sepcity commented Jul 17, 2024

Describe the bug (描述bug)
when i build brpc-1.9.0 on openEuler-22.03SP3 aarch64 i got these errors

/usr/local/gcc-13.3.0/bin/g++ -c -I./src -I/hst/fsp_third_party/output/gflags/include/ -I/hst/fsp_third_party/output/leveldb/include/ -I/hst/fsp_third_party/output/openssl/include/ -I/hst/fsp_third_party/output/protobuf/include/ -I/hst/fsp_third_party/output/zlib/include/ -DGFLAGS_NS=google -fPIC src/bthread/butex.cpp -o src/bthread/butex.o In file included from ./src/butil/atomicops.h:34, from src/bthread/butex.cpp:22: src/bthread/butex.cpp:128:29: error: static assertion failed: butex_fits_in_one_cacheline 128 | BAIDU_CASSERT(sizeof(Butex) == BAIDU_CACHELINE_SIZE, butex_fits_in_one_cacheline); ./src/butil/macros.h:175:48: note: in definition of macro 'BAIDU_CASSERT' 175 | #define BAIDU_CASSERT(expr, msg) static_assert(expr, #msg) | ^~~~ src/bthread/butex.cpp:128:29: note: the comparison reduces to '(128 == 64)' 128 | BAIDU_CASSERT(sizeof(Butex) == BAIDU_CACHELINE_SIZE, butex_fits_in_one_cacheline); ./src/butil/macros.h:175:48: note: in definition of macro 'BAIDU_CASSERT' 175 | #define BAIDU_CASSERT(expr, msg) static_assert(expr, #msg) | ^~~~ make: *** [Makefile:305: src/bthread/butex.o] Error 1

To Reproduce (复现方法)
./config_brpc.sh
make CXXFLAGS="-DGFLAGS_NS=google -fPIC"

Expected behavior (期望行为)
build succeed

Versions (各种版本)
OS:openEuler-22.03SP3
Compiler:gcc-13.3
brpc:1.9.0
protobuf:3.2.0

Additional context/screenshots (更多上下文/截图)

@sepcity
Copy link
Author

sepcity commented Jul 17, 2024

it seems like sizeof(pthread_mutex_t) is 48 bytes on aarch64 but 40 bytes on x86_64

can i define BTHREAD_USE_FAST_PTHREAD_MUTEX to avoid this??

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

1 participant