Commit Graph

396 Commits

Author SHA1 Message Date
Med Ismail Bennani 797b50d4be Revert "Use `GNUInstallDirs` to support custom installation dirs. -- LLVM"
This reverts commit 6fd2db04d0 since it
broke GreenDragon LLDB-Incremental bot:

https://green.lab.llvm.org/green/job/lldb-cmake/37560/console

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-11-02 19:11:44 +01:00
John Ericson 6fd2db04d0 Use `GNUInstallDirs` to support custom installation dirs. -- LLVM
This is a new draft of D28234. I previously did the unorthodox thing of
pushing to it when I wasn't the original author, but since this version

- Uses `GNUInstallDirs`, rather than mimics it, as the original author
  was hesitant to do but others requested.

- Is much broader, effecting many more projects than LLVM itself.

I figured it was time to make a new revision.

I am using this patch (and many back-ports) as the basis of
https://github.com/NixOS/nixpkgs/pull/111487 for my distro (NixOS). It
looked like people were generally on board in D28234, but I make note of
this here in case extra motivation is useful.

---

As pointed out in the original issue, a central tension is that LLVM
already has some partial support for these sorts of things. For example
`LLVM_LIBDIR_SUFFIX`, or `COMPILER_RT_INSTALL_PATH`. Because it's not
quite clear yet what to do about those, we are holding off on changing
libdirs and `compiler-rt`. for this initial PR.

---

On the advice of @lebedev.ri, I am splitting this up a bit per
subproject, starting with LLVM. To allow it to be more easily reviewed. This and the subsequent patch must be landed together, as this will not build alone. But the rest can be landed on their own.

Reviewed By: compnerd

Differential Revision: https://reviews.llvm.org/D100810
2021-11-02 10:23:30 -04:00
Dave Lee 65dae8b2f2 [lldb] Configure CMake policy CMP0116 for standalone builds
Using CMake >=3.20 results in many warnings about this new policy. This change silences the warnings by explicitly declaring use of the "OLD" behavior.

This applies D101083 to LLDBStandalone.cmake.

Differential Revision: https://reviews.llvm.org/D112497
2021-10-25 16:29:36 -07:00
Siger Yang 6de63b3ba5 [lldb/lua] Force Lua version to be 5.3
Due to CMake cache, find_package in FindLuaAndSwig.cmake
will be ignored. This commit adds EXACT and REQUIRED flags
to it and removes find_package in Lua ScriptInterpreter.

Signed-off-by: Siger Yang <sigeryeung@gmail.com>

Reviewed By: tammela, JDevlieghere

Differential Revision: https://reviews.llvm.org/D108515
2021-10-12 21:34:15 +08:00
Alfonso Gregory a2c319fdc6 [LLVM][CMake][NFC] Resolve FIXME: Rename LLVM_CMAKE_PATH to LLVM_CMAKE_DIR throughout the project
This way, we do not need to set LLVM_CMAKE_PATH to LLVM_CMAKE_DIR when (NOT LLVM_CONFIG_FOUND)

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D107717
2021-09-16 18:29:57 +02:00
Siger Yang 49229bb92b Revert "[lldb/lua] Force Lua version to be 5.3"
This commit causes buildbot failures if SWIG is available but Lua is
not present.

This reverts commit 7bb42dc6b1.
2021-09-03 17:31:25 +08:00
Siger Yang 7bb42dc6b1 [lldb/lua] Force Lua version to be 5.3
Due to CMake cache, find_package in FindLuaAndSwig.cmake
will be ignored. This commit adds EXACT and REQUIRED flags
to it and removes find_package in Lua ScriptInterpreter.

Signed-off-by: Siger Yang <sigeryeung@gmail.com>

Reviewed By: tammela, JDevlieghere

