lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 1a7a1e59 12/13: Use libc++ rather than libstd


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 1a7a1e59 12/13: Use libc++ rather than libstdc++ with clang
Date: Mon, 21 Nov 2022 17:29:19 -0500 (EST)

branch: master
commit 1a7a1e59df80c40f3a54080ee0e72054e606533f
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Use libc++ rather than libstdc++ with clang
    
    Using LLVM's compiler, standard library, and linker all together
    provides a toolchain entirely distinct from gcc and its ld.
---
 compiler_clang.make      |  3 ++-
 install_wx.sh            |  4 ++--
 install_wxpdfdoc.sh      | 19 ++++++++++++++++---
 install_xml_libraries.sh |  4 ++--
 4 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/compiler_clang.make b/compiler_clang.make
index 55de40d2..6919d9f2 100644
--- a/compiler_clang.make
+++ b/compiler_clang.make
@@ -163,7 +163,7 @@ CFLAGS =
 
 # C++ compiler flags.
 
-REQUIRED_CXXFLAGS = -std=c++20 $(CXX_WARNINGS) $(REQUIRED_COMPILER_FLAGS)
+REQUIRED_CXXFLAGS = -std=c++20 -stdlib=libc++ $(CXX_WARNINGS) 
$(REQUIRED_COMPILER_FLAGS)
 
 CXXFLAGS =
 
@@ -213,6 +213,7 @@ EXTRA_LDFLAGS :=
 REQUIRED_LDFLAGS = \
   -fuse-ld=lld \
   -Wl,-Map,$@.map \
+  -stdlib=libc++ \
   $(c_l_flags) \
   $(addprefix -L , $(all_library_directories)) \
   $(EXTRA_LDFLAGS) \
diff --git a/install_wx.sh b/install_wx.sh
index 90ea5623..7566c7d7 100755
--- a/install_wx.sh
+++ b/install_wx.sh
@@ -136,8 +136,8 @@ case "$LMI_COMPILER" in
                CXX=clang++ \
           CPPFLAGS="-I$prefix/include" \
             CFLAGS="$wx_cc_flags  $valid_math" \
-          CXXFLAGS="$wx_cxx_flags $valid_math" \
-           LDFLAGS="-L$exec_prefix/lib -fuse-ld=lld" \
+          CXXFLAGS="$wx_cxx_flags $valid_math -stdlib=libc++" \
+           LDFLAGS="-L$exec_prefix/lib -fuse-ld=lld -stdlib=libc++" \
 
         ;;
     (*)
diff --git a/install_wxpdfdoc.sh b/install_wxpdfdoc.sh
index c0780b4c..253c0e1c 100755
--- a/install_wxpdfdoc.sh
+++ b/install_wxpdfdoc.sh
@@ -113,15 +113,28 @@ case "$LMI_COMPILER" in
 
         ;;
     (clang)
+        # To use the LLVM linker, it seems necessary to specify it
+        # in $CXX (and ignore the resulting
+        #   argument unused during compilation: '-fuse-ld=lld'
+        # warning). Otherwise, a command such as
+        #   readelf --string-dump .comment 
/opt/lmi/local/clang_x86_64-pc-linux-gnu/lib/libwxcode_gtk3u_pdfdoc-3.2.so
+        # will lack the expected
+        #   Linker: Debian LLD
+        # comment, even though it is specified in $LDFLAGS, and
+        # even if LD is specified in any of the following ways:
+        #   LD=clang++
+        #   LD=ld.lld
+        #   LD="clang++ -fuse-ld=lld -stdlib=libc++"
+
         valid_math="-Woverriding-t-option -ffp-model=strict 
-ffp-exception-behavior=ignore -Wno-overriding-t-option"
         # 'config_options' must not be double-quoted
         # shellcheck disable=SC2086
         "$wxpdfdoc_dir"/configure $config_options \
                 CC=clang \
-               CXX=clang++ \
+               CXX="clang++ -fuse-ld=lld -stdlib=libc++" \
             CFLAGS="$wxpdfdoc_cc_flags  $valid_math" \
-          CXXFLAGS="$wxpdfdoc_cxx_flags $valid_math" \
-           LDFLAGS="-fuse-ld=lld" \
+          CXXFLAGS="$wxpdfdoc_cxx_flags $valid_math -stdlib=libc++" \
+           LDFLAGS="-fuse-ld=lld -stdlib=libc++" \
 
         ;;
     (*)
diff --git a/install_xml_libraries.sh b/install_xml_libraries.sh
index e21b7f9c..fa377b63 100755
--- a/install_xml_libraries.sh
+++ b/install_xml_libraries.sh
@@ -292,8 +292,8 @@ for lib in xmlwrapp; do
                       CC=clang \
                      CXX=clang++ \
                   CFLAGS="-g -O2 -fno-ms-extensions $valid_math" \
-                CXXFLAGS="-g -O2 -fno-ms-extensions $valid_math" \
-                LDFLAGS="-fuse-ld=lld" \
+                CXXFLAGS="-g -O2 -fno-ms-extensions $valid_math 
-stdlib=libc++" \
+                LDFLAGS="-fuse-ld=lld -stdlib=libc++" \
                 $xmlwrapp_options || err=$?
             ;;
         (*)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]