-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-7605: [C++] Bundle private jemalloc symbols into static library libarrow.a #6220
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
Conversation
|
Should we do this for all bundled dependencies in a static build? See also https://github.com/apache/arrow/blob/master/r/inst/build_arrow_static.sh#L93-L95 |
|
@nealrichardson it would indeed make linking for third parties much easier. One problem with doing this for other external dependencies is that they may be part of a larger static library toolchain. As an example, consider an application that uses On the other hand, there's nothing harmful about bundling libjemalloc_pic.a because these symbols are exclusive to Arrow |
|
That being said it might not be a bad idea to have an optional build option to generate a |
|
Right, but if we're building it in the arrow build process (ARROW_DEPENDENCY_SOURCE=bundled), no one else is using the one we build. And in fact we can't use the static arrow library we build unless we fish those dependencies out of the |
|
@nealrichardson yes, I agree that when we use the |
kou
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this break any packaging builds?
RPM build will be broken because we install new files. We need to update install file list: https://github.com/apache/arrow/blob/master/dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in#L239
How does this affect the
INSTALLCMake commands (andArrowTargets.cmake, etc.)? Ideally we want people to be able to use Arrow as a dependency in other CMake projects and for things to Just Work
It affects nothing. arrow_static in ArrowTargets.cmake still doesn't work.
arrow_static has INTERFACE_LINK_LIBRARIES property and it includes jemalloc::jemalloc and mimalloc::mimalloc. But we don't provide jemalloc::jemalloc and minmalloc::minmalloc yet. We need to provide these targets to ArrowTargets.cmake to support arrow_static.
cpp/src/arrow/CMakeLists.txt
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following will be better because we can use both jemalloc and mimalloc at the same time.
set(ARROW_BUNDLE_STATIC_LIBS)
if(ARROW_JEMALLOC)
list(APPEND ARROW_BUNDLE_STATIC_LIBS jemalloc::jemalloc)
endif()
if(ARROW_MIMALLOC)
list(APPEND ARROW_BUNDLE_STATIC_LIBS mimalloc::mimalloc)
endif()
cpp/cmake_modules/BuildUtils.cmake
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to lib.exe instead of libtool on Windows, right?
We will be able to use ${CMAKE_LINKER} on MSVC case: set(BUNDLE_TOOL ${CMAKE_LINKER})
cpp/cmake_modules/BuildUtils.cmake
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about _plain or _raw?
|
I'll take another turn on this tomorrow (Monday). I will see if I can assemble a list of all bundled libraries (not just jemalloc/mimalloc) to merge into libarrow.a. |
|
We'll have to tackle this more completely after 0.16.0 rather than rush something through right now. |
cpp/cmake_modules/BuildUtils.cmake
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a comment saying what this does and why? This is a potential future head scratcher for whoever will debug this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I certainly will
2300884 to
1cb9745
Compare
|
I'm going to clean this up as soon as I can and try to include any BUNDLED dependencies in libarrow.a |
1cb9745 to
b57ee51
Compare
|
Bundling jemalloc into Did you consider directly adding the object files from jemalloc to the list of source files of libarrow? The approach is described on Stackoverflow. Another alternative is to install the custom jemalloc.a. Here is a patch that outlines that approach (This does not take care of |
|
@tobim you're welcome to propose an alternative solution and demonstrate how third party applications would be expected to statically link. Since we have install both CMake targets and pkg-config there's a number of things to test |
|
Closing this PR for now. Hopefully someone can pick up this project |
|
This work has been superseded by #7696 |
If something like this is not done, then
libarrow.acannot be used without obtaining the exactlibjemalloc_pic.athat we build privately.Open questions I need help with
INSTALLCMake commands (andArrowTargets.cmake, etc.)? Ideally we want people to be able to use Arrow as a dependency in other CMake projects and for things to Just Work