Differential Revision: https://reviews.llvm.org/D108515
2021-09-03 15:22:57 +08:00
Michał Górny 614c7d0387 [lldb] [cmake] Add LLVM_LIT_ARGS override support for standalone builds
Add a LLVM_LIT_ARGS cached variable in order to make it possible
to override lit arguments when doing standalone builds.  Without that,
the user variable is ignored and the default options are always used.

Based on a similar solution found in clang.

Differential Revision: https://reviews.llvm.org/D107700
2021-08-09 23:36:01 +02:00
Neal Sidhwaney 55fd6f292f Revert "D106035: Remove conditional compilation for WCHAR support in libedit"
This reverts commit 7529f0e3e1.
2021-08-05 02:55:10 -07:00
Neal Sidhwaney 7529f0e3e1 D106035: Remove conditional compilation for WCHAR support in libedit
This change moves to using narrow character types and libedit APIs in
Editline, because those are the same types that the rest of LLVM/LLDB
uses, and it's generally considered better practice to use UTF-8
encoded in char than it is to use wider characters. However, for
character input, the change leaves in using a wchar to enable input of
multi-byte characters.

Differential Revision: https://reviews.llvm.org/D106035
2021-08-05 00:29:54 -07:00
Nico Weber bf3383501f [lldb] Get rid of HAVE_SYS_TYPES_H
LLVM includes this header unconditionally on all platforms
(including Windows), so this define should no longer be necessary.

No behavior change.

Differential Revision: https://reviews.llvm.org/D107338
2021-08-03 22:14:56 +02:00
Nico Weber 82dc463bb3 [lldb] Get rid of HAVE_SIGACTION
The .cpp file uses SIGNAL_POLLING_UNSUPPORTED to guard the call
to sigaction, so use it in the .h file too. (LLVM also calls
sigaction without a guard on non-Windows.)

No behavior change.

Differential Revision: https://reviews.llvm.org/D107255
2021-08-02 20:11:35 +02:00
Richard Howell 969eefd98e [lldb] add LLDB_SKIP_DSYM option
Add an option to skip generating a dSYM when installing the LLDB framework on Darwin.

Reviewed By: smeenai

Differential Revision: https://reviews.llvm.org/D103124
2021-05-26 09:32:59 -07:00
Shoaib Meenai 015d78a25e [lldb] Remove XPCServices symlinking
This is a downstream change that was accidentally included upstream.

Reviewed By: vsk

Differential Revision: https://reviews.llvm.org/D97701
2021-03-01 11:23:46 -08:00
Jonas Devlieghere cb6d53ccdc [lldb] Bump the required SWIG version to 3
Bump the required SWIG version to 3. If my memory serves me well we last
bumped the required SWIG version to 2 for Python 3. At that time SWIG 3
had already been around for a while so everyone I know was already using
that.

It appears that SWIG 3 is the only version that officially supports
C++11 which we're using in the typemap. SWIG 3 was released in 2014 so I
think it's reasonable to make that the minimum required version.

https://bugs.llvm.org/show_bug.cgi?id=48685

Differential revision: https://reviews.llvm.org/D94244
2021-01-08 08:47:21 -08:00
Christopher Tetreault 26459e6d8e Fix "Unknown arguments specified" to if in lldb
Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D89807
2020-10-21 07:24:53 -07:00
Sylvestre Ledru 0784e17f1b Remove .svn from exclude list as we moved to git
Reviewed By: emaste

Differential Revision: https://reviews.llvm.org/D89859
2020-10-21 16:09:21 +02:00
Jonas Devlieghere c565f09f4b [lldb] Don't strip LLDB.framework on install
The framework build will run dsymutil after LLDB.framework is installed.
2020-10-20 18:16:36 -07:00
Pavel Labath d4a7c70751 [lldb] Add a cmake warning about the python/swig incompatibility
Raise awareness of the fact that some versions of swig and python (and
build types) just don't mix.

One day this will be a reason to require swig>=4.0, but this version is
too hot off the press right now..

