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

[Go] Apache Arrow 12.0.1: use of deleted function 'std::atomic<long int>::atomic(const std::atomic<long int>&)' #37442

Closed
EXPEbdodla opened this issue Aug 29, 2023 · 3 comments

Comments

@EXPEbdodla
Copy link

EXPEbdodla commented Aug 29, 2023

Describe the bug, including details regarding any error messages, version, and platform.

We are compiling go code to so file using go build module. Detailed Trace log information is below

go build -mod=mod -buildmode=c-shared -tags cgo,ccalloc -o embedded_go.so . this command generates following error (Tried go v8/ v12 versions):

--
cmd had error: exit status 2  output:
# github.com/apache/arrow/go/v8/arrow/memory/internal/cgoalloc
In file included from allocator.cc:21:
/usr/include/arrow/memory_pool.h:72:43: error: use of deleted function 'std::atomic<long int>::atomic(const std::atomic<long int>&)'
72 \|   std::atomic<int64_t> bytes_allocated_ = 0;
\|                                           ^
In file included from /usr/include/arrow/memory_pool.h:20:
/usr/include/c++/12/atomic:877:7: note: declared here
877 \|       atomic(const atomic&) = delete;
\|       ^~~~~~
/usr/include/c++/12/atomic:881:17: note:   after user-defined conversion: 'constexpr std::atomic<long int>::atomic(__integral_type)'
881 \|       constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { }
\|                 ^~~~~~
/usr/include/arrow/memory_pool.h:73:38: error: use of deleted function 'std::atomic<long int>::atomic(const std::atomic<long int>&)'
73 \|   std::atomic<int64_t> max_memory_ = 0;
\|                                      ^
/usr/include/c++/12/atomic:877:7: note: declared here
877 \|       atomic(const atomic&) = delete;
\|       ^~~~~~
/usr/include/c++/12/atomic:881:17: note:   after user-defined conversion: 'constexpr std::atomic<long int>::atomic(__integral_type)'
881 \|       constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { }
\|                 ^~~~~~
/usr/include/arrow/memory_pool.h:74:49: error: use of deleted function 'std::atomic<long int>::atomic(const std::atomic<long int>&)'
74 \|   std::atomic<int64_t> total_allocated_bytes_ = 0;
\|                                                 ^
/usr/include/c++/12/atomic:877:7: note: declared here
877 \|       atomic(const atomic&) = delete;
\|       ^~~~~~
/usr/include/c++/12/atomic:881:17: note:   after user-defined conversion: 'constexpr std::atomic<long int>::atomic(__integral_type)'
881 \|       constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { }
\|                 ^~~~~~
/usr/include/arrow/memory_pool.h:75:38: error: use of deleted function 'std::atomic<long int>::atomic(const std::atomic<long int>&)'
75 \|   std::atomic<int64_t> num_allocs_ = 0;
\|                                      ^
/usr/include/c++/12/atomic:877:7: note: declared here
877 \|       atomic(const atomic&) = delete;
\|       ^~~~~~
/usr/include/c++/12/atomic:881:17: note:   after user-defined conversion: 'constexpr std::atomic<long int>::atomic(__integral_type)'
881 \|       constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { }
\|                 ^~~~~~

Component(s)

Go

@kou kou changed the title Apache Arrow 12.0.1: use of deleted function 'std::atomic<long int>::atomic(const std::atomic<long int>&)' [C++] Apache Arrow 12.0.1: use of deleted function 'std::atomic<long int>::atomic(const std::atomic<long int>&)' Aug 30, 2023
@kou kou changed the title [C++] Apache Arrow 12.0.1: use of deleted function 'std::atomic<long int>::atomic(const std::atomic<long int>&)' [Go] Apache Arrow 12.0.1: use of deleted function 'std::atomic<long int>::atomic(const std::atomic<long int>&)' Aug 30, 2023
@zeroshade
Copy link
Member

Hmm, this looks like the issue is caused by the version of C++ being utilized by the compiler. The cgoalloc uses the Arrow C++ library memory pool to perform allocations via the allocator and includes arrow/memory_pool.h which expects C++17 or greater to compile.

Alternately you could remove the ccalloc tag and use https://pkg.go.dev/github.com/apache/arrow/go/[email protected]/arrow/memory/mallocator which is just a simple implementation of the memory.Allocator which uses malloc directly rather than calling out to the Arrow C++ library. It should also alleviate your compile error issue.

@EXPEbdodla
Copy link
Author

Thanks @zeroshade . I'm able to run locally on Mac with mallocator which was failing to build with CGO Allocator. Are there any performance benchmarks between CGOAllocator and Mallocator? Thank you.

@zeroshade
Copy link
Member

@EXPEbdodla I haven't performed any benchmarks myself to compare them. But i would welcome some if you were to perform any! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants