[Lldb-commits] [clang] [compiler-rt] [lldb] [llvm] Reapply "[Support] Remove terminfo dependency (#92865)" (PR #93889)

2024-05-30 Thread Aaron Siddhartha Mondal via lldb-commits

https://github.com/aaronmondal closed 
https://github.com/llvm/llvm-project/pull/93889
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [compiler-rt] [lldb] [llvm] Reapply "[Support] Remove terminfo dependency (#92865)" (PR #93889)

2024-05-30 Thread Aaron Siddhartha Mondal via lldb-commits

https://github.com/aaronmondal edited 
https://github.com/llvm/llvm-project/pull/93889
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [compiler-rt] [lldb] [llvm] [Support] Remove terminfo dependency (PR #92865)

2024-05-27 Thread Aaron Siddhartha Mondal via lldb-commits

aaronmondal wrote:

@gulfemsavrun The file `terminal.c` that is causing this linker error is not in 
LLVM but in `libedit`. The configure step doesn't find `libedit`:

```
Not searching for unused variables given on the command line.
-- Could NOT find LibEdit (missing: LibEdit_INCLUDE_DIRS LibEdit_LIBRARIES) 
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) 
-- Could NOT find zstd (missing: zstd_LIBRARY zstd_INCLUDE_DIR) 
-- Could NOT find LibXml2 (missing: LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) 
-- Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR) 

...

-- Could NOT find LibEdit (missing: LibEdit_INCLUDE_DIRS LibEdit_LIBRARIES) 
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) 
-- Could NOT find zstd (missing: zstd_LIBRARY zstd_INCLUDE_DIR) 
-- Could NOT find LibXml2 (missing: LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) 
-- Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR) 

...

-- Building with -fPIC
-- LLVM host triple: x86_64-unknown-linux-gnu
-- LLVM default target triple: x86_64-unknown-linux-gnu
-- Using libunwind testing configuration: 
/b/s/w/ir/x/w/llvm-llvm-project/libunwind/test/configs/llvm-libunwind-static.cfg.in
-- Failed to locate sphinx-build executable (missing: SPHINX_EXECUTABLE) 
-- Using libc++abi testing configuration: 
/b/s/w/ir/x/w/llvm-llvm-project/libcxxabi/test/configs/llvm-libc++abi-static.cfg.in
-- Using libc++ testing configuration: 
/b/s/w/ir/x/w/llvm-llvm-project/libcxx/test/configs/llvm-libc++-static.cfg.in
-- Could NOT find LibEdit (missing: LibEdit_INCLUDE_DIRS LibEdit_LIBRARIES) 
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) 
-- Could NOT find zstd (missing: zstd_LIBRARY zstd_INCLUDE_DIR) 
-- Could NOT find LibXml2 (missing: LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) 
```

My guess is that some other mechanism is adding `libedit` into this build with 
an explicit `-ledit` flag instead of using `pkgconfig`. This causing the 
`/usr/lib64/pkgconfig/libedit.pc` (or similar) file to be ignored. That file 
should contain a line like `Libs.private: -ltinfo` if it's a `libedit` that was 
configured to depend on `tinfo`.

```
FAILED: unittests/LineEditor/LineEditorTests 
: && /b/s/w/ir/x/w/cipd/bin/clang++ --sysroot=/b/s/w/ir/x/w/cipd/linux 
-stdlib=libc++ -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden 
-Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra 
-Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers 
-pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough 
-Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor 
-Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion 
-Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color 
-ffunction-sections -fdata-sections -ffat-lto-objects 
-ffile-prefix-map=/b/s/w/ir/x/w/llvm_build=../llvm-llvm-project 
-ffile-prefix-map=/b/s/w/ir/x/w/llvm-llvm-project/= -no-canonical-prefixes -O3 
-DNDEBUG -static-libstdc++ -stdlib=libc++ -static-libstdc++ -fuse-ld=lld 
-Wl,--color-diagnostics -ffat-lto-objects-Wl,--gc-sections 
unittests/LineEditor/CMakeFiles/LineEditorTests.dir/LineEditor.cpp.o -o 
unittests/LineEditor/LineEditorTests  lib/libLLVMLineEditor.a  
lib/libLLVMSupport.a  lib/libLLVMSupport.a  -lpthread  lib/libllvm_gtest_main.a 
 lib/libllvm_gtest.a  -lpthread  /b/s/w/ir/x/w/libedit_install/lib/libedit.a  
lib/libLLVMSupport.a  -lrt  -ldl  -lpthread  -lm  
/b/s/w/ir/x/w/zlib_install_target/lib/libz.a  
/b/s/w/ir/x/w/zstd_install/lib/libzstd.a  -pthread  lib/libLLVMDemangle.a  
-lpthread && :
ld.lld: error: undefined symbol: tgetent
>>> referenced by terminal.c
>>>   terminal.o:(terminal_set) in archive 
>>> /b/s/w/ir/x/w/libedit_install/lib/libedit.a

ld.lld: error: undefined symbol: tgetflag
>>> referenced by terminal.c
>>>   terminal.o:(terminal_set) in archive 
>>> /b/s/w/ir/x/w/libedit_install/lib/libedit.a
>>> referenced by terminal.c
>>>   terminal.o:(terminal_set) in archive 
>>> /b/s/w/ir/x/w/libedit_install/lib/libedit.a
>>> referenced by terminal.c
>>>   terminal.o:(terminal_set) in archive 
>>> /b/s/w/ir/x/w/libedit_install/lib/libedit.a
>>> referenced 3 more times

ld.lld: error: undefined symbol: tgetnum
>>> referenced by terminal.c
>>>   terminal.o:(terminal_set) in archive 
>>> /b/s/w/ir/x/w/libedit_install/lib/libedit.a
>>> referenced by terminal.c
>>>   terminal.o:(terminal_set) in archive 
>>> /b/s/w/ir/x/w/libedit_install/lib/libedit.a

ld.lld: error: undefined symbol: tgetstr
>>> referenced by terminal.c
>>>   terminal.o:(terminal_set) in archive 
>>> /b/s/w/ir/x/w/libedit_install/lib/libedit.a
>>> referenced by terminal.c
>>>   terminal.o:(terminal_echotc) in archive 
>>> /b/s/w/ir/x/w/libedit_install/lib/libedit.a

ld.lld: error: undefined symbol: tputs
>>> referenced by terminal.c
>>>   terminal.o:(terminal_move_to_line) in 

[Lldb-commits] [clang] [compiler-rt] [lldb] [llvm] [Support] Remove terminfo dependency (PR #92865)

2024-05-24 Thread Aaron Siddhartha Mondal via lldb-commits

https://github.com/aaronmondal closed 
https://github.com/llvm/llvm-project/pull/92865
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [compiler-rt] [lldb] [llvm] [Support] Remove terminfo dependency (PR #92865)

2024-05-23 Thread Aaron Siddhartha Mondal via lldb-commits

https://github.com/aaronmondal updated 
https://github.com/llvm/llvm-project/pull/92865

>From 124be680ca3ae82edd6fa9a49b1fd171d1babbf5 Mon Sep 17 00:00:00 2001
From: Aaron Siddhartha Mondal 
Date: Tue, 21 May 2024 06:37:49 +0200
Subject: [PATCH] [Support] Remove terminfo dependency

The terminfo dependency introduces a significant nonhermeticity into the
build. It doesn't respect `--no-undefined-version` meaning that it's not
a dependency that can be built with Clang 17+. This forces maintainers
of source-based distributions to implement patches or ignore linker
errors.

Remove it to reduce the closure size and improve portability of
LLVM-based tools. Users can still use command line arguments to toggle
color support expliticly.

Fixes #75490
Closes #53294 #23355
---
 clang/cmake/caches/Fuchsia-stage2.cmake   |  1 -
 clang/cmake/caches/Fuchsia.cmake  |  7 ---
 clang/cmake/caches/VectorEngine.cmake |  4 +-
 clang/utils/analyzer/entrypoint.py|  2 +-
 compiler-rt/cmake/config-ix.cmake | 15 -
 .../symbolizer/scripts/build_symbolizer.sh|  1 -
 compiler-rt/lib/xray/tests/CMakeLists.txt |  5 --
 lldb/docs/resources/build.rst |  1 -
 lldb/source/Core/CMakeLists.txt   |  3 -
 llvm/CMakeLists.txt   |  2 -
 llvm/cmake/config-ix.cmake| 10 
 llvm/cmake/modules/FindTerminfo.cmake | 55 -
 llvm/cmake/modules/LLVMConfig.cmake.in|  5 --
 llvm/docs/ReleaseNotes.rst|  4 ++
 llvm/include/llvm/Config/config.h.cmake   |  3 -
 llvm/lib/Support/CMakeLists.txt   | 11 
 llvm/lib/Support/Unix/Process.inc | 60 ++-
 llvm/utils/gn/README.rst  |  2 +-
 llvm/utils/gn/build/libs/terminfo/BUILD.gn| 12 
 llvm/utils/gn/build/libs/terminfo/enable.gni  |  4 --
 .../llvm/include/llvm/Config/BUILD.gn |  7 ---
 .../gn/secondary/llvm/lib/Support/BUILD.gn|  1 -
 .../secondary/llvm/tools/llvm-config/BUILD.gn |  6 +-
 utils/bazel/.bazelrc  |  3 -
 .../llvm/include/llvm/Config/config.h |  3 -
 utils/bazel/llvm_configs/config.h.cmake   |  3 -
 26 files changed, 12 insertions(+), 218 deletions(-)
 delete mode 100644 llvm/cmake/modules/FindTerminfo.cmake
 delete mode 100644 llvm/utils/gn/build/libs/terminfo/BUILD.gn
 delete mode 100644 llvm/utils/gn/build/libs/terminfo/enable.gni

diff --git a/clang/cmake/caches/Fuchsia-stage2.cmake 
b/clang/cmake/caches/Fuchsia-stage2.cmake
index d5546e20873b3..66e764968e85c 100644
--- a/clang/cmake/caches/Fuchsia-stage2.cmake
+++ b/clang/cmake/caches/Fuchsia-stage2.cmake
@@ -19,7 +19,6 @@ set(LLVM_ENABLE_LLD ON CACHE BOOL "")
 set(LLVM_ENABLE_LTO ON CACHE BOOL "")
 set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR ON CACHE BOOL "")
 set(LLVM_ENABLE_PLUGINS OFF CACHE BOOL "")
-set(LLVM_ENABLE_TERMINFO OFF CACHE BOOL "")
 set(LLVM_ENABLE_UNWIND_TABLES OFF CACHE BOOL "")
 set(LLVM_ENABLE_Z3_SOLVER OFF CACHE BOOL "")
 set(LLVM_ENABLE_ZLIB ON CACHE BOOL "")
diff --git a/clang/cmake/caches/Fuchsia.cmake b/clang/cmake/caches/Fuchsia.cmake
index 30a3b9116a461..4d3af3ad3f403 100644
--- a/clang/cmake/caches/Fuchsia.cmake
+++ b/clang/cmake/caches/Fuchsia.cmake
@@ -12,7 +12,6 @@ set(LLVM_ENABLE_DIA_SDK OFF CACHE BOOL "")
 set(LLVM_ENABLE_LIBEDIT OFF CACHE BOOL "")
 set(LLVM_ENABLE_LIBXML2 OFF CACHE BOOL "")
 set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR ON CACHE BOOL "")
-set(LLVM_ENABLE_TERMINFO OFF CACHE BOOL "")
 set(LLVM_ENABLE_UNWIND_TABLES OFF CACHE BOOL "")
 set(LLVM_ENABLE_Z3_SOLVER OFF CACHE BOOL "")
 set(LLVM_ENABLE_ZLIB OFF CACHE BOOL "")
@@ -34,7 +33,6 @@ set(_FUCHSIA_BOOTSTRAP_PASSTHROUGH
   LibXml2_ROOT
   LLVM_ENABLE_CURL
   LLVM_ENABLE_HTTPLIB
-  LLVM_ENABLE_TERMINFO
   LLVM_ENABLE_LIBEDIT
   CURL_ROOT
   OpenSSL_ROOT
@@ -47,11 +45,6 @@ set(_FUCHSIA_BOOTSTRAP_PASSTHROUGH
   CURSES_LIBRARIES
   PANEL_LIBRARIES
 
-  # Deprecated
-  Terminfo_ROOT
-
-  Terminfo_LIBRARIES
-
   # Deprecated
   LibEdit_ROOT
 
diff --git a/clang/cmake/caches/VectorEngine.cmake 
b/clang/cmake/caches/VectorEngine.cmake
index 2f968a21cc407..b429fb0997d7a 100644
--- a/clang/cmake/caches/VectorEngine.cmake
+++ b/clang/cmake/caches/VectorEngine.cmake
@@ -13,9 +13,7 @@
 #   ninja
 #
 
-# Disable TERMINFO, ZLIB, and ZSTD for VE since there is no pre-compiled
-# libraries.
-set(LLVM_ENABLE_TERMINFO OFF CACHE BOOL "")
+# Disable ZLIB, and ZSTD for VE since there is no pre-compiled libraries.
 set(LLVM_ENABLE_ZLIB OFF CACHE BOOL "")
 set(LLVM_ENABLE_ZSTD OFF CACHE BOOL "")
 
diff --git a/clang/utils/analyzer/entrypoint.py 
b/clang/utils/analyzer/entrypoint.py
index ff877060bad69..4deb42db0a0b1 100644
--- a/clang/utils/analyzer/entrypoint.py
+++ b/clang/utils/analyzer/entrypoint.py
@@ -54,7 +54,7 @@ def is_cmake_needed():
 "cmake -G Ninja -DCMAKE_BUILD_TYPE=Release "
 "-DCMAKE_INSTALL_PREFIX=/analyzer -DLLVM_TARGETS_TO_BUILD=X86 "
 

[Lldb-commits] [clang] [compiler-rt] [lldb] [llvm] [Support] Remove terminfo dependency (PR #92865)

2024-05-21 Thread Aaron Siddhartha Mondal via lldb-commits

https://github.com/aaronmondal created 
https://github.com/llvm/llvm-project/pull/92865

The terminfo dependency introduces a significant nonhermeticity into the build. 
It doesn't respect `--no-undefined-version` meaning that it's not a dependency 
that can be built with Clang 17+. This forces maintainers of source-based 
distributions to implement patches or ignore linker errors.

Remove it to reduce the closure size and improve portability of LLVM-based 
tools. Users can still use command line arguments to toggle color support 
expliticly.

Fixes #75490
Closes #53294 #23355

>From 404dcfceb9c073c3a055a7242ddf05c1f36111a2 Mon Sep 17 00:00:00 2001
From: Aaron Siddhartha Mondal 
Date: Tue, 21 May 2024 06:37:49 +0200
Subject: [PATCH] [Support] Remove terminfo dependency

The terminfo dependency introduces a significant nonhermeticity into the
build. It doesn't respect `--no-undefined-version` meaning that it's not
a dependency that can be built with Clang 17+. This forces maintainers
of source-based distributions to implement patches or ignore linker
errors.

Remove it to reduce the closure size and improve portability of
LLVM-based tools. Users can still use command line arguments to toggle
color support expliticly.

Fixes #75490
Closes #53294 #23355
---
 clang/cmake/caches/Fuchsia-stage2.cmake   |  1 -
 clang/cmake/caches/Fuchsia.cmake  |  7 ---
 clang/cmake/caches/VectorEngine.cmake |  4 +-
 clang/utils/analyzer/entrypoint.py|  2 +-
 compiler-rt/cmake/config-ix.cmake | 15 -
 .../symbolizer/scripts/build_symbolizer.sh|  1 -
 compiler-rt/lib/xray/tests/CMakeLists.txt |  5 --
 lldb/docs/resources/build.rst |  1 -
 lldb/source/Core/CMakeLists.txt   |  3 -
 llvm/CMakeLists.txt   |  2 -
 llvm/cmake/config-ix.cmake| 10 
 llvm/cmake/modules/FindTerminfo.cmake | 55 -
 llvm/cmake/modules/LLVMConfig.cmake.in|  5 --
 llvm/docs/ReleaseNotes.rst|  4 ++
 llvm/include/llvm/Config/config.h.cmake   |  3 -
 llvm/lib/Support/CMakeLists.txt   | 11 
 llvm/lib/Support/Unix/Process.inc | 60 ++-
 llvm/utils/gn/README.rst  |  2 +-
 llvm/utils/gn/build/libs/terminfo/BUILD.gn| 12 
 llvm/utils/gn/build/libs/terminfo/enable.gni  |  4 --
 .../llvm/include/llvm/Config/BUILD.gn |  7 ---
 .../gn/secondary/llvm/lib/Support/BUILD.gn|  1 -
 .../secondary/llvm/tools/llvm-config/BUILD.gn |  6 +-
 .../llvm/include/llvm/Config/config.h |  3 -
 utils/bazel/llvm_configs/config.h.cmake   |  3 -
 25 files changed, 12 insertions(+), 215 deletions(-)
 delete mode 100644 llvm/cmake/modules/FindTerminfo.cmake
 delete mode 100644 llvm/utils/gn/build/libs/terminfo/BUILD.gn
 delete mode 100644 llvm/utils/gn/build/libs/terminfo/enable.gni

diff --git a/clang/cmake/caches/Fuchsia-stage2.cmake 
b/clang/cmake/caches/Fuchsia-stage2.cmake
index d5546e20873b3..66e764968e85c 100644
--- a/clang/cmake/caches/Fuchsia-stage2.cmake
+++ b/clang/cmake/caches/Fuchsia-stage2.cmake
@@ -19,7 +19,6 @@ set(LLVM_ENABLE_LLD ON CACHE BOOL "")
 set(LLVM_ENABLE_LTO ON CACHE BOOL "")
 set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR ON CACHE BOOL "")
 set(LLVM_ENABLE_PLUGINS OFF CACHE BOOL "")
-set(LLVM_ENABLE_TERMINFO OFF CACHE BOOL "")
 set(LLVM_ENABLE_UNWIND_TABLES OFF CACHE BOOL "")
 set(LLVM_ENABLE_Z3_SOLVER OFF CACHE BOOL "")
 set(LLVM_ENABLE_ZLIB ON CACHE BOOL "")
diff --git a/clang/cmake/caches/Fuchsia.cmake b/clang/cmake/caches/Fuchsia.cmake
index 30a3b9116a461..4d3af3ad3f403 100644
--- a/clang/cmake/caches/Fuchsia.cmake
+++ b/clang/cmake/caches/Fuchsia.cmake
@@ -12,7 +12,6 @@ set(LLVM_ENABLE_DIA_SDK OFF CACHE BOOL "")
 set(LLVM_ENABLE_LIBEDIT OFF CACHE BOOL "")
 set(LLVM_ENABLE_LIBXML2 OFF CACHE BOOL "")
 set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR ON CACHE BOOL "")
-set(LLVM_ENABLE_TERMINFO OFF CACHE BOOL "")
 set(LLVM_ENABLE_UNWIND_TABLES OFF CACHE BOOL "")
 set(LLVM_ENABLE_Z3_SOLVER OFF CACHE BOOL "")
 set(LLVM_ENABLE_ZLIB OFF CACHE BOOL "")
@@ -34,7 +33,6 @@ set(_FUCHSIA_BOOTSTRAP_PASSTHROUGH
   LibXml2_ROOT
   LLVM_ENABLE_CURL
   LLVM_ENABLE_HTTPLIB
-  LLVM_ENABLE_TERMINFO
   LLVM_ENABLE_LIBEDIT
   CURL_ROOT
   OpenSSL_ROOT
@@ -47,11 +45,6 @@ set(_FUCHSIA_BOOTSTRAP_PASSTHROUGH
   CURSES_LIBRARIES
   PANEL_LIBRARIES
 
-  # Deprecated
-  Terminfo_ROOT
-
-  Terminfo_LIBRARIES
-
   # Deprecated
   LibEdit_ROOT
 
diff --git a/clang/cmake/caches/VectorEngine.cmake 
b/clang/cmake/caches/VectorEngine.cmake
index 2f968a21cc407..b429fb0997d7a 100644
--- a/clang/cmake/caches/VectorEngine.cmake
+++ b/clang/cmake/caches/VectorEngine.cmake
@@ -13,9 +13,7 @@
 #   ninja
 #
 
-# Disable TERMINFO, ZLIB, and ZSTD for VE since there is no pre-compiled
-# libraries.
-set(LLVM_ENABLE_TERMINFO OFF CACHE BOOL "")
+# Disable ZLIB, and ZSTD for VE since there is no pre-compiled libraries.
 set(LLVM_ENABLE_ZLIB OFF CACHE