[lldb-dev] LLDB @ Mac OSX: build on Snow Leopard (still) supported? [patch]
Bjoern Kahl
mls at bjoern-kahl.de
Wed Feb 5 13:35:42 PST 2014
Hi Jason,
hi All,
Am 04.02.14 23:17, schrieb Jason Molenda:
>
> On Feb 4, 2014, at 9:47 AM, Bjoern Kahl <mls at bjoern-kahl.de> wrote:
>
>> according to the web page, building with XCode 3.x is supported, but
>> trying so result in build failures, both when using xcodebuild as well
>> as when following the (FreeBSD) "make" instructions.
>>
>> So my question is:
>>
>> Is building LLDB on Mac OSX Snow Leopard (still) supported?
>> If yes, how can I fix the build failures, preferably the make based
>> ones in the second part of this mail?
>
> I think we need to update http://lldb.llvm.org/build.html and remove mentions of Xcode 3 -- and I don't think anyone has tried building current-lldb on Snow Leopard (Mac OS X 10.6) in a very long time and it is (clearly) not working. We've tried to keep it building for Mac OS X 10.7 ("Lion") because there are a few people still running Lion but I don't think we've heard from people using Snow Leopard.
Well, I am still on Snow Leopard, and I intent to stay there for the
foreseeable future. :-)
> Most of the active lldb developers are running the current Mac OS X 10.9 release ("Mavericks") - I don't think anyone has a system still running Snow Leopard. Greg would be better able to answer how receptive he would be to accepting patches to make it build on 10.6 again - but given that you have to use a non-Apple gcc release (so e.g. no Objective-C++ support) it may be a bit of work.
Actually, after a lot of tries, I succeeded to build current-lldb with
only minimal changes to its source. I had to touch only four files
(patch attached, but needs additional configure test):
lib/Makefile : added -lpanel
source/Host/common/FileSpec.cpp : added missing #include <limits.h>
source/Host/common/Host.cpp : worked around pthread_fchdir()
source/Host/macosx/Host.mm : worked around pthread_fchdir()
That's all for LLDB.
Attached patch contains these changes, but misses an appropriate
configure test. Unfortunately, I have no idea how configure scripts
are made or work, so can't help with the test.
Fixing toolchain:
The major work was, to get a working clang-3.5. Although provided
by MacPorts, a simple "port install clang-3.5" results in a toolchain
with partially broken libc++ so that, among other things, clang++
can't parse its own cmath header. But that is something I should
probably discuss with the clang / libcxx developers.
Here are all steps I needed to do:
- port install gcc-48
- svn checkout of llvm, clang, libcxx, libcxxabi into the prescribed tree:
llvm -+- projects -+- libcxx
| +- libcxxabi
+- tools --- clang
- cd llvm/projects
- patch libcxx and libcxxabi to install into /usr/local instead of /usr
(they don't honor the "--prefix" from configure)
- mkdir mybuild && cd mybuild
- ../llvm/configure --prefix=/usr/local --enable-cxx11
--enable-optimized CC=/opt/local/bin/gcc CXX=/opt/local/bin/g++
- make && sudo make install
- fix /usr/local/include/c++/v1/cmath
to "extern C" llrint and llround
- svn checkout lldb into llvm/tools/lldb
- ../llvm/configure --prefix=/usr/local --enable-cxx11 --enable-libcpp
--enable-optimized CC=/usr/local/bin/clang CXX=/usr/local/bin/clang++
- make && sudo make install
If someone wants it, I can put together a script that automates the
whole process including all patches / fixups.
Björn
--
| Bjoern Kahl +++ Siegburg +++ Germany |
| "googlelogin at -my-domain-" +++ www.bjoern-kahl.de |
| Languages: German, English, Ancient Latin (a bit :-)) |
-------------- next part --------------
diff --git a/lib/Makefile b/lib/Makefile
index cfe4cd3..bb5c6a0 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -130,7 +130,7 @@ ifeq ($(HOST_OS),Darwin)
LLVMLibsOptions += -framework Foundation -framework CoreFoundation
LLVMLibsOptions += -framework CoreServices -framework Carbon -framework Security
LLVMLibsOptions += -framework DebugSymbols $(PYTHON_BUILD_FLAGS) -lobjc
- LLVMLibsOptions += -lxml2
+ LLVMLibsOptions += -lxml2 -lpanel
ifneq ($(EXPORTED_SYMBOL_FILE),)
LLVMLibsOptions += -Wl,-exported_symbols_list -Wl,"$(EXPORTED_SYMBOL_FILE)"
endif
diff --git a/source/Host/common/FileSpec.cpp b/source/Host/common/FileSpec.cpp
index 48f1ac7..1fb5e7b 100644
--- a/source/Host/common/FileSpec.cpp
+++ b/source/Host/common/FileSpec.cpp
@@ -8,6 +8,8 @@
//===----------------------------------------------------------------------===//
+#include <limits.h>
+
#ifndef _WIN32
#include <dirent.h>
#else
diff --git a/source/Host/common/Host.cpp b/source/Host/common/Host.cpp
index 62e4ee9..d211005 100644
--- a/source/Host/common/Host.cpp
+++ b/source/Host/common/Host.cpp
@@ -74,11 +74,13 @@
#define _POSIX_SPAWN_DISABLE_ASLR 0x0100
#endif
+#if defined (CONFIG_HAS_PTHREAD_CHDIR)
extern "C"
{
int __pthread_chdir(const char *path);
int __pthread_fchdir (int fildes);
}
+#endif
#endif
@@ -1781,7 +1783,7 @@ Host::LaunchProcessPosixSpawn (const char *exe_path, ProcessLaunchInfo &launch_i
argv = (char * const*)tmp_argv;
}
-#if !defined (__APPLE__)
+#if !defined (CONFIG_HAS_PTHREAD_CHDIR)
// manage the working directory
char current_dir[PATH_MAX];
current_dir[0] = '\0';
@@ -1790,7 +1792,7 @@ Host::LaunchProcessPosixSpawn (const char *exe_path, ProcessLaunchInfo &launch_i
const char *working_dir = launch_info.GetWorkingDirectory();
if (working_dir)
{
-#if defined (__APPLE__)
+#if defined (CONFIG_HAS_PTHREAD_CHDIR)
// Set the working directory on this thread only
if (__pthread_chdir (working_dir) < 0) {
if (errno == ENOENT) {
@@ -1899,7 +1901,7 @@ Host::LaunchProcessPosixSpawn (const char *exe_path, ProcessLaunchInfo &launch_i
if (working_dir)
{
-#if defined (__APPLE__)
+#if defined (CONFIG_HAS_PTHREAD_CHDIR)
// No more thread specific current working directory
__pthread_fchdir (-1);
#else
diff --git a/source/Host/macosx/Host.mm b/source/Host/macosx/Host.mm
index fad2aaa..3895249 100644
--- a/source/Host/macosx/Host.mm
+++ b/source/Host/macosx/Host.mm
@@ -70,11 +70,14 @@
#define _POSIX_SPAWN_DISABLE_ASLR 0x0100
#endif
+#if defined(CONFIG_HAS_PTHREAD_CHDIR)
+/* The following is unused in this file, so is this extern declaration needed? */
extern "C"
{
int __pthread_chdir(const char *path);
int __pthread_fchdir (int fildes);
}
+#endif
using namespace lldb;
using namespace lldb_private;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 356 bytes
Desc: OpenPGP digital signature
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20140205/860f8c85/attachment.sig>
More information about the lldb-dev
mailing list