Building LLDB (12.0)

Hello,

I am having problems compiling lldb. I can build the complete llvm project except this program.

I am on macos 10.14.6 and trying to build the latest main checkout, but I have also tried the release llvmorg-12.0.0-rc1 with a similar failure.

The cmake command I am using to build is:

cmake -G Ninja -DCMAKE_CXX_COMPILER=/usr/local/Cellar/llvm/12.0.0/bin/clang++ -DCMAKE_C_COMPILER=/usr/local/Cellar/llvm/12.0.0/bin/clang -DLLDB_USE_SYSTEM_DEBUGSERVER=ON -DLLDB_ENABLE_TESTS=OFF -DLIBCXX_ENABLE_STATIC=ON -DLLDB_BUILD_FRAMEWORK=ON …/lldb

I get error in C++ header files about standard functions as undefined - like using ::isless; I am not sure why it is generating such errors, and if I swap to the default Apple compiler it gives similar errors. The clang compiler I am using is built from source (installed in the homebrew location), and it built and runs with no problems.

I am not sure what is causing this, and swapping the cmake options as on the building lldb documentation, does not seem to change the errors.

The full errors are:

FAILED: source/Host/CMakeFiles/lldbHost.dir/common/FileAction.cpp.o
/usr/local/Cellar/llvm/12.0.0/bin/clang++ -DHAVE_ROUND -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Isource/Host -I/Users/alex/Source/llvm-project-13/lldb/source/Host -Isource -I/Users/alex/Source/llvm-project-13/lldb/include -Iinclude -I/usr/local/opt/llvm/include -I/usr/local/Cellar/python@3.9/3.9.0_5/Frameworks/Python.framework/Versions/3.9/include/python3.9 -I/Users/alex/Source/llvm-project-13/lldb/tools/clang/include -I…/clang/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/libxml2 -I/Users/alex/Source/llvm-project-13/lldb/source/. -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -fdiagnostics-color -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-deprecated-register -Wno-vla-extension -std=c++14 -MD -MT source/Host/CMakeFiles/lldbHost.dir/common/FileAction.cpp.o -MF source/Host/CMakeFiles/lldbHost.dir/common/FileAction.cpp.o.d -o source/Host/CMakeFiles/lldbHost.dir/common/FileAction.cpp.o -c /Users/alex/Source/llvm-project-13/lldb/source/Host/common/FileAction.cpp
In file included from /Users/alex/Source/llvm-project-13/lldb/source/Host/common/FileAction.cpp:11:
In file included from /Users/alex/Source/llvm-project-13/lldb/include/lldb/Host/FileAction.h:12:
In file included from /Users/alex/Source/llvm-project-13/lldb/include/lldb/Utility/FileSpec.h:15:
In file included from /Users/alex/Source/llvm-project-13/lldb/include/lldb/Utility/ConstString.h:12:
In file included from /usr/local/opt/llvm/include/llvm/ADT/DenseMapInfo.h:16:
In file included from /usr/local/opt/llvm/include/llvm/ADT/APInt.h:19:
In file included from /usr/local/opt/llvm/include/llvm/Support/MathExtras.h:20:
/usr/local/Cellar/llvm/12.0.0/bin/…/include/c++/v1/cmath:321:9: error: no member named ‘signbit’ in the global namespace
using ::signbit;
~~^
/usr/local/Cellar/llvm/12.0.0/bin/…/include/c++/v1/cmath:322:9: error: no member named ‘fpclassify’ in the global namespace
using ::fpclassify;
~~^
/usr/local/Cellar/llvm/12.0.0/bin/…/include/c++/v1/cmath:323:9: error: no member named ‘isfinite’ in the global namespace; did you mean ‘finite’?
using ::isfinite;
~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/math.h:749:12: note: ‘finite’ declared here
extern int finite(double)
^
In file included from /Users/alex/Source/llvm-project-13/lldb/source/Host/common/FileAction.cpp:11:
In file included from /Users/alex/Source/llvm-project-13/lldb/include/lldb/Host/FileAction.h:12:
In file included from /Users/alex/Source/llvm-project-13/lldb/include/lldb/Utility/FileSpec.h:15:
In file included from /Users/alex/Source/llvm-project-13/lldb/include/lldb/Utility/ConstString.h:12:
In file included from /usr/local/opt/llvm/include/llvm/ADT/DenseMapInfo.h:16:
In file included from /usr/local/opt/llvm/include/llvm/ADT/APInt.h:19:
In file included from /usr/local/opt/llvm/include/llvm/Support/MathExtras.h:20:
/usr/local/Cellar/llvm/12.0.0/bin/…/include/c++/v1/cmath:324:9: error: no member named ‘isinf’ in the global namespace
using ::isinf;
~~^
/usr/local/Cellar/llvm/12.0.0/bin/…/include/c++/v1/cmath:325:9: error: no member named ‘isnan’ in the global namespace
using ::isnan;
~~^
/usr/local/Cellar/llvm/12.0.0/bin/…/include/c++/v1/cmath:326:9: error: no member named ‘isnormal’ in the global namespace
using ::isnormal;
~~^
/usr/local/Cellar/llvm/12.0.0/bin/…/include/c++/v1/cmath:327:7: error: no member named ‘isgreater’ in the global namespace; did you mean ‘::std::greater’?
using ::isgreater;
^~
/usr/local/Cellar/llvm/12.0.0/bin/…/include/c++/v1/functional:742:29: note: ‘::std::greater’ declared here
struct _LIBCPP_TEMPLATE_VIS greater : binary_function<_Tp, _Tp, bool>
^
In file included from /Users/alex/Source/llvm-project-13/lldb/source/Host/common/FileAction.cpp:11:
In file included from /Users/alex/Source/llvm-project-13/lldb/include/lldb/Host/FileAction.h:12:
In file included from /Users/alex/Source/llvm-project-13/lldb/include/lldb/Utility/FileSpec.h:15:
In file included from /Users/alex/Source/llvm-project-13/lldb/include/lldb/Utility/ConstString.h:12:
In file included from /usr/local/opt/llvm/include/llvm/ADT/DenseMapInfo.h:16:
In file included from /usr/local/opt/llvm/include/llvm/ADT/APInt.h:19:
In file included from /usr/local/opt/llvm/include/llvm/Support/MathExtras.h:20:
/usr/local/Cellar/llvm/12.0.0/bin/…/include/c++/v1/cmath:328:7: error: no member named ‘isgreaterequal’ in the global namespace; did you mean ‘::std::greater_equal’?
using ::isgreaterequal;
^~
/usr/local/Cellar/llvm/12.0.0/bin/…/include/c++/v1/functional:771:29: note: ‘::std::greater_equal’ declared here
struct _LIBCPP_TEMPLATE_VIS greater_equal : binary_function<_Tp, _Tp, bool>
^
In file included from /Users/alex/Source/llvm-project-13/lldb/source/Host/common/FileAction.cpp:11:
In file included from /Users/alex/Source/llvm-project-13/lldb/include/lldb/Host/FileAction.h:12:
In file included from /Users/alex/Source/llvm-project-13/lldb/include/lldb/Utility/FileSpec.h:15:
In file included from /Users/alex/Source/llvm-project-13/lldb/include/lldb/Utility/ConstString.h:12:
In file included from /usr/local/opt/llvm/include/llvm/ADT/DenseMapInfo.h:16:
In file included from /usr/local/opt/llvm/include/llvm/ADT/APInt.h:19:
In file included from /usr/local/opt/llvm/include/llvm/Support/MathExtras.h:20:
/usr/local/Cellar/llvm/12.0.0/bin/…/include/c++/v1/cmath:329:9: error: no member named ‘isless’ in the global namespace
using ::isless;
~~^
/usr/local/Cellar/llvm/12.0.0/bin/…/include/c++/v1/cmath:330:9: error: no member named ‘islessequal’ in the global namespace
using ::islessequal;
~~^
/usr/local/Cellar/llvm/12.0.0/bin/…/include/c++/v1/cmath:331:9: error: no member named ‘islessgreater’ in the global namespace
using ::islessgreater;
~~^
/usr/local/Cellar/llvm/12.0.0/bin/…/include/c++/v1/cmath:332:9: error: no member named ‘isunordered’ in the global namespace
using ::isunordered;
~~^
/usr/local/Cellar/llvm/12.0.0/bin/…/include/c++/v1/cmath:333:9: error: no member named ‘isunordered’ in the global namespace
using ::isunordered;
~~^
13 errors generated.

Alex

1 Like

I think you are not following the instructions provided for the stand-alone build of LLDB.

You need to provide path to the LLVM CMake modules by -DLLVM_DIR=/path/to/llvm-build/lib/cmake/llvm.

They are also using -B argument to specify /path/to/lldb-build which will be different than /path/to/llvm-build.

Please refer to the instructions again if may work out correctly :slight_smile:

I have the same issues with an in-tree build:
https://lldb.llvm.org/resources/build.html#regular-in-tree-builds
It seems to be lldb specific. This works

cmake --build build – install-clang
This fails:
cmake --build build – install-lldb

1 Like

deleting /Library/Developer/CommandLineTools and running sudo xcode-select -s /Applications/Xcode.app
see: Is anyone else getting this error when building the compiler from master on macOS? - Compiler - Swift Forums: