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

fix build with gcc+sanitize #5206

Closed
codesigner opened this issue Jan 5, 2023 · 0 comments
Closed

fix build with gcc+sanitize #5206

codesigner opened this issue Jan 5, 2023 · 0 comments
Assignees
Labels
affects/none PR/issue: this bug affects none version. process/done Process of bug severity/none Severity of bug type/bug Type: something is unexpected
Milestone

Comments

@codesigner
Copy link
Contributor

Please check the FAQ documentation before raising an issue

Describe the bug (required)

Nebula report error while compiling with ASAN enabled:

[ 97%] Building CXX object src/daemons/CMakeFiles/nebula-graphd.dir/SetupBreakpad.cpp.o
[ 97%] Building CXX object src/daemons/CMakeFiles/nebula-graphd.dir/SetupAuditLog.cpp.o
[100%] Linking CXX executable ../../bin/nebula-graphd
/opt/vesoft/toolset/gcc/9.3.0/libexec/gcc/x86_64-vesoft-linux/9.3.0/ld.bfd: ../common/memory/CMakeFiles/memory_obj.dir/NewDelete.cpp.o: in function `operator delete(void*, unsigned long)':
/data/src/nebula-ent/src/common/memory/NewDelete.cpp:93: multiple definition of `operator delete(void*, unsigned long)'; /opt/vesoft/toolset/gcc/9.3.0/lib/gcc/x86_64-vesoft-linux/9.3.0/../../../../lib64/libasan.a(asan_new_delete.o):(.text+0x1480): first defined here
/opt/vesoft/toolset/gcc/9.3.0/libexec/gcc/x86_64-vesoft-linux/9.3.0/ld.bfd: ../common/memory/CMakeFiles/memory_obj.dir/NewDelete.cpp.o: in function `operator new(unsigned long)':
/data/src/nebula-ent/src/common/memory/NewDelete.cpp:32: multiple definition of `operator new(unsigned long)'; /opt/vesoft/toolset/gcc/9.3.0/lib/gcc/x86_64-vesoft-linux/9.3.0/../../../../lib64/libasan.a(asan_new_delete.o):(.text+0x0): first defined here
/opt/vesoft/toolset/gcc/9.3.0/libexec/gcc/x86_64-vesoft-linux/9.3.0/ld.bfd: ../common/memory/CMakeFiles/memory_obj.dir/NewDelete.cpp.o: in function `operator new(unsigned long, std::align_val_t)':
/data/src/nebula-ent/src/common/memory/NewDelete.cpp:37: multiple definition of `operator new(unsigned long, std::align_val_t)'; /opt/vesoft/toolset/gcc/9.3.0/lib/gcc/x86_64-vesoft-linux/9.3.0/../../../../lib64/libasan.a(asan_new_delete.o):(.text+0x6e0): first defined here
/opt/vesoft/toolset/gcc/9.3.0/libexec/gcc/x86_64-vesoft-linux/9.3.0/ld.bfd: ../common/memory/CMakeFiles/memory_obj.dir/NewDelete.cpp.o: in function `operator new[](unsigned long)':
/data/src/nebula-ent/src/common/memory/NewDelete.cpp:42: multiple definition of `operator new[](unsigned long)'; /opt/vesoft/toolset/gcc/9.3.0/lib/gcc/x86_64-vesoft-linux/9.3.0/../../../../lib64/libasan.a(asan_new_delete.o):(.text+0x1d0): first defined here
/opt/vesoft/toolset/gcc/9.3.0/libexec/gcc/x86_64-vesoft-linux/9.3.0/ld.bfd: ../common/memory/CMakeFiles/memory_obj.dir/NewDelete.cpp.o: in function `operator new[](unsigned long, std::align_val_t)':
/data/src/nebula-ent/src/common/memory/NewDelete.cpp:47: multiple definition of `operator new[](unsigned long, std::align_val_t)'; /opt/vesoft/toolset/gcc/9.3.0/lib/gcc/x86_64-vesoft-linux/9.3.0/../../../../lib64/libasan.a(asan_new_delete.o):(.text+0x8c0): first defined here
/opt/vesoft/toolset/gcc/9.3.0/libexec/gcc/x86_64-vesoft-linux/9.3.0/ld.bfd: ../common/memory/CMakeFiles/memory_obj.dir/NewDelete.cpp.o: in function `operator new(unsigned long, std::nothrow_t const&)':
/data/src/nebula-ent/src/common/memory/NewDelete.cpp:52: multiple definition of `operator new(unsigned long, std::nothrow_t const&)'; /opt/vesoft/toolset/gcc/9.3.0/lib/gcc/x86_64-vesoft-linux/9.3.0/../../../../lib64/libasan.a(asan_new_delete.o):(.text+0x3a0): first defined here
/opt/vesoft/toolset/gcc/9.3.0/libexec/gcc/x86_64-vesoft-linux/9.3.0/ld.bfd: ../common/memory/CMakeFiles/memory_obj.dir/NewDelete.cpp.o: in function `operator new[](unsigned long, std::nothrow_t const&)':
/data/src/nebula-ent/src/common/memory/NewDelete.cpp:57: multiple definition of `operator new[](unsigned long, std::nothrow_t const&)'; /opt/vesoft/toolset/gcc/9.3.0/lib/gcc/x86_64-vesoft-linux/9.3.0/../../../../lib64/libasan.a(asan_new_delete.o):(.text+0x540): first defined here
/opt/vesoft/toolset/gcc/9.3.0/libexec/gcc/x86_64-vesoft-linux/9.3.0/ld.bfd: ../common/memory/CMakeFiles/memory_obj.dir/NewDelete.cpp.o: in function `operator new(unsigned long, std::align_val_t, std::nothrow_t const&)':
/data/src/nebula-ent/src/common/memory/NewDelete.cpp:62: multiple definition of `operator new(unsigned long, std::align_val_t, std::nothrow_t const&)'; /opt/vesoft/toolset/gcc/9.3.0/lib/gcc/x86_64-vesoft-linux/9.3.0/../../../../lib64/libasan.a(asan_new_delete.o):(.text+0xaa0): first defined here
/opt/vesoft/toolset/gcc/9.3.0/libexec/gcc/x86_64-vesoft-linux/9.3.0/ld.bfd: ../common/memory/CMakeFiles/memory_obj.dir/NewDelete.cpp.o: in function `operator new[](unsigned long, std::align_val_t, std::nothrow_t const&)':
/data/src/nebula-ent/src/common/memory/NewDelete.cpp:67: multiple definition of `operator new[](unsigned long, std::align_val_t, std::nothrow_t const&)'; /opt/vesoft/toolset/gcc/9.3.0/lib/gcc/x86_64-vesoft-linux/9.3.0/../../../../lib64/libasan.a(asan_new_delete.o):(.text+0xc50): first defined here
/opt/vesoft/toolset/gcc/9.3.0/libexec/gcc/x86_64-vesoft-linux/9.3.0/ld.bfd: ../common/memory/CMakeFiles/memory_obj.dir/NewDelete.cpp.o: in function `operator delete(void*)':
/data/src/nebula-ent/src/common/memory/NewDelete.cpp:73: multiple definition of `operator delete(void*)'; /opt/vesoft/toolset/gcc/9.3.0/lib/gcc/x86_64-vesoft-linux/9.3.0/../../../../lib64/libasan.a(asan_new_delete.o):(.text+0xe00): first defined here
/opt/vesoft/toolset/gcc/9.3.0/libexec/gcc/x86_64-vesoft-linux/9.3.0/ld.bfd: ../common/memory/CMakeFiles/memory_obj.dir/NewDelete.cpp.o: in function `operator delete(void*, std::align_val_t)':
/data/src/nebula-ent/src/common/memory/NewDelete.cpp:78: multiple definition of `operator delete(void*, std::align_val_t)'; /opt/vesoft/toolset/gcc/9.3.0/lib/gcc/x86_64-vesoft-linux/9.3.0/../../../../lib64/libasan.a(asan_new_delete.o):(.text+0x17e0): first defined here
/opt/vesoft/toolset/gcc/9.3.0/libexec/gcc/x86_64-vesoft-linux/9.3.0/ld.bfd: ../common/memory/CMakeFiles/memory_obj.dir/NewDelete.cpp.o: in function `operator delete[](void*)':
/data/src/nebula-ent/src/common/memory/NewDelete.cpp:83: multiple definition of `operator delete[](void*)'; /opt/vesoft/toolset/gcc/9.3.0/lib/gcc/x86_64-vesoft-linux/9.3.0/../../../../lib64/libasan.a(asan_new_delete.o):(.text+0xfa0): first defined here
/opt/vesoft/toolset/gcc/9.3.0/libexec/gcc/x86_64-vesoft-linux/9.3.0/ld.bfd: ../common/memory/CMakeFiles/memory_obj.dir/NewDelete.cpp.o: in function `operator delete[](void*, std::align_val_t)':
/data/src/nebula-ent/src/common/memory/NewDelete.cpp:88: multiple definition of `operator delete[](void*, std::align_val_t)'; /opt/vesoft/toolset/gcc/9.3.0/lib/gcc/x86_64-vesoft-linux/9.3.0/../../../../lib64/libasan.a(asan_new_delete.o):(.text+0x1990): first defined here
/opt/vesoft/toolset/gcc/9.3.0/libexec/gcc/x86_64-vesoft-linux/9.3.0/ld.bfd: ../common/memory/CMakeFiles/memory_obj.dir/NewDelete.cpp.o: in function `operator delete(void*, unsigned long, std::align_val_t)':
/data/src/nebula-ent/src/common/memory/NewDelete.cpp:98: multiple definition of `operator delete(void*, unsigned long, std::align_val_t)'; /opt/vesoft/toolset/gcc/9.3.0/lib/gcc/x86_64-vesoft-linux/9.3.0/../../../../lib64/libasan.a(asan_new_delete.o):(.text+0x1ea0): first defined here
/opt/vesoft/toolset/gcc/9.3.0/libexec/gcc/x86_64-vesoft-linux/9.3.0/ld.bfd: ../common/memory/CMakeFiles/memory_obj.dir/NewDelete.cpp.o: in function `operator delete[](void*, unsigned long)':
/data/src/nebula-ent/src/common/memory/NewDelete.cpp:103: multiple definition of `operator delete[](void*, unsigned long)'; /opt/vesoft/toolset/gcc/9.3.0/lib/gcc/x86_64-vesoft-linux/9.3.0/../../../../lib64/libasan.a(asan_new_delete.o):(.text+0x1630): first defined here
/opt/vesoft/toolset/gcc/9.3.0/libexec/gcc/x86_64-vesoft-linux/9.3.0/ld.bfd: ../common/memory/CMakeFiles/memory_obj.dir/NewDelete.cpp.o: in function `operator delete[](void*, unsigned long, std::align_val_t)':
/data/src/nebula-ent/src/common/memory/NewDelete.cpp:108: multiple definition of `operator delete[](void*, unsigned long, std::align_val_t)'; /opt/vesoft/toolset/gcc/9.3.0/lib/gcc/x86_64-vesoft-linux/9.3.0/../../../../lib64/libasan.a(asan_new_delete.o):(.text+0x2070): first defined here
collect2: error: ld returned 1 exit status
make[3]: *** [bin/nebula-graphd] Error 1
make[2]: *** [src/daemons/CMakeFiles/nebula-graphd.dir/all] Error 2
make[1]: *** [src/daemons/CMakeFiles/nebula-graphd.dir/rule] Error 2
make: *** [nebula-graphd] Error 2

