-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Closed
Description
I was trying to build libc in overlay mode for macOS (Apple Silicon/M1), but I am getting build errors with libc/src/stdio/generic/vprintf.cpp
specifically.
After running git bisect
, I've narrowed it down to the following commit a5e67fb introducing the issue.
My environment is:
- macOS 14.5
- LLVM Clang 18.1.8 (from Homebrew)
- latest commit on main (4f067dc)
I am using the following commands to configure and build:
cmake -Sllvm -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/llvmlibc -DLLVM_ENABLE_PROJECTS=libc -DLLVM_LIBC_MPFR_INSTALL_PATH=/opt/homebrew -DCMAKE_C_COMPILER=/opt/homebrew/opt/llvm/bin/clang -DCMAKE_CXX_COMPILER=/opt/homebrew/opt/llvm/bin/clang++
cmake --build build --target libc
The full error:
/opt/homebrew/opt/llvm/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -I<root>/build/projects/libc/src/stdio/generic -I<root>/libc/src/stdio/generic -I<root>/libc -isystem <root>/build/projects/libc/include -fPIC -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 -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -O3 -DNDEBUG -std=c++17 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -fcolor-diagnostics -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -fpie -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -DLIBC_COPT_PUBLIC_PACKAGING -DLIBC_COPT_STDIO_USE_SYSTEM_FILE -MD -MT projects/libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.vprintf.dir/vprintf.cpp.o -MF projects/libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.vprintf.dir/vprintf.cpp.o.d -o projects/libc/src/stdio/generic/CMakeFiles/libc.src.stdio.generic.vprintf.dir/vprintf.cpp.o -c <root>/libc/src/stdio/generic/vprintf.cpp
In file included from <root>/libc/src/stdio/generic/vprintf.cpp:11:
<root>/libc/src/__support/File/file.h:90:3: error: unknown type name 'Mutex'
90 | Mutex mutex;
| ^
<root>/libc/src/__support/File/file.h:260:8: error: expected member name or ';' after declaration specifiers
260 | void clearerr_unlocked() { err = false; }
| ~~~~ ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/stdio.h:397:30: note: expanded from macro 'clearerr_unlocked'
397 | #define clearerr_unlocked(p) __sclearerr(p)
| ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/stdio.h:285:26: note: expanded from macro '__sclearerr'
285 | #define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF)))
| ^
In file included from <root>/libc/src/stdio/generic/vprintf.cpp:11:
<root>/libc/src/__support/File/file.h:260:8: error: expected ')'
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/stdio.h:397:30: note: expanded from macro 'clearerr_unlocked'
397 | #define clearerr_unlocked(p) __sclearerr(p)
| ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/stdio.h:285:26: note: expanded from macro '__sclearerr'
285 | #define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF)))
| ^
<root>/libc/src/__support/File/file.h:260:8: note: to match this '('
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/stdio.h:397:30: note: expanded from macro 'clearerr_unlocked'
397 | #define clearerr_unlocked(p) __sclearerr(p)
| ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/stdio.h:285:25: note: expanded from macro '__sclearerr'
285 | #define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF)))
| ^
In file included from <root>/libc/src/stdio/generic/vprintf.cpp:11:
<root>/libc/src/__support/File/file.h:260:8: error: unknown type name '_flags'
260 | void clearerr_unlocked() { err = false; }
| ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/stdio.h:397:30: note: expanded from macro 'clearerr_unlocked'
397 | #define clearerr_unlocked(p) __sclearerr(p)
| ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/stdio.h:285:37: note: expanded from macro '__sclearerr'
285 | #define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF)))
| ^
In file included from <root>/libc/src/stdio/generic/vprintf.cpp:11:
<root>/libc/src/__support/File/file.h:260:8: error: a type specifier is required for all declarations
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/stdio.h:397:30: note: expanded from macro 'clearerr_unlocked'
397 | #define clearerr_unlocked(p) __sclearerr(p)
| ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/stdio.h:285:34: note: expanded from macro '__sclearerr'
285 | #define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF)))
| ^
In file included from <root>/libc/src/stdio/generic/vprintf.cpp:11:
<root>/libc/src/__support/File/file.h:260:8: error: expected ')'
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/stdio.h:397:30: note: expanded from macro 'clearerr_unlocked'
397 | #define clearerr_unlocked(p) __sclearerr(p)
| ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/stdio.h:285:44: note: expanded from macro '__sclearerr'
285 | #define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF)))
| ^
<root>/libc/src/__support/File/file.h:260:8: note: to match this '('
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/stdio.h:397:30: note: expanded from macro 'clearerr_unlocked'
397 | #define clearerr_unlocked(p) __sclearerr(p)
| ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/stdio.h:285:31: note: expanded from macro '__sclearerr'
285 | #define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF)))
| ^
In file included from <root>/libc/src/stdio/generic/vprintf.cpp:14:
<root>/libc/src/stdio/printf_core/vfprintf_internal.h:44:40: error: expected ')'
44 | LIBC_INLINE int ferror_unlocked(::FILE *f) { return ::ferror_unlocked(f); }
| ^
<root>/libc/src/stdio/printf_core/vfprintf_internal.h:44:17: note: to match this '('
44 | LIBC_INLINE int ferror_unlocked(::FILE *f) { return ::ferror_unlocked(f); }
| ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/stdio.h:396:28: note: expanded from macro 'ferror_unlocked'
396 | #define ferror_unlocked(p) __sferror(p)
| ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/stdio.h:284:24: note: expanded from macro '__sferror'
284 | #define __sferror(p) (((p)->_flags & __SERR) != 0)
| ^
In file included from <root>/libc/src/stdio/generic/vprintf.cpp:14:
<root>/libc/src/stdio/printf_core/vfprintf_internal.h:44:17: error: expected ')'
44 | LIBC_INLINE int ferror_unlocked(::FILE *f) { return ::ferror_unlocked(f); }
| ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/stdio.h:396:28: note: expanded from macro 'ferror_unlocked'
396 | #define ferror_unlocked(p) __sferror(p)
| ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/stdio.h:284:27: note: expanded from macro '__sferror'
284 | #define __sferror(p) (((p)->_flags & __SERR) != 0)
| ^
<root>/libc/src/stdio/printf_core/vfprintf_internal.h:44:17: note: to match this '('
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/stdio.h:396:28: note: expanded from macro 'ferror_unlocked'
396 | #define ferror_unlocked(p) __sferror(p)
| ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/stdio.h:284:23: note: expanded from macro '__sferror'
284 | #define __sferror(p) (((p)->_flags & __SERR) != 0)
| ^
In file included from <root>/libc/src/stdio/generic/vprintf.cpp:14:
<root>/libc/src/stdio/printf_core/vfprintf_internal.h:44:17: error: expected ')'
44 | LIBC_INLINE int ferror_unlocked(::FILE *f) { return ::ferror_unlocked(f); }
| ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/stdio.h:396:28: note: expanded from macro 'ferror_unlocked'
396 | #define ferror_unlocked(p) __sferror(p)
| ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/stdio.h:284:46: note: expanded from macro '__sferror'
284 | #define __sferror(p) (((p)->_flags & __SERR) != 0)
| ^
<root>/libc/src/stdio/printf_core/vfprintf_internal.h:44:17: note: to match this '('
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/stdio.h:396:28: note: expanded from macro 'ferror_unlocked'
396 | #define ferror_unlocked(p) __sferror(p)
| ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/stdio.h:284:22: note: expanded from macro '__sferror'
284 | #define __sferror(p) (((p)->_flags & __SERR) != 0)
| ^
In file included from <root>/libc/src/stdio/generic/vprintf.cpp:14:
<root>/libc/src/stdio/printf_core/vfprintf_internal.h:44:35: error: definition or redeclaration of 'FILE' cannot name the global scope
44 | LIBC_INLINE int ferror_unlocked(::FILE *f) { return ::ferror_unlocked(f); }
| ~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/stdio.h:396:38: note: expanded from macro 'ferror_unlocked'
396 | #define ferror_unlocked(p) __sferror(p)
| ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/stdio.h:284:25: note: expanded from macro '__sferror'
284 | #define __sferror(p) (((p)->_flags & __SERR) != 0)
| ^
In file included from <root>/libc/src/stdio/generic/vprintf.cpp:14:
<root>/libc/src/stdio/printf_core/vfprintf_internal.h:44:46: error: expected expression
44 | LIBC_INLINE int ferror_unlocked(::FILE *f) { return ::ferror_unlocked(f); }
| ^
<root>/libc/src/stdio/printf_core/vfprintf_internal.h:44:76: error: expected ';' after top level declarator
44 | LIBC_INLINE int ferror_unlocked(::FILE *f) { return ::ferror_unlocked(f); }
| ^
| ;
<root>/libc/src/stdio/printf_core/vfprintf_internal.h:52:10: error: no member named 'fwrite_unlocked' in the global namespace; did you mean simply 'fwrite_unlocked'?
52 | return ::fwrite_unlocked(ptr, size, nmemb, f);
| ^~~~~~~~~~~~~~~~~
| fwrite_unlocked
<root>/libc/src/stdio/printf_core/vfprintf_internal.h:50:20: note: 'fwrite_unlocked' declared here
50 | LIBC_INLINE size_t fwrite_unlocked(const void *ptr, size_t size, size_t nmemb,
| ^
<root>/libc/src/stdio/printf_core/vfprintf_internal.h:65:46: error: expected unqualified-id
65 | if (written != new_str.size() || internal::ferror_unlocked(target_file))
| ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/stdio.h:396:28: note: expanded from macro 'ferror_unlocked'
396 | #define ferror_unlocked(p) __sferror(p)
| ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/stdio.h:284:22: note: expanded from macro '__sferror'
284 | #define __sferror(p) (((p)->_flags & __SERR) != 0)
| ^
14 errors generated.
ninja: build stopped: subcommand failed.
Thank you for your time reviewing this issue!