Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter2 tinylang standalone compiled error #7

Open
dev-xdyang opened this issue Nov 9, 2021 · 2 comments
Open

Chapter2 tinylang standalone compiled error #7

dev-xdyang opened this issue Nov 9, 2021 · 2 comments

Comments

@dev-xdyang
Copy link

when i compile tinylang standalone it always failed with following message. But it success compiled when integrated with llvm. if anyone encounter and solve this problem?

platform information:

Apple clang version 13.0.0 (clang-1300.0.29.3)
Target: x86_64-apple-darwin20.5.0

compile command:

cmake -G Ninja \
    -DCMAKE_BUILD_TYPE=RelWithDebInfo \
    -DLLVM_DIR=/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/lib/cmake/llvm \
    -DCMAKE_INSTALL_PREFIX=../tinylang-output \
    ../tinylang/

ninja
ninja install

error message:

- The C compiler identification is AppleClang 13.0.0.13000029
-- The CXX compiler identification is AppleClang 13.0.0.13000029
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found ZLIB: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/usr/lib/libz.tbd (found version "1.2.11")
-- Linker detection: ld64
-- Performing Test C_SUPPORTS_FPIC
-- Performing Test C_SUPPORTS_FPIC - Success
-- Performing Test CXX_SUPPORTS_FPIC
-- Performing Test CXX_SUPPORTS_FPIC - Success
-- Building with -fPIC
-- Performing Test C_SUPPORTS_FNO_SEMANTIC_INTERPOSITION
-- Performing Test C_SUPPORTS_FNO_SEMANTIC_INTERPOSITION - Failed
-- Performing Test CXX_SUPPORTS_FNO_SEMANTIC_INTERPOSITION
-- Performing Test CXX_SUPPORTS_FNO_SEMANTIC_INTERPOSITION - Failed
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG - Success
CMake Warning (dev) at /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/lib/cmake/llvm/HandleLLVMOptions.cmake:436 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'LLVM_ENABLE_WARNINGS'.
Call Stack (most recent call first):
  CMakeLists.txt:10 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Performing Test C_SUPPORTS_WERROR_DATE_TIME
-- Performing Test C_SUPPORTS_WERROR_DATE_TIME - Success
-- Performing Test CXX_SUPPORTS_WERROR_DATE_TIME
-- Performing Test CXX_SUPPORTS_WERROR_DATE_TIME - Success
-- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW
-- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW - Success
-- Performing Test CXX_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW
-- Performing Test CXX_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW - Success
-- Performing Test CXX_SUPPORTS_MISSING_FIELD_INITIALIZERS_FLAG
-- Performing Test CXX_SUPPORTS_MISSING_FIELD_INITIALIZERS_FLAG - Success
-- Performing Test C_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG
-- Performing Test C_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG - Success
-- Performing Test CXX_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG
-- Performing Test CXX_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG - Success
-- Performing Test C_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG
-- Performing Test C_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG - Success
-- Performing Test CXX_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG
-- Performing Test CXX_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG - Success
-- Performing Test CXX_SUPPORTS_CLASS_MEMACCESS_FLAG
-- Performing Test CXX_SUPPORTS_CLASS_MEMACCESS_FLAG - Failed
-- Performing Test CXX_SUPPORTS_NOEXCEPT_TYPE_FLAG
-- Performing Test CXX_SUPPORTS_NOEXCEPT_TYPE_FLAG - Success
-- Performing Test CXX_WONT_WARN_ON_FINAL_NONVIRTUALDTOR
-- Performing Test CXX_WONT_WARN_ON_FINAL_NONVIRTUALDTOR - Success
-- Performing Test CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG
-- Performing Test CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG - Success
-- Performing Test CXX_WSUGGEST_OVERRIDE_ALLOWS_ONLY_FINAL
-- Performing Test CXX_WSUGGEST_OVERRIDE_ALLOWS_ONLY_FINAL - Success
-- Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP
-- Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP - Success
-- Performing Test C_SUPPORTS_STRING_CONVERSION_FLAG
-- Performing Test C_SUPPORTS_STRING_CONVERSION_FLAG - Success
-- Performing Test CXX_SUPPORTS_STRING_CONVERSION_FLAG
-- Performing Test CXX_SUPPORTS_STRING_CONVERSION_FLAG - Success
-- Performing Test C_SUPPORTS_MISLEADING_INDENTATION_FLAG
-- Performing Test C_SUPPORTS_MISLEADING_INDENTATION_FLAG - Success
-- Performing Test CXX_SUPPORTS_MISLEADING_INDENTATION_FLAG
-- Performing Test CXX_SUPPORTS_MISLEADING_INDENTATION_FLAG - Success
-- Performing Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS
-- Performing Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS - Failed
CMake Warning (dev) at /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/lib/cmake/llvm/HandleLLVMOptions.cmake:950 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'LLVM_ENABLE_EH'.
Call Stack (most recent call first):
  CMakeLists.txt:10 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/lib/cmake/llvm/HandleLLVMOptions.cmake:951 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'LLVM_ENABLE_RTTI'.
Call Stack (most recent call first):
  CMakeLists.txt:10 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/local/Cellar/cmake/3.16.5/share/cmake/Modules/CMakeDependentOption.cmake:39 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'LLVM_EXPORT_SYMBOLS_FOR_PLUGINS'.
Call Stack (most recent call first):
  /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/lib/cmake/llvm/HandleLLVMOptions.cmake:1115 (CMAKE_DEPENDENT_OPTION)
  CMakeLists.txt:10 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Looking for os_signpost_interval_begin
-- Looking for os_signpost_interval_begin - found
-- Performing Test macos_signposts_usable
-- Performing Test macos_signposts_usable - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/xdyang/Documents/Version/llvm-project/build-tinylang
[1/4] Building CXX object tools/driver/CMakeFiles/tinylang.dir/Driver.cpp.o
FAILED: tools/driver/CMakeFiles/tinylang.dir/Driver.cpp.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++  -DGTEST_HAS_RTTI=0 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/Users/xdyang/Documents/Version/llvm-project/tinylang/include -Iinclude -I/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/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 -Wmisleading-indentation -fdiagnostics-color -O2 -g -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk -mmacosx-version-min=11.4    -fno-exceptions -fno-rtti -MD -MT tools/driver/CMakeFiles/tinylang.dir/Driver.cpp.o -MF tools/driver/CMakeFiles/tinylang.dir/Driver.cpp.o.d -o tools/driver/CMakeFiles/tinylang.dir/Driver.cpp.o -c /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp
In file included from /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp:1:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/InitLLVM.h:12:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Optional.h:18:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Hashing.h:48:
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:71:2: error: expected expression
[[noreturn]] void report_fatal_error(const char *reason,
 ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:71:14: error: expected unqualified-id
[[noreturn]] void report_fatal_error(const char *reason,
             ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:73:2: error: expected expression
[[noreturn]] void report_fatal_error(StringRef reason,
 ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:73:14: error: expected unqualified-id
[[noreturn]] void report_fatal_error(StringRef reason,
             ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:75:2: error: expected expression
[[noreturn]] void report_fatal_error(const Twine &reason,
 ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:75:14: error: expected unqualified-id
[[noreturn]] void report_fatal_error(const Twine &reason,
             ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:114:2: error: expected expression
[[noreturn]] void report_bad_alloc_error(const char *Reason,
 ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:114:14: error: expected unqualified-id
[[noreturn]] void report_bad_alloc_error(const char *Reason,
             ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:120:2: error: expected expression
[[noreturn]] void
 ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:120:14: error: expected unqualified-id
[[noreturn]] void
             ^
In file included from /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp:1:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/InitLLVM.h:12:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Optional.h:18:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Hashing.h:49:
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/SwapByteOrder.h:98:1: error: unknown type name 'constexpr'
constexpr bool IsBigEndianHost = false;
^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/SwapByteOrder.h:152:13: error: no template named 'enable_if_t' in namespace 'std'; did you mean 'enable_if'?
inline std::enable_if_t<std::is_enum<T>::value, T> getSwappedBytes(T C) {
       ~~~~~^~~~~~~~~~~
            enable_if
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/type_traits:541:63: note: 'enable_if' declared here
template <bool, class _Tp = void> struct _LIBCPP_TEMPLATE_VIS enable_if {};
                                                              ^
In file included from /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp:1:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/InitLLVM.h:12:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Optional.h:18:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Hashing.h:49:
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/SwapByteOrder.h:154:40: error: no template named 'underlying_type_t' in namespace 'std'; did you mean 'underlying_type'?
      getSwappedBytes(static_cast<std::underlying_type_t<T>>(C)));
                                  ~~~~~^~~~~~~~~~~~~~~~~
                                       underlying_type
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/type_traits:4112:8: note: 'underlying_type' declared here
struct underlying_type : __underlying_type_impl<_Tp, is_enum<_Tp>::value> {};
       ^
In file included from /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp:1:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/InitLLVM.h:12:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Optional.h:18:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Hashing.h:49:
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/SwapByteOrder.h:154:59: error: a space is required between consecutive right angle brackets (use '> >')
      getSwappedBytes(static_cast<std::underlying_type_t<T>>(C)));
                                                          ^~
                                                          > >
In file included from /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp:1:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/InitLLVM.h:12:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Optional.h:18:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Hashing.h:50:
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:31:23: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
  using UnderlyingT = std::remove_reference_t<T>;
                      ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:31:28: error: no template named 'remove_reference_t' in namespace 'std'; did you mean 'remove_reference'?
  using UnderlyingT = std::remove_reference_t<T>;
                      ~~~~~^~~~~~~~~~~~~~~~~~
                           remove_reference
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/type_traits:1298:50: note: 'remove_reference' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference        {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
                                                 ^
In file included from /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp:1:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/InitLLVM.h:12:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Optional.h:18:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Hashing.h:50:
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:44:59: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
struct add_lvalue_reference_if_not_pointer { using type = T &; };
                                                          ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:48:13: error: no template named 'enable_if_t' in namespace 'std'; did you mean 'enable_if'?
    T, std::enable_if_t<std::is_pointer<T>::value>> {
       ~~~~~^~~~~~~~~~~
            enable_if
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/type_traits:541:63: note: 'enable_if' declared here
template <bool, class _Tp = void> struct _LIBCPP_TEMPLATE_VIS enable_if {};
                                                              ^
In file included from /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp:1:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/InitLLVM.h:12:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Optional.h:18:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Hashing.h:50:
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:48:53: error: expected expression
    T, std::enable_if_t<std::is_pointer<T>::value>> {
                                                    ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:50:2: error: expected '>'
};
 ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:48:24: note: to match this '<'
    T, std::enable_if_t<std::is_pointer<T>::value>> {
                       ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:50:2: error: expected a type
};
 ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 warnings and 20 errors generated.
[2/4] Building CXX object lib/Basic/CMakeFiles/tinylangBasic.dir/Version.cpp.o
ninja: build stopped: subcommand failed.
[2/4] Building CXX object tools/driver/CMakeFiles/tinylang.dir/Driver.cpp.o
FAILED: tools/driver/CMakeFiles/tinylang.dir/Driver.cpp.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++  -DGTEST_HAS_RTTI=0 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/Users/xdyang/Documents/Version/llvm-project/tinylang/include -Iinclude -I/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/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 -Wmisleading-indentation -fdiagnostics-color -O2 -g -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk -mmacosx-version-min=11.4    -fno-exceptions -fno-rtti -MD -MT tools/driver/CMakeFiles/tinylang.dir/Driver.cpp.o -MF tools/driver/CMakeFiles/tinylang.dir/Driver.cpp.o.d -o tools/driver/CMakeFiles/tinylang.dir/Driver.cpp.o -c /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp
In file included from /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp:1:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/InitLLVM.h:12:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Optional.h:18:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Hashing.h:48:
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:71:2: error: expected expression
[[noreturn]] void report_fatal_error(const char *reason,
 ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:71:14: error: expected unqualified-id
[[noreturn]] void report_fatal_error(const char *reason,
             ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:73:2: error: expected expression
[[noreturn]] void report_fatal_error(StringRef reason,
 ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:73:14: error: expected unqualified-id
[[noreturn]] void report_fatal_error(StringRef reason,
             ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:75:2: error: expected expression
[[noreturn]] void report_fatal_error(const Twine &reason,
 ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:75:14: error: expected unqualified-id
[[noreturn]] void report_fatal_error(const Twine &reason,
             ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:114:2: error: expected expression
[[noreturn]] void report_bad_alloc_error(const char *Reason,
 ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:114:14: error: expected unqualified-id
[[noreturn]] void report_bad_alloc_error(const char *Reason,
             ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:120:2: error: expected expression
[[noreturn]] void
 ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/ErrorHandling.h:120:14: error: expected unqualified-id
[[noreturn]] void
             ^
In file included from /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp:1:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/InitLLVM.h:12:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Optional.h:18:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Hashing.h:49:
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/SwapByteOrder.h:98:1: error: unknown type name 'constexpr'
constexpr bool IsBigEndianHost = false;
^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/SwapByteOrder.h:152:13: error: no template named 'enable_if_t' in namespace 'std'; did you mean 'enable_if'?
inline std::enable_if_t<std::is_enum<T>::value, T> getSwappedBytes(T C) {
       ~~~~~^~~~~~~~~~~
            enable_if
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/type_traits:541:63: note: 'enable_if' declared here
template <bool, class _Tp = void> struct _LIBCPP_TEMPLATE_VIS enable_if {};
                                                              ^
In file included from /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp:1:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/InitLLVM.h:12:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Optional.h:18:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Hashing.h:49:
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/SwapByteOrder.h:154:40: error: no template named 'underlying_type_t' in namespace 'std'; did you mean 'underlying_type'?
      getSwappedBytes(static_cast<std::underlying_type_t<T>>(C)));
                                  ~~~~~^~~~~~~~~~~~~~~~~
                                       underlying_type
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/type_traits:4112:8: note: 'underlying_type' declared here
struct underlying_type : __underlying_type_impl<_Tp, is_enum<_Tp>::value> {};
       ^
In file included from /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp:1:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/InitLLVM.h:12:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Optional.h:18:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Hashing.h:49:
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/SwapByteOrder.h:154:59: error: a space is required between consecutive right angle brackets (use '> >')
      getSwappedBytes(static_cast<std::underlying_type_t<T>>(C)));
                                                          ^~
                                                          > >
In file included from /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp:1:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/InitLLVM.h:12:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Optional.h:18:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Hashing.h:50:
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:31:23: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
  using UnderlyingT = std::remove_reference_t<T>;
                      ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:31:28: error: no template named 'remove_reference_t' in namespace 'std'; did you mean 'remove_reference'?
  using UnderlyingT = std::remove_reference_t<T>;
                      ~~~~~^~~~~~~~~~~~~~~~~~
                           remove_reference
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/type_traits:1298:50: note: 'remove_reference' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference        {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
                                                 ^
In file included from /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp:1:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/InitLLVM.h:12:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Optional.h:18:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Hashing.h:50:
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:44:59: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
struct add_lvalue_reference_if_not_pointer { using type = T &; };
                                                          ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:48:13: error: no template named 'enable_if_t' in namespace 'std'; did you mean 'enable_if'?
    T, std::enable_if_t<std::is_pointer<T>::value>> {
       ~~~~~^~~~~~~~~~~
            enable_if
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/type_traits:541:63: note: 'enable_if' declared here
template <bool, class _Tp = void> struct _LIBCPP_TEMPLATE_VIS enable_if {};
                                                              ^
In file included from /Users/xdyang/Documents/Version/llvm-project/tinylang/tools/driver/Driver.cpp:1:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/InitLLVM.h:12:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Optional.h:18:
In file included from /Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/ADT/Hashing.h:50:
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:48:53: error: expected expression
    T, std::enable_if_t<std::is_pointer<T>::value>> {
                                                    ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:50:2: error: expected '>'
};
 ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:48:24: note: to match this '<'
    T, std::enable_if_t<std::is_pointer<T>::value>> {
                       ^
/Users/xdyang/Documents/Version/llvm-project/build/llvm-core-libraries-output/include/llvm/Support/type_traits.h:50:2: error: expected a type
};
 ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 warnings and 20 errors generated.
ninja: build stopped: subcommand failed.
@sherrytonger
Copy link

Add "set(CMAKE_CXX_STANDARD 17)" to the CMakeLists, problem solved.

@redstar
Copy link
Collaborator

redstar commented Nov 22, 2021

Add "set(CMAKE_CXX_STANDARD 17)" to the CMakeLists, problem solved.

Interesting. The LLVM sources are not yet require C++17. This looks like a problem with compiler detection in the core libraries. (The error comes from include/llvm/Support/ErrorHandling.h.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants