-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-7605: [C++] Create and install "dependency bundle" static library including jemalloc, mimalloc, and any BUNDLED static library so that static linking to libarrow.a is possible #7696
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
|
The CI failure https://github.com/apache/arrow/pull/7696/checks?check_run_id=855635184 is because ASF JIRA is hurting right now for some reason |
|
@github-actions crossbow submit -g r |
|
Revision: 199af083138858c96f1c7cd8a063b165f3c46a5e Submitted crossbow builds: ursa-labs/crossbow @ actions-395 |
|
@tobim FYI, this approach should be less offensive than what I was doing previously (hacking libarrow.a directly) |
|
@nealrichardson the "test-conda-r-4.0" failure doesn't appear to be related to this patch |
|
Homebrew seems to fail in the jemalloc EP, verbose thirdparty build could reveal more |
|
Linux seems to be working smoothly; I'll poke at macOS autobrew. On mingw, looks like there's an issue compiling mimalloc: https://github.com/apache/arrow/pull/7696/checks?check_run_id=855852766#step:7:2254 |
|
@github-actions crossbow submit homebrew-r-autobrew |
|
Revision: 706e50be600ee8d8ee33cffdb9611720e1dcd05c Submitted crossbow builds: ursa-labs/crossbow @ actions-396
|
|
The mimalloc issue seems to only affect the DLL, which we don't need, so I disabled it |
|
@github-actions crossbow submit homebrew-r-autobrew |
|
Revision: aeb3830e5935904a8a719a4aaf6c8131d2dbc141 Submitted crossbow builds: ursa-labs/crossbow @ actions-397
|
|
@nealrichardson try adding |
|
Confirming the new transitive dependencies from mimalloc: if(WIN32)
list(APPEND mi_libraries psapi shell32 user32 bcrypt)
else()https://github.com/microsoft/mimalloc/blob/master/CMakeLists.txt#L163 |
aeb3830 to
da68e09
Compare
|
I'm having a hard time reading the Homebrew job output -- was the prior failure a flake? |
|
@github-actions crossbow submit homebrew-r-autobrew |
|
Revision: da68e097ad07c0b9036e8175349bad2ba30787be Submitted crossbow builds: ursa-labs/crossbow @ actions-398
|
|
IDK why the first autobrew job failed but the last (third) succeeded. Don't think that turning on verbosity should have fixed it. I think the second one failed because you force-pushed before the crossbow job started. |
|
Windows Rtools builds are green now and autobrew passed again, so should we revert 12c7803, confirm autobrew is still passing, and merge this? |
|
Yes that sounds good. @kou do you have any concerns about this? Let’s wait a bit for more comments |
|
@github-actions crossbow submit -g linux |
|
Revision: da68e097ad07c0b9036e8175349bad2ba30787be Submitted crossbow builds: ursa-labs/crossbow @ actions-399 |
|
Can you apply this patch to synchronize to mimalloc? |
da68e09 to
1f24b9e
Compare
|
@github-actions crossbow submit -g linux |
|
I tried fixing the Linux packages, let's see if this works |
|
Revision: 1f24b9e Submitted crossbow builds: ursa-labs/crossbow @ actions-400 |
|
The one test failure is spurious I verified that the minimal build still works on Linux (presumably it's therefore fine on macOS) and Windows/MSVC |
I still think that For this case my opinion is that non-vendored dependencies should not be bundled. Normally I want use the SYSTEM libraries for dependencies. As a developer of a third-party I do not want arrow to add symbols it does not own to my static linking process. May I suggest a different solution for that aspect of the problem: CMake provides a module for declaring dependencies in the templated _Project_Config.cmake. That allows you to insert your own dependencies to the target graph of the downstream project. |
|
Re: system dependencies and static build, is https://issues.apache.org/jira/browse/ARROW-6312 related? I encountered this issue in https://issues.apache.org/jira/browse/ARROW-9303, and isn't this is a slightly different problem? Because your system dependencies could be shared libraries that you couldn't glue together anyway, right? |
ARROW-6312 is the
Luckily I have control over linking flavor of the libraries on my system search path. |
@tobim our build system does not select static libraries when using If |
|
@github-actions crossbow submit -g linux |
|
Fingers crossed that I've fixed the gRPC bundling problem and the Linux packages work this time |
|
Revision: f43ce46 Submitted crossbow builds: ursa-labs/crossbow @ actions-404 |
This is not true.
That's how it should be then. But by removing |
Sorry, my presumption was that when a system library is installed there is a shared library available. If there is both a shared and static library available for a dependency, the build system is supposed to select the shared one. But you are right if there is only a static library (e.g. if someone created an all-static "system" toolchain), then indeed static libraries would be selected. But they would not be added to
Well, static linking was not possible at all prior to this PR when using the recommended memory allocator (jemalloc). So nothing has been "broken" because it never worked before. The case of external static dependencies isn't tested at all -- in no CI or integration task. If this use case is important to you, we could use your help writing Dockerized integration tests that exhibit this scenario so that we aren't flying blind like we are now. I agree with adding non-bundled static libraries to |
|
+1. Let us address the |
|
I'm fine with that. I'll try to find some time for it tomorrow. |
|
Thanks. I just opened https://issues.apache.org/jira/browse/ARROW-9412 |
This PR is a renewed attempt to address the brokenness of our static libraries and their exported CMake targets.
To summarize what's wrong: if any BUNDLED library source is used, or if the jemalloc or mimalloc allocators are used, then the
libarrow.astatic library that we've been installing is unusable. If someone tries to link with it, they get a linker error looking for the missing dependencies. Additionally, the CMake target names exported forarrow_staticincludes the list of all of these bundled libraries, so even attempting to use thearrow_statictarget does not work since the third party CMake build cannot find the missing dependencies.As one downstream problem caused by this, we've been unable thus far to ship our non-system allocators in packages (R in particular) that do static linking.
Since it is neither safe nor reasonable to expect third party projects to attempt to provide substitute static libraries for the missing dependencies, I have implemented the following:
libarrow_bundled_dependencies.a(andarrow_bundled_dependencies.libwith MSVC). I have verified that this bundle is viable and can be used to create statically linked executablesarrow_static, but I couldn't figure out how to do it.ARROW_LINK_SHAREDoption to cpp/examples/minimal_build/CMakeLists.txt to show how to create statically linked executables using arrow_static and the dependency bundle.Finally, I verified that I can now successfully create statically linked builds now on Linux, macOS, and Windows.