================
@@ -378,11 +387,28 @@ ifeq (1, $(USE_SYSTEM_STDLIB))
        endif
 endif
 
+# No C++ library has been specifieed. Use libstdc++ by default.
+ifeq (,$(filter 1, $(USE_LIBSTDCPP) $(USE_LIBCPP) $(USE_SYSTEM_STDLIB)))
+  # If no explicit request was made, but we have paths to a custom libcxx, use
+  # them.
+  ifneq ($(and $(LIBCPP_INCLUDE_DIR), $(LIBCPP_LIBRARY_DIR)),)
+    CXXFLAGS += -nostdlib++ -nostdinc++ -cxx-isystem $(LIBCPP_INCLUDE_DIR)
+    ifneq "$(LIBCPP_INCLUDE_TARGET_DIR)" ""
+      CXXFLAGS += -cxx-isystem $(LIBCPP_INCLUDE_TARGET_DIR)
+    endif
+    LDFLAGS += -L$(LIBCPP_LIBRARY_DIR) -Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++
+  # Otherwise no C++ library has been specified. Use stdc++ by default.
+  else
+    USE_SYSTEM_STDLIB := 1
+  endif
+endif
+
 ifeq (1,$(USE_LIBSTDCPP))
        # Clang requires an extra flag: -stdlib=libstdc++
        ifneq (,$(findstring clang,$(CC)))
-               CXXFLAGS += -stdlib=libstdc++
-               LDFLAGS += -stdlib=libstdc++
+    # Force clang looking for the gcc's headers at specific rootfs folder.
----------------
dzhidzhoev wrote:

Fixed.

https://github.com/llvm/llvm-project/pull/99266
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to