The cmake build flag enabled:

#!/bin/bash

cmake \
    -DENABLE_TESTING=OFF \
    -DENABLE_ASAN=ON \
    -DENABLE_STATIC_ASAN=ON \
    -DCMAKE_BUILD_TYPE=Debug \
    ..

# make -j 24 nebula-metad nebula-storaged nebula-graphd
# make -j 24 nebula-metad nebula-storaged nebula-graphd
make -j 40 nebula-graphd

The error message shows that current Memtracker implementation is conflict with ASAN.

Your Environments (required)

  • OS: uname -a
  • Compiler: g++ --version or clang++ --version
  • CPU: lscpu
  • Commit id (e.g. a3ffc7d8)

How To Reproduce(required)

Steps to reproduce the behavior:

  1. Step 1
  2. Step 2
  3. Step 3

Expected behavior

Additional context

@codesigner codesigner added the type/bug Type: something is unexpected label Jan 5, 2023
@github-actions github-actions bot added affects/none PR/issue: this bug affects none version. severity/none Severity of bug labels Jan 5, 2023
@codesigner codesigner self-assigned this Jan 5, 2023
@Sophie-Xie Sophie-Xie added this to the v3.4.0 milestone Jan 5, 2023
@github-actions github-actions bot added the process/fixed Process of bug label Jan 6, 2023
@HarrisChu HarrisChu added the process/done Process of bug label Jan 9, 2023
@github-actions github-actions bot removed the process/fixed Process of bug label Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects/none PR/issue: this bug affects none version. process/done Process of bug severity/none Severity of bug type/bug Type: something is unexpected
Projects
None yet
Development

No branches or pull requests

3 participants