-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Optionally support using the system-installed libunwind #17164
Conversation
Ah, I can see what's causing it to not to find the headers when there is no libunwind-dev package installed. I have forgotten that the libunwind.h is a generated file and as such, it lives in the binary directories. So that folder needs to be added to include paths too.
I understand that it makes sense in the case our stuff is built as a native package for a distro. |
Yes, when a distro builds .NET Core from source, they should be able to depend on their build of libunwind and not have it duplicated in our runtime binaries. |
When I was looking through those feature checks, there was a mix of items. Some checks looked safe to eliminate for the bundled copy of libunwind ( I see that the tizen build failed. Is a known failure or something specific to my changes? |
@omajid actually, the tests should be included in all cases, as you've indicated. I was not thinking right on Friday night. I am preparing a fix. |
As for the Tizen, it seems to be broken now. |
src/pal/src/CMakeLists.txt
Outdated
|
||
add_compile_options(-fPIC) | ||
|
||
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin) | ||
if(NOT CLR_USE_SYSTEM_LIBUNWIND) |
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.
A nit - could you please rename the symbol to CLR_CMAKE_USE_SYSTEM_LIBUNWIND? We have other symbols that we pass to cmake from our build and they are all named with CLR_CMAKE prefix, so it would be good to keep the convention.
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.
Sorry, I didn't realize the convention. Fixed now.
This allows coreclr to link against a system-installed libunwind instead of using the copy included with the coreclr sources. The default is still to use the bundled version, except on macOS, where we always use the system-installed version. Many Linux distributions prefer to avoid bundled libraries as much as possible. For their reasons, please see: - https://fedoraproject.org/wiki/Bundled_Libraries - https://wiki.debian.org/UpstreamGuide#No_inclusion_of_third_party_code - https://wiki.gentoo.org/wiki/Why_not_bundle_dependencies
25c8bdd
to
53b208a
Compare
Thank you! |
No problem. Happy to scratch my own itch :) And thanks for the prompt reviews and feedback! |
@dotnet-bot test Ubuntu x64 Checked Innerloop Build and Test please |
This allows coreclr to link against a system-installed
libunwind
instead of using the copy included with the coreclr sources.The default is still to use the bundled version, except on macOS, where we always use the system-installed version.
Many Linux distributions prefer to avoid bundled libraries as much as possible. For their reasons, please see:
One thing to note is that this removes the
include_directories(libunwind/include)
call on macOS. It doesn't make sense to me to try and use the bundled include headers but link against the system library. I can revert this change if that doesn't make sense.This change also doesn't mark the new flag as an
OPTION
. I need to look into that. In the meantime, I have been using./build.sh -cmakeargs -DCLR_USE_SYSTEM_LIBUNWIND=1
Other things I found while implementing this:
#include <libunwind.h>
(unconditionally). Iflibunwind-devel
(or similar) is not installed, they simply don't find libunwind headers and the configure tests fail. If they do find the headers, they can't find a libunwind to link against and stiil fail. IMO, they should be fixed to find the bundled copy and test against that (after that bundled libunwind is build).libunwind-devel
from my system, the build fails at compilingseh-unwind.cpp
Neither of these is affected by this change.
cc @janvorli @jkotas