-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[SR-1412] Cannot compile Foundation on ARM #4353
Comments
<stdio.h> really shouldn't be defining |
Comment by Ryan Lovelett (JIRA) I thought the same thing until I opened up #if defined __USE_XOPEN || defined __USE_XOPEN2K8
# ifdef __GNUC__
# ifndef _VA_LIST_DEFINED
typedef _G_va_list va_list;
# define _VA_LIST_DEFINED
# endif
# else
# include <stdarg.h>
# endif
#endif
Not sure what you mean about the proper header though. I assume the proper header is |
…no, it's not. They assume that any Maybe you should just disable |
Comment by Ryan Lovelett (JIRA) Doh. You are right it is not. I thought I was not SSH-ed on the Pi when I looked. Sorry for the confusion. |
Comment by Ryan Lovelett (JIRA) It also seems unfortunate that the clang header <stdarg.h> defines |
Ah, yeah, that might be a better way around this. Just unconditionally defined |
Comment by Ryan Lovelett (JIRA) Sadly that did not do the trick. Now it is stranger. I added /home/ryan/Source/build/Ninja-ReleaseAssert/swift-linux-armv7/bin/swift -frontend -c Foundation/NSObject.swift Foundation/NSAffineTransform.swift Foundation/NSArray.swift Foundation/NSAttributedString.swift Foundation/NSBundle.swift Foundation/NSByteCountFormatter.swift Foundation/NSCache.swift Foundation/NSCalendar.swift Foundation/NSCFArray.swift Foundation/NSCFDictionary.swift Foundation/NSCFSet.swift Foundation/NSCFString.swift Foundation/NSCharacterSet.swift Foundation/NSCoder.swift Foundation/NSComparisonPredicate.swift Foundation/NSCompoundPredicate.swift Foundation/NSConcreteValue.swift Foundation/NSData.swift Foundation/NSDate.swift Foundation/NSDateComponentsFormatter.swift Foundation/NSDateFormatter.swift Foundation/NSDateIntervalFormatter.swift Foundation/NSDecimal.swift Foundation/NSDecimalNumber.swift Foundation/NSDictionary.swift Foundation/NSEnergyFormatter.swift Foundation/NSEnumerator.swift Foundation/NSError.swift Foundation/NSExpression.swift Foundation/NSFileHandle.swift Foundation/NSFileManager.swift Foundation/NSFormatter.swift Foundation/NSGeometry.swift Foundation/NSHost.swift Foundation/NSHTTPCookie.swift Foundation/NSHTTPCookieStorage.swift Foundation/NSIndexPath.swift Foundation/NSIndexSet.swift Foundation/NSJSONSerialization.swift Foundation/NSKeyedCoderOldStyleArray.swift Foundation/NSKeyedArchiver.swift Foundation/NSKeyedUnarchiver.swift Foundation/NSLengthFormatter.swift Foundation/NSLocale.swift Foundation/NSLock.swift Foundation/NSLog.swift Foundation/NSMassFormatter.swift Foundation/NSNotification.swift Foundation/NSNotificationQueue.swift Foundation/NSNull.swift Foundation/NSNumber.swift Foundation/NSNumberFormatter.swift Foundation/NSObjCRuntime.swift Foundation/NSOperation.swift Foundation/NSOrderedSet.swift Foundation/NSPathUtilities.swift Foundation/NSPersonNameComponents.swift Foundation/NSPersonNameComponentsFormatter.swift Foundation/NSPort.swift Foundation/NSPortMessage.swift Foundation/NSPredicate.swift Foundation/NSProcessInfo.swift Foundation/NSProgress.swift Foundation/NSPropertyList.swift Foundation/NSRange.swift Foundation/NSRegularExpression.swift Foundation/NSRunLoop.swift Foundation/NSScanner.swift Foundation/NSSet.swift Foundation/NSSortDescriptor.swift Foundation/NSSpecialValue.swift Foundation/NSStream.swift Foundation/NSString.swift Foundation/String.swift Foundation/NSSwiftRuntime.swift Foundation/NSTask.swift Foundation/NSTextCheckingResult.swift Foundation/NSThread.swift Foundation/NSTimer.swift Foundation/NSTimeZone.swift Foundation/NSURL.swift Foundation/NSURLAuthenticationChallenge.swift Foundation/NSURLCache.swift Foundation/NSURLCredential.swift Foundation/NSURLCredentialStorage.swift Foundation/NSURLError.swift Foundation/NSURLProtectionSpace.swift Foundation/NSURLProtocol.swift Foundation/NSURLRequest.swift Foundation/NSURLResponse.swift Foundation/NSURLSession.swift Foundation/NSUserDefaults.swift Foundation/NSUUID.swift Foundation/NSValue.swift Foundation/NSXMLDocument.swift Foundation/NSXMLDTD.swift Foundation/NSXMLDTDNode.swift -primary-file Foundation/NSXMLElement.swift Foundation/NSXMLNode.swift Foundation/NSXMLNodeOptions.swift Foundation/NSXMLParser.swift Foundation/FoundationErrors.swift -Xcc -D_VA_LIST_DEFINED -I/home/ryan/Source/build/Ninja-ReleaseAssert/swift-linux-armv7/lib/swift/linux -Xcc -fblocks -target armv7-unknown-linux-gnueabihf -Ibootstrap/common/usr/include -Ibootstrap/common/usr/local/include -Ibootstrap/armv7-linux-gnueabihf/usr/include -Ibootstrap/armv7-linux-gnueabihf/usr/local/include -O -I../build/Ninja-ReleaseAssert/foundation-linux-armv7/Foundation -I../build/Ninja-ReleaseAssert/foundation-linux-armv7/Foundation/usr/lib/swift -I../build/Ninja-ReleaseAssert/foundation-linux-armv7 -I../build/Ninja-ReleaseAssert/foundation-linux-armv7/Foundation/usr/lib/swift -I/usr/include/libxml2 -I/home/ryan/Source/build/Ninja-ReleaseAssert/xctest-linux-armv7 -L/home/ryan/Source/build/Ninja-ReleaseAssert/xctest-linux-armv7 -I/usr/include/libxml2 -module-name Foundation -module-link-name Foundation -o ../build/Ninja-ReleaseAssert/foundation-linux-armv7/Foundation/Foundation/NSXMLElement.swift.o -emit-module-path ../build/Ninja-ReleaseAssert/foundation-linux-armv7/Foundation/Foundation/NSXMLElement.swift.o.~partial.swiftmodule -emit-module-doc-path ../build/Ninja-ReleaseAssert/foundation-linux-armv7/Foundation/Foundation/NSXMLElement.swift.o.~partial.swiftdoc -emit-dependencies-path ../build/Ninja-ReleaseAssert/foundation-linux-armv7/Foundation/Foundation/NSXMLElement.swift.o.d -emit-reference-dependencies-path ../build/Ninja-ReleaseAssert/foundation-linux-armv7/Foundation/Foundation/NSXMLElement.swift.o.swiftdeps -module-cache-path ../build/Ninja-ReleaseAssert/foundation-linux-armv7 Now it fails after apparently importing <stdarg.h> twice. What? <module-includes>:1:10: note: in file included from <module-includes>:1:
#include "CoreFoundation.h"
^
/home/ryan/Source/swift-corelibs-foundation/../build/Ninja-ReleaseAssert/foundation-linux-armv7/Foundation/usr/lib/swift/CoreFoundation/CoreFoundation.h:58:10: note: in file included from /home/ryan/Source/swift-corelibs-foundation/../build/Ninja-ReleaseAssert/foundation-linux-armv7/Foundation/usr/lib/swift/CoreFoundation/CoreFoundation.h:58:
#include <CoreFoundation/CFCalendar.h>
^
/home/ryan/Source/swift-corelibs-foundation/../build/Ninja-ReleaseAssert/foundation-linux-armv7/Foundation/usr/lib/swift/CoreFoundation/CFCalendar.h:21:10: note: in file included from /home/ryan/Source/swift-corelibs-foundation/../build/Ninja-ReleaseAssert/foundation-linux-armv7/Foundation/usr/lib/swift/CoreFoundation/CFCalendar.h:21:
#include <CoreFoundation/CFTimeZone.h>
^
/home/ryan/Source/swift-corelibs-foundation/../build/Ninja-ReleaseAssert/foundation-linux-armv7/Foundation/usr/lib/swift/CoreFoundation/CFTimeZone.h:23:10: note: in file included from /home/ryan/Source/swift-corelibs-foundation/../build/Ninja-ReleaseAssert/foundation-linux-armv7/Foundation/usr/lib/swift/CoreFoundation/CFTimeZone.h:23:
#include <CoreFoundation/CFString.h>
^
/home/ryan/Source/swift-corelibs-foundation/../build/Ninja-ReleaseAssert/foundation-linux-armv7/Foundation/usr/lib/swift/CoreFoundation/CFString.h:265:123: error: reference to 'va_list' is ambiguous
CFStringRef CFStringCreateWithFormatAndArguments(CFAllocatorRef alloc, CFDictionaryRef formatOptions, CFStringRef format, va_list arguments) CF_FORMAT_FUNCTION(3,0);
^
/home/ryan/Source/build/Ninja-ReleaseAssert/swift-linux-armv7/lib/swift/clang/include/stdarg.h:30:27: note: candidate found by name lookup is 'va_list'
typedef __builtin_va_list va_list;
^
/home/ryan/Source/build/Ninja-ReleaseAssert/swift-linux-armv7/lib/swift/clang/include/stdarg.h:30:27: note: candidate found by name lookup is 'va_list'
typedef __builtin_va_list va_list; |
Comment by Ryan Lovelett (JIRA)
I will not pretend I understand why that works. (Added my |
VA_LIST is a web of typedefs and if Clang can't trace all the threads and find out that they're the same (builtin) type, it fails. I managed to resolve this by editing lib/swift/clang/include/stdarg.h #ifndef __STDARG_H
#define __STDARG_H
#ifndef _VA_LIST
#include <_G_config.h> // <---- This is the line. Must precede the typedef.
typedef __builtin_va_list va_list;
#define _VA_LIST
#endif Also, you'll need to add an #include <cstdarg> with the other standard includes in CoreFoundation/Base.subProj/CoreFoundation.h |
Comment by Robert F. Dickerson (JIRA) I can confirm that you solution above works to eventually build Foundation. However as the compilation proceeds at the llbuild step, the following `memory corruption` error occurs:
|
Looks like we can just remove the stdio include. I'm not confident about it - it doesn't seem like it'd addressing the underlying issue (I think clang's being weird because this is in the CF module includes), but apparently we didn't need this include anyway so it's some kind of fix. |
This old bug appears to be fixed or no longer relevant. |
Attachment: Download
Environment
OS: Ubuntu 16.04 xenial
Kernel: armv7l Linux 4.4.0-1009-raspi2
CPU: ARMv7 rev 5 (v7l) @ 900MHz
Additional Detail from JIRA
md5: 2400e3dbf340591e3f5a4c7b90f5bf16
Issue Description:
While compiling CFString on ARM (Raspberry Pi 2) I am running into a perplexing issue. It appears that the
va_list
typedef is being defined multiple times.It would seem that
va_list
is being defined by multiple things in the include path.The text was updated successfully, but these errors were encountered: