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

llvm-17.0.0-rc1: libcxxabi does not build on macOS 10.12.6 #64226

Closed
debohman opened this issue Jul 29, 2023 · 7 comments
Closed

llvm-17.0.0-rc1: libcxxabi does not build on macOS 10.12.6 #64226

debohman opened this issue Jul 29, 2023 · 7 comments
Labels
build-problem invalid Resolved as invalid, i.e. not a bug libc++abi libc++abi C++ Runtime Library. Not libc++.

Comments

@debohman
Copy link

debohman commented Jul 29, 2023

FAILED: libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/cxa_handlers.cpp.o 
/tera/tera/debo/Projects/llvm/llvmorg-17.0.0-rc1-build/./bin/clang++ --target=x86_64-apple-darwin16.7.0 -DLIBCXX_BUILDING_LIBCXXABI -D_LIBCPP_BUILDING_LIBRARY -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCXXABI_BUILDING_LIBRARY -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/tera/tera/debo/Projects/llvm/llvmorg-17.0.0-rc1/libcxxabi/../libcxx/src -I/tera/tera/debo/Projects/llvm/llvmorg-17.0.0-rc1-build/include/c++/v1 -I/tera/tera/debo/Projects/llvm/llvmorg-17.0.0-rc1/libcxxabi/include -I/usr/local/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 -Wctad-maybe-unsupported -fdiagnostics-color  -O3 -DNDEBUG -std=c++20 -fPIC -nostdinc++ -fstrict-aliasing -funwind-tables -D_DEBUG -UNDEBUG -Wall -Wextra -Wnewline-eof -Wshadow -Wwrite-strings -Wno-unused-parameter -Wno-long-long -Werror=return-type -Wextra-semi -Wundef -Wunused-template -Wformat-nonliteral -Wno-user-defined-literals -Wno-covered-switch-default -Wno-suggest-override -Wno-error -MD -MT libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/cxa_handlers.cpp.o -MF libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/cxa_handlers.cpp.o.d -o libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/cxa_handlers.cpp.o -c /tera/tera/debo/Projects/llvm/llvmorg-17.0.0-rc1/libcxxabi/src/cxa_handlers.cpp
In file included from /tera/tera/debo/Projects/llvm/llvmorg-17.0.0-rc1/libcxxabi/src/cxa_handlers.cpp:12:
In file included from /tera/tera/debo/Projects/llvm/llvmorg-17.0.0-rc1-build/include/c++/v1/stdexcept:48:
In file included from /tera/tera/debo/Projects/llvm/llvmorg-17.0.0-rc1-build/include/c++/v1/iosfwd:106:
In file included from /tera/tera/debo/Projects/llvm/llvmorg-17.0.0-rc1-build/include/c++/v1/__std_mbstate_t.h:14:
In file included from /tera/tera/debo/Projects/llvm/llvmorg-17.0.0-rc1-build/include/c++/v1/__mbstate_t.h:48:
/usr/include/sys/_types/_mbstate_t.h:31:9: error: unknown type name '__darwin_mbstate_t'
   31 | typedef __darwin_mbstate_t mbstate_t;
      |         ^
1 error generated.

The following change allows it to build:

diff --git a/libcxx/include/__mbstate_t.h b/libcxx/include/__mbstate_t.h
index 2b9e719b1f2e..044c10a58c04 100644
--- a/libcxx/include/__mbstate_t.h
+++ b/libcxx/include/__mbstate_t.h
@@ -42,7 +42,10 @@
 #elif __has_include(<bits/types/mbstate_t.h>)
 #   include <bits/types/mbstate_t.h> // works on most Unixes
 #elif __has_include(<sys/_types/_mbstate_t.h>)
-#   include <sys/_types/_mbstate_t.h> // works on Darwin
+#  if __has_include(<machine/_types.h>)
+#    include <machine/_types.h>
+#  endif
+#  include <sys/_types/_mbstate_t.h> // works on Darwin
 #elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) && __has_include_next(<wchar.h>)
 #   include_next <wchar.h> // fall back to the C standard provider of mbstate_t
 #elif __has_include_next(<uchar.h>)
@EugeneZelenko EugeneZelenko added libc++abi libc++abi C++ Runtime Library. Not libc++. build-problem and removed new issue labels Jul 30, 2023
@h-vetinari
Copy link
Contributor

If you're building libcxx as a shared library (can't tell from the logs), you'll need at least 10.13, see https://libcxx.llvm.org/index.html#platform-and-compiler-support

@debohman
Copy link
Author

This looks like a header file problem. I am doing a default build here and it did build both a static and dynamic library.

@debohman
Copy link
Author

Here is what the install generated in lib, of course with the header file modification:

  -rwxr-xr-x    1 debo  wheel    1031836 Jul 29 17:24 libc++.1.0.dylib
  lrwxr-xr-x    1 debo  wheel         16 Jul 29 17:24 libc++.1.dylib -> libc++.1.0.dylib
  -rw-r--r--    1 debo  wheel    1513792 Jul 29 17:24 libc++.a
  lrwxr-xr-x    1 debo  wheel         14 Jul 29 17:24 libc++.dylib -> libc++.1.dylib
  -rwxr-xr-x    1 debo  wheel     284680 Jul 29 17:23 libc++abi.1.0.dylib
  lrwxr-xr-x    1 debo  wheel         19 Jul 29 17:24 libc++abi.1.dylib -> libc++abi.1.0.dylib
  -rw-r--r--    1 debo  wheel     395592 Jul 29 17:23 libc++abi.a
  lrwxr-xr-x    1 debo  wheel         17 Jul 29 17:24 libc++abi.dylib -> libc++abi.1.dylib
  -rw-r--r--    1 debo  wheel       7520 Jul 29 17:24 libc++experimental.a

@arsenm arsenm added this to the LLVM 17.0.X Release milestone Aug 20, 2023
@tru
Copy link
Collaborator

tru commented Aug 21, 2023

Is this a issue we should try to fix for 17.X? cc @mordante @ldionne

@mordante
Copy link
Member

I've asked @ldionne privately, he's more familiar with MacOS.

@ldionne ldionne added the invalid Resolved as invalid, i.e. not a bug label Aug 23, 2023
@ldionne
Copy link
Member

ldionne commented Aug 23, 2023

@debohman What version of Xcode do you have installed? I suspect you are using a Xcode that is older than Xcode 14, which means it wouldn't be supported anymore. If that's the case, then unfortunately this is NTBF, you need a more recent Xcode.

I strongly suspect that is the case, because Xcode 14 requires at least macOS 12.5, so I don't think it would be possible for you to be using a sufficiently-recent Xcode on your current OS.

If I misunderstood something please re-open and we'll figure out what the issue is.

@ldionne ldionne closed this as completed Aug 23, 2023
@debohman
Copy link
Author

I will patch it myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build-problem invalid Resolved as invalid, i.e. not a bug libc++abi libc++abi C++ Runtime Library. Not libc++.
Projects
Development

No branches or pull requests

7 participants