# import Foundation =\> could not build Objective-C module 'CoreFoundation'

**URL:** <https://forums.swift.org/t/import-foundation-could-not-build-objective-c-module-corefoundation/4922>\
**Category:** Development\
**Created:** [January 18, 2017, 2:57pm UTC](https://forums.swift.org/t/import-foundation-could-not-build-objective-c-module-corefoundation/4922 "2017-01-18T14:57:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew\_Cornett](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@Andrew\_Cornett](https://forums.swift.org/u/Andrew_Cornett)\
**Post date:** [January 18, 2017, 2:57pm UTC](https://forums.swift.org/t/import-foundation-could-not-build-objective-c-module-corefoundation/4922/1 "2017-01-18T14:57:18Z")

</div>

Has anyone been able to `import Foundation` using a development snapshot on Ubuntu 14.04? I'm getting errors that make it seem like my environment isn't setup correctly, but the same environment works fine for the 3.0.2 release.

```swift
root@a079e93a1c57:/# swift 
Welcome to Swift version 3.1-dev (LLVM 7e421db87c, Clang 8df9d5d9f9, Swift 6f08335ce0). Type :help for assistance.
  1> import Foundation
  
error: /usr/include/x86_64-linux-gnu/sys/types.h:146:10: error: 'stddef.h' file not found
error: /usr/lib/swift/CoreFoundation/CoreFoundation.h:25:10: error: could not build module 'SwiftGlibc'
error: /usr/include/x86_64-linux-gnu/sys/cdefs.h:23:11: error: could not build module 'SwiftGlibc'
error: could not build Objective-C module 'CoreFoundation'

```

I've tried manually providing some include paths to the swift command, which did remove the SwiftGlibc error, but nothing else seems to be working out for me :-(

```swift
root@a079e93a1c57:/# swift -I /usr/include/lldb/Symbol -I /usr/lib/swift/clang/include
Welcome to Swift version 3.1-dev (LLVM 7e421db87c, Clang 8df9d5d9f9, Swift 6f08335ce0). Type :help for assistance.
  1> import Glibc
  2>  
  3> print(random())
1804289383
  4> 
  5> import Foundation
  
error: /usr/lib/swift/CoreFoundation/CoreFoundation.h:26:10: error: 'stdarg.h' file not found
error: /usr/lib/swift/dispatch/dispatch.h:43:10: error: 'stddef.h' file not found
error: could not build Objective-C module 'CoreFoundation'

```

Since the 3.0.2 release version can import Foundation no problem, I'm wondering if there's something I'm missing when setting up a new development snapshot?

---

<div class="post-metadata">

**Author:** ![Tony\_Parker](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/tony_parker/32/273_2.png) [@Tony\_Parker](https://forums.swift.org/u/Tony_Parker)\
**Post date:** [January 18, 2017, 7:50pm UTC](https://forums.swift.org/t/import-foundation-could-not-build-objective-c-module-corefoundation/4922/2 "2017-01-18T19:50:52Z")

</div>

This sounds like we’ve included a header which does not exist on Ubuntu 14.04 in CoreFoundation.h.

> <https://github.com/apple/swift-corelibs-foundation/blob/main/CoreFoundation/Base.subproj/SwiftRuntime/CoreFoundation.h#L36>

but that include has been there since the beginning… (and the sys/types.h include)

- Tony

> **···**
>
> > On Jan 18, 2017, at 6:57 AM, Andrew Cornett via swift-server-dev \<swift-server-dev@swift.org\> wrote:
> > 
> > Has anyone been able to `import Foundation` using a development snapshot on Ubuntu 14.04? I'm getting errors that make it seem like my environment isn't setup correctly, but the same environment works fine for the 3.0.2 release.
> > 
> > ```swift
> > root@a079e93a1c57:/# swift 
> > Welcome to Swift version 3.1-dev (LLVM 7e421db87c, Clang 8df9d5d9f9, Swift 6f08335ce0). Type :help for assistance.
> > 1> import Foundation
> > 
> > error: /usr/include/x86_64-linux-gnu/sys/types.h:146:10: error: 'stddef.h' file not found
> > error: /usr/lib/swift/CoreFoundation/CoreFoundation.h:25:10: error: could not build module 'SwiftGlibc'
> > error: /usr/include/x86_64-linux-gnu/sys/cdefs.h:23:11: error: could not build module 'SwiftGlibc'
> > error: could not build Objective-C module 'CoreFoundation'
> > 
> > ```
> > 
> > I've tried manually providing some include paths to the swift command, which did remove the SwiftGlibc error, but nothing else seems to be working out for me :-(
> > 
> > ```swift
> > root@a079e93a1c57:/# swift -I /usr/include/lldb/Symbol -I /usr/lib/swift/clang/include
> > Welcome to Swift version 3.1-dev (LLVM 7e421db87c, Clang 8df9d5d9f9, Swift 6f08335ce0). Type :help for assistance.
> > 1> import Glibc
> > 2>  
> > 3> print(random())
> > 1804289383
> > 4> 
> > 5> import Foundation
> > 
> > error: /usr/lib/swift/CoreFoundation/CoreFoundation.h:26:10: error: 'stdarg.h' file not found
> > error: /usr/lib/swift/dispatch/dispatch.h:43:10: error: 'stddef.h' file not found
> > error: could not build Objective-C module 'CoreFoundation'
> > 
> > ```
> > 
> > Since the 3.0.2 release version can import Foundation no problem, I'm wondering if there's something I'm missing when setting up a new development snapshot?
> > 
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > swift-server-dev mailing list  
> > swift-server-dev@swift.org  
> > [https://lists.swift.org/mailman/listinfo/swift-server-dev](https://lists.swift.org/mailman/listinfo/swift-server-dev)

---

<div class="post-metadata">

**Author:** ![ddunbar](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ddunbar/32/1933_2.png) [@ddunbar](https://forums.swift.org/u/ddunbar)\
**Post date:** [January 18, 2017, 8:11pm UTC](https://forums.swift.org/t/import-foundation-could-not-build-objective-c-module-corefoundation/4922/3 "2017-01-18T20:11:59Z")

</div>

+Jordan

All of the headers failing there are headers which should be found with the Clang compiler headers, which ship inside the snapshot (and are keyed by compiler version).

- Daniel

> **···**
>
> > On Jan 18, 2017, at 11:50 AM, Tony Parker via swift-server-dev \<swift-server-dev@swift.org\> wrote:
> > 
> > This sounds like we’ve included a header which does not exist on Ubuntu 14.04 in CoreFoundation.h.
> > 
> > [https://github.com/apple/swift-corelibs-foundation/blob/master/CoreFoundation/Base.subproj/SwiftRuntime/CoreFoundation.h#L36](https://github.com/apple/swift-corelibs-foundation/blob/master/CoreFoundation/Base.subproj/SwiftRuntime/CoreFoundation.h#L36)
> > 
> > but that include has been there since the beginning… (and the sys/types.h include)
> > 
> > - Tony
> > 
> > > On Jan 18, 2017, at 6:57 AM, Andrew Cornett via swift-server-dev \<swift-server-dev@swift.org \<mailto:swift-server-dev@swift.org\>\> wrote:
> > > 
> > > Has anyone been able to `import Foundation` using a development snapshot on Ubuntu 14.04? I'm getting errors that make it seem like my environment isn't setup correctly, but the same environment works fine for the 3.0.2 release.
> > > 
> > > ```swift
> > > root@a079e93a1c57:/# swift 
> > > Welcome to Swift version 3.1-dev (LLVM 7e421db87c, Clang 8df9d5d9f9, Swift 6f08335ce0). Type :help for assistance.
> > > 1> import Foundation
> > > 
> > > error: /usr/include/x86_64-linux-gnu/sys/types.h:146:10: error: 'stddef.h' file not found
> > > error: /usr/lib/swift/CoreFoundation/CoreFoundation.h:25:10: error: could not build module 'SwiftGlibc'
> > > error: /usr/include/x86_64-linux-gnu/sys/cdefs.h:23:11: error: could not build module 'SwiftGlibc'
> > > error: could not build Objective-C module 'CoreFoundation'
> > > 
> > > ```
> > > 
> > > I've tried manually providing some include paths to the swift command, which did remove the SwiftGlibc error, but nothing else seems to be working out for me :-(
> > > 
> > > ```swift
> > > root@a079e93a1c57:/# swift -I /usr/include/lldb/Symbol -I /usr/lib/swift/clang/include
> > > Welcome to Swift version 3.1-dev (LLVM 7e421db87c, Clang 8df9d5d9f9, Swift 6f08335ce0). Type :help for assistance.
> > > 1> import Glibc
> > > 2>  
> > > 3> print(random())
> > > 1804289383
> > > 4> 
> > > 5> import Foundation
> > > 
> > > error: /usr/lib/swift/CoreFoundation/CoreFoundation.h:26:10: error: 'stdarg.h' file not found
> > > error: /usr/lib/swift/dispatch/dispatch.h:43:10: error: 'stddef.h' file not found
> > > error: could not build Objective-C module 'CoreFoundation'
> > > 
> > > ```
> > > 
> > > Since the 3.0.2 release version can import Foundation no problem, I'm wondering if there's something I'm missing when setting up a new development snapshot?
> > > 
> > > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > > swift-server-dev mailing list  
> > > swift-server-dev@swift.org \<mailto:swift-server-dev@swift.org\>  
> > > [https://lists.swift.org/mailman/listinfo/swift-server-dev](https://lists.swift.org/mailman/listinfo/swift-server-dev)
> > 
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > swift-server-dev mailing list  
> > swift-server-dev@swift.org  
> > [https://lists.swift.org/mailman/listinfo/swift-server-dev](https://lists.swift.org/mailman/listinfo/swift-server-dev)
