diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py --- a/lldb/packages/Python/lldbsuite/test/dotest.py +++ b/lldb/packages/Python/lldbsuite/test/dotest.py @@ -761,15 +761,15 @@ return True, "libc++ always present" if platform == "linux": - if os.path.isdir("/usr/include/c++/v1"): - return True, "Headers found, let's hope they work" with tempfile.NamedTemporaryFile() as f: cmd = [configuration.compiler, "-xc++", "-stdlib=libc++", "-o", f.name, "-"] p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) _, stderr = p.communicate("#include \nint main() {}") - if not p.returncode: - return True, "Compiling with -stdlib=libc++ works" - return False, "Compiling with -stdlib=libc++ fails with the error: %s" % stderr + if p.returncode != 0: + return False, "Compiling with -stdlib=libc++ fails with the error: %s" % stderr + if subprocess.call([f.name]) != 0: + return False, "Compiling with -stdlib=libc++ works, but fails to run" + return True, "Compiling with -stdlib=libc++ works" return False, "Don't know how to build with libc++ on %s" % platform diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules --- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules +++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules @@ -279,11 +279,6 @@ LD = $(CC) LDFLAGS ?= $(CFLAGS) LDFLAGS += $(LD_EXTRAS) $(ARCH_LDFLAGS) -ifneq (,$(LLVM_LIBS_DIR)) - ifeq ($(OS),NetBSD) - LDFLAGS += -L$(LLVM_LIBS_DIR) -Wl,-rpath,$(LLVM_LIBS_DIR) - endif -endif ifeq (,$(filter $(OS), Windows_NT Android Darwin)) ifneq (,$(filter YES,$(ENABLE_THREADS))) LDFLAGS += -pthread @@ -393,21 +388,18 @@ ifeq (1,$(USE_LIBCPP)) CXXFLAGS += -DLLDB_USING_LIBCPP - ifeq "$(OS)" "Linux" - ifneq (,$(findstring clang,$(CC))) - CXXFLAGS += -stdlib=libc++ - LDFLAGS += -stdlib=libc++ - else - CXXFLAGS += -isystem /usr/include/c++/v1 - LDFLAGS += -lc++ - endif - else ifeq "$(OS)" "Android" + ifeq "$(OS)" "Android" # Nothing to do, this is already handled in # Android.rules. else CXXFLAGS += -stdlib=libc++ LDFLAGS += -stdlib=libc++ endif + ifneq (,$(filter $(OS), FreeBSD Linux NetBSD)) + ifneq (,$(LLVM_LIBS_DIR)) + LDFLAGS += -Wl,-rpath,$(LLVM_LIBS_DIR) + endif + endif endif #----------------------------------------------------------------------