Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Compile error #27

Open
menteb opened this issue Mar 22, 2016 · 15 comments
Open

Compile error #27

menteb opened this issue Mar 22, 2016 · 15 comments

Comments

@menteb
Copy link

menteb commented Mar 22, 2016

Hey Dan,

Compiling the master through Carthage gives me an error:

While building module 'bson' imported from Carthage/Checkouts/libmongoc-xcode/mongoc/mongoc-list-private.h:24:
In file included from :1:
In file included from Carthage/Build/Mac/bson.framework/Headers/bson.h:23:
Carthage/Checkouts/libmongoc-xcode/Carthage/Build/Mac/bson.framework/Headers/bson-compat.h:115:11: error: include of non-modular header inside framework module 'bson.bson_compat' [-Werror,-Wnon-modular-include-in-framework-module]

include <inttypes.h>

      ^

While building module 'bson' imported from Carthage/Checkouts/libmongoc-xcode/mongoc/mongoc-list-private.h:24:
:1:1: warning: umbrella header for module 'bson' does not include header 'b64_ntop.h' [-Wincomplete-umbrella]

include "Headers/bson.h"

^
:1:1: warning: umbrella header for module 'bson' does not include header 'b64_pton.h' [-Wincomplete-umbrella]
:1:1: warning: umbrella header for module 'bson' does not include header 'bson-osx.h' [-Wincomplete-umbrella]
:1:1: warning: umbrella header for module 'bson' does not include header 'bson-stdint-win32.h' [-Wincomplete-umbrella]
4 warnings and 1 error generated.
In file included from Carthage/Checkouts/libmongoc-xcode/mongoc/mongoc-list.c:18:
Carthage/Checkouts/libmongoc-xcode/mongoc/mongoc-list-private.h:24:10: fatal error: could not build module 'son'

include <bson/bson.h>

4 warnings and 2 errors generated.

I did update to the latest OSX, Xcode & command line tools, did a brew upgrade too.

@Danappelxx
Copy link
Owner

Hi, sorry for the late response. A couple things:

  1. I would appreciated it if you wrapped the block with '```', so I can actually see the error message.
  2. What version of Xcode do you have?
  3. What version of Carthage do you have?
  4. What's your Cartfile?

@menteb
Copy link
Author

menteb commented Mar 25, 2016

I've uploaded the compiler output.
I'm using Xcode 7.3(7D175) and Carthage 0.15.2.
My Cartfile just reads: github "Danappelxx/SwiftMongoDB" "master"

carthage-xcodebuild.Z237mS.txt

@Danappelxx
Copy link
Owner

Hmm... I don't really know why this is happening, especially considering I didn't make any changes on master in quite a while. It's most likely that this is a bug in Xcode, but I can't test it out on my own because my Carthage broke with the latest update... Sorry about that, don't really know what I can do.

@bensyverson
Copy link
Contributor

I'm seeing some issues as well… With the 2016-03-01 snapshot of Swift, and after running brew install libbson, I get:

<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/usr/local/include/libbson-1.0/bson.h"
        ^
/usr/local/include/libbson-1.0/bson.h:47:10: note: in file included from /usr/local/include/libbson-1.0/bson.h:47:
#include "bcon.h"
         ^
/usr/local/include/libbson-1.0/bcon.h:24:10: error: 'bson.h' file not found with <angled> include; use "quotes" instead
#include <bson.h>
         ^
/Users/ben/Sync/Sync2/development/Cashish/Packages/BinaryJSON-1.1.4/Sources/BinaryJSON/Context.swift:9:8: error: could not build Objective-C module 'CBSON'

Checking /usr/local/include/libbson-1.0, the headers are there…

@Danappelxx
Copy link
Owner

Ah, module maps were broken in that snapshot. The modulemap very clearly says to ignore that header...

module CBSON [system] {
    header "/usr/local/include/libbson-1.0/bson.h"
    exclude header "/usr/local/include/libbson-1.0/bcon.h"
    link "bson-1.0"
    export *
}

Try using 02-08 instead @bensyverson :)

@bensyverson
Copy link
Contributor

Yeah, it's strange, and the 03-24 snapshot is broken as well. It's too bad—I'm developing a Kitura application and need to use a newer snapshot than 02-08. I noticed that BinaryJSON needs a few updates for Swift 3 as well. I'll refactor a bit and use CouchDB for now, but I'll keep an eye on this repo!

@adrianbrink
Copy link
Contributor

This problem still exists on the newest snapshot (04-12).

→ swift build
Compiling Swift Module 'BinaryJSON' (9 sources)
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/usr/local/include/libbson-1.0/bson.h"
        ^
/usr/local/include/libbson-1.0/bson.h:48:10: note: in file included from /usr/local/include/libbson-1.0/bson.h:48:
#include "bcon.h"
         ^
/usr/local/include/libbson-1.0/bcon.h:24:10: error: 'bson.h' file not found with <angled> include; use "quotes" instead
#include <bson.h>
         ^
/Users/aevitas/Desktop/Coding/Swift/Server/test/Packages/BinaryJSON-1.1.5/Sources/BinaryJSON/Context.swift:9:8: error: could not build Objective-C module 'CBSON'
import CBSON
       ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/usr/local/include/libbson-1.0/bson.h"
        ^
/usr/local/include/libbson-1.0/bson.h:48:10: note: in file included from /usr/local/include/libbson-1.0/bson.h:48:
#include "bcon.h"
         ^
/usr/local/include/libbson-1.0/bcon.h:24:10: error: 'bson.h' file not found with <angled> include; use "quotes" instead
#include <bson.h>
         ^
/Users/aevitas/Desktop/Coding/Swift/Server/test/Packages/BinaryJSON-1.1.5/Sources/BinaryJSON/Context.swift:9:8: error: could not build Objective-C module 'CBSON'
import CBSON
       ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/usr/local/include/libbson-1.0/bson.h"
        ^
/usr/local/include/libbson-1.0/bson.h:48:10: note: in file included from /usr/local/include/libbson-1.0/bson.h:48:
#include "bcon.h"
         ^
/usr/local/include/libbson-1.0/bcon.h:24:10: error: 'bson.h' file not found with <angled> include; use "quotes" instead
#include <bson.h>
         ^
/Users/aevitas/Desktop/Coding/Swift/Server/test/Packages/BinaryJSON-1.1.5/Sources/BinaryJSON/Context.swift:9:8: error: could not build Objective-C module 'CBSON'
import CBSON
       ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/usr/local/include/libbson-1.0/bson.h"
        ^
/usr/local/include/libbson-1.0/bson.h:48:10: note: in file included from /usr/local/include/libbson-1.0/bson.h:48:
#include "bcon.h"
         ^
/usr/local/include/libbson-1.0/bcon.h:24:10: error: 'bson.h' file not found with <angled> include; use "quotes" instead
#include <bson.h>
         ^
/Users/aevitas/Desktop/Coding/Swift/Server/test/Packages/BinaryJSON-1.1.5/Sources/BinaryJSON/Context.swift:9:8: error: could not build Objective-C module 'CBSON'
import CBSON
       ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/usr/local/include/libbson-1.0/bson.h"
        ^
/usr/local/include/libbson-1.0/bson.h:48:10: note: in file included from /usr/local/include/libbson-1.0/bson.h:48:
#include "bcon.h"
         ^
/usr/local/include/libbson-1.0/bcon.h:24:10: error: 'bson.h' file not found with <angled> include; use "quotes" instead
#include <bson.h>
         ^
/Users/aevitas/Desktop/Coding/Swift/Server/test/Packages/BinaryJSON-1.1.5/Sources/BinaryJSON/Context.swift:9:8: error: could not build Objective-C module 'CBSON'
import CBSON
       ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/usr/local/include/libbson-1.0/bson.h"
        ^
/usr/local/include/libbson-1.0/bson.h:48:10: note: in file included from /usr/local/include/libbson-1.0/bson.h:48:
#include "bcon.h"
         ^
/usr/local/include/libbson-1.0/bcon.h:24:10: error: 'bson.h' file not found with <angled> include; use "quotes" instead
#include <bson.h>
         ^
/Users/aevitas/Desktop/Coding/Swift/Server/test/Packages/BinaryJSON-1.1.5/Sources/BinaryJSON/Context.swift:9:8: error: could not build Objective-C module 'CBSON'
import CBSON
       ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/usr/local/include/libbson-1.0/bson.h"
        ^
/usr/local/include/libbson-1.0/bson.h:48:10: note: in file included from /usr/local/include/libbson-1.0/bson.h:48:
#include "bcon.h"
         ^
/usr/local/include/libbson-1.0/bcon.h:24:10: error: 'bson.h' file not found with <angled> include; use "quotes" instead
#include <bson.h>
         ^
/Users/aevitas/Desktop/Coding/Swift/Server/test/Packages/BinaryJSON-1.1.5/Sources/BinaryJSON/Context.swift:9:8: error: could not build Objective-C module 'CBSON'
import CBSON
       ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/usr/local/include/libbson-1.0/bson.h"
        ^
/usr/local/include/libbson-1.0/bson.h:48:10: note: in file included from /usr/local/include/libbson-1.0/bson.h:48:
#include "bcon.h"
         ^
/usr/local/include/libbson-1.0/bcon.h:24:10: error: 'bson.h' file not found with <angled> include; use "quotes" instead
#include <bson.h>
         ^
/Users/aevitas/Desktop/Coding/Swift/Server/test/Packages/BinaryJSON-1.1.5/Sources/BinaryJSON/Context.swift:9:8: error: could not build Objective-C module 'CBSON'
import CBSON
       ^
<unknown>:0: error: build had 1 command failures
error: exit(1): /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-04-12-a.xctoolchain/usr/bin/swift-build-tool -f /Users/aevitas/Desktop/Coding/Swift/Server/test/.build/debug.yaml default

Also, I would recommend adding a small note to the readme.md that one has to install mongo-c first. :-)

Any idea though on how to fix this?

@Danappelxx
Copy link
Owner

For SPM, you need to add a few flags... swift build -Xcc -I/usr/local/include/libbson-1.0. Also, I don't directly support 04-12 so there might be some compiler warnings (no errors). Regarding mongoc, it would be awesome if you could submit a pr with that :)

@simontaen
Copy link

Hey Dan! There still seem to be issues with BinaryJSON, not sure what to do...

mbp-simon:SODB simon$ swift build -Xcc -I/usr/local/include/libbson-1.0
Cloning https://github.com/Danappelxx/SwiftMongoDB
Resolved version: 0.5.0
Cloning https://github.com/PureSwift/CBSON.git
Resolved version: 1.1.1
Cloning https://github.com/Danappelxx/CMongoC.git
Resolved version: 0.1.0
Cloning https://github.com/Danappelxx/BinaryJSON
Resolved version: 1.1.5
Compiling Swift Module 'BinaryJSON' (9 sources)
Compiling Swift Module 'MongoDB' (7 sources)
/SODB/Packages/MongoDB-0.5.0/Sources/Client.swift:10:19: error: no such module 'BinaryJSON'
@_exported import BinaryJSON
^
/SODB/Packages/MongoDB-0.5.0/Sources/Client.swift:10:19: error: no such module 'BinaryJSON'
@_exported import BinaryJSON
^
/SODB/Packages/MongoDB-0.5.0/Sources/Client.swift:10:19: error: no such module 'BinaryJSON'
@_exported import BinaryJSON
^
/SODB/Packages/MongoDB-0.5.0/Sources/Client.swift:10:19: error: no such module 'BinaryJSON'
@_exported import BinaryJSON
^
/SODB/Packages/MongoDB-0.5.0/Sources/Client.swift:10:19: error: no such module 'BinaryJSON'
@_exported import BinaryJSON
^
/SODB/Packages/MongoDB-0.5.0/Sources/Client.swift:10:19: error: no such module 'BinaryJSON'
@_exported import BinaryJSON
^
/SODB/Packages/MongoDB-0.5.0/Sources/Client.swift:10:19: error: no such module 'BinaryJSON'
@_exported import BinaryJSON
^
unknown:0: error: build had 1 command failures
error: exit(1): /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a.xctoolchain/usr/bin/swift-build-tool -f /SODB/.build/debug.yaml default

@Danappelxx
Copy link
Owner

That doesn't make any sense... Totally looks like an SPM bug. Can you run swift build --clean=dist and try again?

@simontaen
Copy link

Nope, same issue.

I'm running DEVELOPMENT-SNAPSHOT-2016-03-24-a on 10.11.3 , anyway I can verify it works? Or should I use a different version?

$ swiftenv version
DEVELOPMENT-SNAPSHOT-2016-03-24-a

@Danappelxx
Copy link
Owner

Huh, I can't reproduce on OSX 10.11.4.

>swiftenv local DEVELOPMENT-SNAPSHOT-2016-03-24-a
>swift build -Xcc -I/usr/local/include/libbson-1.0/ -Xlinker -L/usr/local/lib                      
Cloning https://github.com/Danappelxx/SwiftMongoDB.git
Resolved version: 0.5.0
Cloning https://github.com/PureSwift/CBSON.git
Resolved version: 1.1.1
Cloning https://github.com/Danappelxx/CMongoC.git
Resolved version: 0.1.0
Cloning https://github.com/Danappelxx/BinaryJSON
Resolved version: 1.1.5
Compiling Swift Module 'BinaryJSON' (9 sources)
Compiling Swift Module 'MongoDB' (7 sources)
Compiling Swift Module 'test' (1 sources)
Linking .build/debug/test

with the package.swift

import PackageDescription
let package = Package(
    name: "test",
    dependencies: [
        .Package(url: "https://github.com/Danappelxx/SwiftMongoDB.git", majorVersion: 0, minor: 5)
    ]
)

I don't know what's going on. Can you run the same thing with the -v flag and paste the output into a gist?

@simontaen
Copy link

Sure, check it here.

Still the BinaryJSON that's not compiling correctly

@vsouza
Copy link

vsouza commented Jul 13, 2016

I'm also in trouble :(

swift build -Xcc -I/usr/local/include/libbson-1.0/ -Xlinker -L/usr/local/lib -v
/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a.xctoolchain/usr/bin/swiftc --driver-mode=swift -I /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a.xctoolchain/usr/lib/swift/pm -L /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a.xctoolchain/usr/lib/swift/pm -lPackageDescription -target x86_64-apple-macosx10.10 /Users/vsouza/Swift/awesomeios-service/Package.swift -fileno 3
/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/module.modulemap:116:11: error: header 'stdatomic.h' not found
                        header "stdatomic.h" // note: supplied by the compiler
                               ^
<unknown>:0: error: could not build Objective-C module 'Darwin'
error: exit(1): /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a.xctoolchain/usr/bin/swiftc --driver-mode=swift -I /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a.xctoolchain/usr/lib/swift/pm -L /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a.xctoolchain/usr/lib/swift/pm -lPackageDescription -target x86_64-apple-macosx10.10 /Users/vsouza/Swift/awesomeios-service/Package.swift -fileno 3

@carlhung
Copy link

i got the same error.
error: header 'stdatomic.h' not found

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

No branches or pull requests

7 participants