Differential Revision: https://reviews.llvm.org/D88967
2020-10-08 18:42:50 +02:00
Pavel Labath 3dfb949861 [lldb] Check for and use ptsname_r if available
ptsname is not thread-safe. ptsname_r is available on most (but not all)
systems -- use it preferentially.

In the patch I also improve the thread-safety of the ptsname fallback
path by wrapping it in a mutex. This should guarantee the safety of a
typical ptsname implementation using a single static buffer, as long as
all callers go through this function.

I also remove the error arguments, as the only way this function can
fail is if the "primary" fd is not valid. This is a programmer error as
this requirement is documented, and all callers ensure that is the case.

Differential Revision: https://reviews.llvm.org/D88728
2020-10-07 15:29:29 +02:00
Raphael Isemann ce4d15fe14 [lldb] Symlink the Clang resource directory to the LLDB build directory in standalone builds
When doing a standalone build (i.e., building just LLDB against an existing
LLVM/Clang installation), LLDB is currently unable to find any Clang resource
directory that contains all the builtin headers we need to parse real source
code. This causes several tests that actually parse source code on disk within
the expression parser to fail (most notably nearly all the import-std-module
tests).

The reason why LLDB can't find the resource directory is that we search based on
the path of the LLDB shared library path. We assumed that the Clang resource
directory is in the same prefix and has the same relative path to the LLDB
shared library (e.g., `../clang/10.0.0/include`). However for a standalone build
where the existing Clang can be anywhere on the disk, so we can't just rely on
the hardcoded relative paths to the LLDB shared library.

It seems we can either solve this by copying the resource directory to the LLDB
installation, symlinking it there or we pass the path to the Clang installation
to the code that is trying to find the resource directory. When building the
LLDB framework we currently copy the resource directory over to the framework
folder (this is why the import-std-module are not failing on the Green Dragon
standalone bot).

This patch symlinks the resource directory of Clang into the LLDB build
directory. The reason for that is simply that this is only needed when running
LLDB from the build directory. Once LLDB and Clang/LLVM are installed the
already existing logic can find the Clang resource directory by searching
relative to the LLDB shared library.

Reviewed By: kastiglione, JDevlieghere

Differential Revision: https://reviews.llvm.org/D88581
2020-10-06 09:28:39 +02:00
Jonas Devlieghere e0b220d22e [lldb] Remove redundant call to FindBacktrace (NFC)
We're not using any of the Backtrace_* CMake variables set by
FindBacktrace in LLDB.
2020-08-20 22:41:49 -07:00
Jonas Devlieghere c1bc4fb95e [lldb] Simplify CMake logic with LLVM's append_if function
Use the append_if CMake function from HandleLLVMOptions. Since we
include this file in LLDBStandalone it should work in both for in-tree
and out-of-tree builds.
2020-08-20 22:35:31 -07:00
Jonas Devlieghere 75966ee241 [lldb] Get rid of helper CMake variables for Python
This patch is a big sed to rename the following variables:

  s/PYTHON_LIBRARIES/Python3_LIBRARIES/g
  s/PYTHON_INCLUDE_DIRS/Python3_INCLUDE_DIRS/g
  s/PYTHON_EXECUTABLE/Python3_EXECUTABLE/g
  s/PYTHON_RPATH/Python3_RPATH/g

I've also renamed the CMake module to better express its purpose and for
consistency with FindLuaAndSwig.

Differential revision: https://reviews.llvm.org/D85976
2020-08-17 08:47:52 -07:00
Jonas Devlieghere ce439cb1c9 [lldb] Remove Python 2 fallback and only support Python 3
This removes the fallback to Python 2 and makes Python 3 the only
supported configuration. This is the first step to fully migrate to
Python 3 over the coming releases as discussed on the mailing list.

http://lists.llvm.org/pipermail/lldb-dev/2020-August/016388.html

As a reminder, for the current release the test suite and the generated
bindings should remain compatible with Python 2.

Differential revision: https://reviews.llvm.org/D85942
2020-08-14 08:50:11 -07:00
Vedant Kumar d49aedd315 Build a flat LLDB.framework for embedded Darwin targets
This patch configures LLDB.framework to build as a flat unversioned
framework on non-macOS Darwin targets, which have never supported the
macOS framework layout.

This patch also renames the 'IOS' cmake variable to 'APPLE_EMBEDDED' to
reflect the fact that lldb is built for several different kinds of embedded
Darwin targets, not just iOS.

Differential Revision: https://reviews.llvm.org/D85770
2020-08-12 13:34:29 -07:00
Petr Hosek 31e5f7120b [CMake] Simplify CMake handling for zlib
Rather than handling zlib handling manually, use find_package from CMake
to find zlib properly. Use this to normalize the LLVM_ENABLE_ZLIB,
HAVE_ZLIB, HAVE_ZLIB_H. Furthermore, require zlib if LLVM_ENABLE_ZLIB is
set to YES, which requires the distributor to explicitly select whether
zlib is enabled or not. This simplifies the CMake handling and usage in
the rest of the tooling.

This is a reland of abb0075 with all followup changes and fixes that
should address issues that were reported in PR44780.

Differential Revision: https://reviews.llvm.org/D79219
2020-08-11 20:22:11 -07:00
Petr Hosek a4d78d23c5 Revert "[CMake] Simplify CMake handling for zlib"
This reverts commit ccbc1485b5 which
is still failing on the Windows MLIR bots.
2020-08-08 17:08:23 -07:00
Petr Hosek ccbc1485b5 [CMake] Simplify CMake handling for zlib
Rather than handling zlib handling manually, use find_package from CMake
to find zlib properly. Use this to normalize the LLVM_ENABLE_ZLIB,
HAVE_ZLIB, HAVE_ZLIB_H. Furthermore, require zlib if LLVM_ENABLE_ZLIB is
set to YES, which requires the distributor to explicitly select whether
zlib is enabled or not. This simplifies the CMake handling and usage in
the rest of the tooling.

This is a reland of abb0075 with all followup changes and fixes that
should address issues that were reported in PR44780.

Differential Revision: https://reviews.llvm.org/D79219
2020-08-08 16:44:08 -07:00
Christian Kühnel f3cc4df51d Revert "[CMake] Simplify CMake handling for zlib"
This reverts commit 1adc494bce.
This patch broke the Windows compilation on buildbot and pre-merge testing:
http://lab.llvm.org:8011/builders/mlir-windows/builds/5945
https://buildkite.com/llvm-project/llvm-master-build/builds/780
2020-08-07 09:36:49 +02:00
Petr Hosek 1adc494bce [CMake] Simplify CMake handling for zlib
Rather than handling zlib handling manually, use find_package from CMake
to find zlib properly. Use this to normalize the LLVM_ENABLE_ZLIB,
HAVE_ZLIB, HAVE_ZLIB_H. Furthermore, require zlib if LLVM_ENABLE_ZLIB is
set to YES, which requires the distributor to explicitly select whether
zlib is enabled or not. This simplifies the CMake handling and usage in
the rest of the tooling.

This is a reland of abb0075 with all followup changes and fixes that
should address issues that were reported in PR44780.

Differential Revision: https://reviews.llvm.org/D79219
2020-08-05 16:07:11 -07:00
Hans Wennborg 3ab01550b6 Revert "[CMake] Simplify CMake handling for zlib"
This quietly disabled use of zlib on Windows even when building with
-DLLVM_ENABLE_ZLIB=FORCE_ON.

> Rather than handling zlib handling manually, use find_package from CMake
> to find zlib properly. Use this to normalize the LLVM_ENABLE_ZLIB,
> HAVE_ZLIB, HAVE_ZLIB_H. Furthermore, require zlib if LLVM_ENABLE_ZLIB is
> set to YES, which requires the distributor to explicitly select whether
> zlib is enabled or not. This simplifies the CMake handling and usage in
> the rest of the tooling.
>
> This is a reland of abb0075 with all followup changes and fixes that
> should address issues that were reported in PR44780.
>
> Differential Revision: https://reviews.llvm.org/D79219

This reverts commit 10b1b4a231 and follow-ups
64d99cc6ab and
f9fec0447e.
2020-08-05 12:31:44 +02:00
Petr Hosek 64d99cc6ab [CMake] Move find_package(ZLIB) to LLVMConfig
This way, downstream projects don't have to invoke find_package(ZLIB)
reducing the amount of boilerplate.

Differential Revision: https://reviews.llvm.org/D84691
2020-07-27 17:13:55 -07:00
Jonas Devlieghere 536baa11cf [lldb] Remove CMAKE_VERSION checks now that the minimum version is 3.13.4 2020-07-27 12:31:41 -07:00
Petr Hosek c86f56e32e [CMake] Find zlib when building lldb as standalone
This addresses the issue introduced by 10b1b4a.
2020-07-24 13:36:13 -07:00
Jonas Devlieghere 6e670e0796 [lldb/Lua] Require Lua 5.3 2020-06-23 09:24:01 -07:00
Jonas Devlieghere 2c0afacada [lldb/CMake] Add LLDB_PYTHON_VERSION to use Python 2 with CMake > 3.12
In addition to having the default fallback from Python 3 to Python 2, it
should also be possible to build against Python 2 explicitly. This patch
makes that possible by setting LLDB_PYTHON_VERSION. The variable only
has effect with CMake 3.12 or later.

Differential revision: https://reviews.llvm.org/D81501
2020-06-09 14:11:11 -07:00
Haibo Huang 04daba9670 [lldb] Cleans up system_libs
Summary:
Long long ago system_libs was appended to LLDB_SYSTEM_LIBS in
cmake/LLDBDependencies.cmake. After that file was removed, system_libs
is orphaned.

Currently the only user is source/Utility. Move the logic there and
remove system_libs.

Subscribers: mgorny, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D80253
2020-05-20 12:30:08 -07:00
Haibo Huang 780d7d7732 [lldb] Allows customizing libxml2 for darwin
Summary:
This changes allows to disable or use customized libxml2 for lldb.

1. Removes redundant include_directories. The one in LLDBConfig.cmake should be enough.

2. Link to ${LIBXML2_LIBRARIES} if xml2 is enabled.

Subscribers: mgorny, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D80257
2020-05-20 12:27:08 -07:00
Jonas Devlieghere 397e69dbcb [lldb/CMake] Don't make PYTHON_RPATH a required variable. 2020-04-30 10:54:47 -07:00
Jonas Devlieghere ae6d2ff633 [lldb] fix RPATH when linking against Python3.framework
The install name for the Python 3 framework in Xcode is relative to
the framework's location and not the dylib itself.

  @rpath/Python3.framework/Versions/3.x/Python3

This means that we need to compute the path to the Python3.framework
and use that as the RPATH instead of the usual dylib's directory.
2020-04-30 10:42:03 -07:00
Saleem Abdulrasool 7c8fa95395 lldb: use the newer `find_package` if available
Now that the rest of LLVM prefers python3 over python2, the LLDB path
should follow suite.  Add a fallback path to python2 for non-Windows
targets.
2020-04-29 03:54:33 +00:00
Isuru Fernando 664fda72ea Fix setting Python3_ROOT_DIR on Windows
Summary:
Previously the value of Python3_ROOT_DIR was set to the string
"PYTHON_HOME" instead of the value of the variable named
PYTHON_HOME. This commit fixes that as CMake expects
a path as the value of Python3_ROOT_DIR

Reviewers: #lldb, JDevlieghere, teemperor

Reviewed By: #lldb, JDevlieghere, teemperor

Subscribers: teemperor, JDevlieghere, mgorny, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D77842
2020-04-14 12:50:54 -05:00
Raphael Isemann ce1bc00f37 [lldb][cmake] Move remove_module_flags macro to AddLLDB.cmake
Summary: This is currently hidden in the Host CMakeLists but we should also use this macro in other parts of LLDB where we have ObjC++ sources (see D74891)

Reviewers: JDevlieghere

Reviewed By: JDevlieghere

Subscribers: mgorny, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D75164
2020-03-06 17:21:24 -08:00
Jonas Devlieghere 04a91deebb [lldb/CMake] Use PYTHON_HOME as a hint to find Python 3.
http://lists.llvm.org/pipermail/lldb-dev/2020-February/015998.html

Differential revision: https://reviews.llvm.org/D75275
2020-02-27 13:17:49 -08:00
Haibo Huang 3ec3f62f0a Allow customized relative PYTHONHOME (Attemp 1)
Summary:
This is another attempt of 0bb90628b5.

The difference is that g_python_home is not declared as const. Since
some versions of python do not expect that.

Subscribers: mgorny, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D74998
2020-02-21 16:25:30 -08:00
Stella Stamenova 215a31115f Revert "Allow customized relative PYTHONHOME"
This reverts commit 0bb90628b5 since it is causing failures on the Windows LLDB buildbot:

http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/14048
2020-02-21 14:57:00 -08:00
Haibo Huang 0bb90628b5 Allow customized relative PYTHONHOME
Summary:
This change allows a hard coded relative PYTHONHOME setting. So that
python can easily be packaged together with lldb.

The change includes:
1. Extend LLDB_RELOCATABLE_PYTHON to all platforms. It defaults to ON
for platforms other than Windows, to keep the behavior compatible.
2. Allows to customize LLDB_PYTHON_HOME. But still defaults to
PYTHON_HOME.
3. LLDB_PYTHON_HOME can be a path relative to liblldb. If it is
relative, we will resolve it before send it to Py_DecodeLocale.

Subscribers: mgorny, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D74727
2020-02-21 12:49:10 -08:00
Matt Davis 07d2cdae11 [lldb/cmake] Enable more verbose find_package output.
Summary:
The purpose of this patch is to make identifying missing dependencies clearer to the user.
`find_package` will report if a package is not found, that output, combined with the exiting
status message, is clearer than not having the additional verbosity.

If the SWIG dependency is required {LLDB_ENABLE_PYTHON, LLDB_ENABLE_LUA}
and SWIG is not available, fail the configuration step.  Terminate the
configure early rather than later with a clear error message.

We could possibly modify:
`llvm-project/lldb/cmake/modules/FindPythonInterpAndLibs.cmake`
However, the patch here seems clear in my opinion.

Reviewers: aadsm, hhb, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: labath, jrm, mgorny, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D74917
2020-02-21 10:37:02 -08:00
Pavel Labath 363f05b83d [lldb] Delete the SharingPtr class
Summary:
The only use of this class was to implement the SharedCluster of ValueObjects.
However, the same functionality can be implemented using a regular
std::shared_ptr, and its little-known "sub-object pointer" feature, where the
pointer can point to one thing, but actually delete something else when it goes
out of scope.

This patch reimplements SharedCluster using this feature --
SharedClusterPointer::GetObject now returns a std::shared_pointer which points
to the ValueObject, but actually owns the whole cluster. The only change I
needed to make here is that now the SharedCluster object needs to be created
before the root ValueObject. This means that all private ValueObject
constructors get a ClusterManager argument, and their static Create functions do
the create-a-manager-and-pass-it-to-value-object dance.

Reviewers: teemperor, JDevlieghere, jingham

Subscribers: mgorny, jfb, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D74153
2020-02-11 13:23:18 +01:00