Open vhbit opened 7 years ago
I'm aware of this exact issue, and working on a fix right now, PR for it should come pretty soon.
The relevant PR is merged, closing this issue.
Tested on master
- the issue is still present. It seems xcbuild
misses some steps and also too aggressive in parallelising them.
First of all, it usually fails a couple of times when starting compiling Swift sources, it seems it happens because not all headers are copied/processed? In Xcode there are 2 actions shown before Swift compilation: "Write auxiliary files" and "Create product structure".
If I run build again and again at some point it goes through and builds Swift module but still fails in Obj-C part with the same error as before fatal error: 'Nimble/Nimble-Swift.h' file not found
.
From the quick look the difference with Xcode build is that the latter after building Swift does the following for all architectures:
Ditto /Users/vhbit/Library/Developer/Xcode/DerivedData/Nimble-geamnsituxelwdbwhhulkgurwaku/Build/Products/Debug-iphonesimulator/Nimble.framework/Headers/Nimble-Swift.h /Users/vhbit/Library/Developer/Xcode/DerivedData/Nimble-geamnsituxelwdbwhhulkgurwaku/Build/Intermediates/Nimble.build/Debug-iphonesimulator/Nimble-iOS.build/Objects-normal/i386/Nimble-Swift.h
cd /Users/vhbit/projects/external/Nimble
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/usr/bin/ditto -rsrc /Users/vhbit/Library/Developer/Xcode/DerivedData/Nimble-geamnsituxelwdbwhhulkgurwaku/Build/Intermediates/Nimble.build/Debug-iphonesimulator/Nimble-iOS.build/Objects-normal/i386/Nimble-Swift.h /Users/vhbit/Library/Developer/Xcode/DerivedData/Nimble-geamnsituxelwdbwhhulkgurwaku/Build/Products/Debug-iphonesimulator/Nimble.framework/Headers/Nimble-Swift.h
But doing that manually still doesn't help, more likely that's related to a different clang
invocation. Here is what is missing in xcbuild
invocation:
-gmodules
-fbuild-session-file=/Users/vhbit/Library/Developer/Xcode/DerivedData/ModuleCache/Session.modulevalidation
-fmodules-validate-once-per-build-session
-Xclang -fmodule-implementation-of
-Xclang Nimble
-I/Users/vhbit/Library/Developer/Xcode/DerivedData/Nimble-geamnsituxelwdbwhhulkgurwaku/Build/Intermediates/Nimble.build/Debug-iphonesimulator/Nimble-iOS.build/Nimble-all-non-framework-target-headers.hmap
-ivfsoverlay /Users/vhbit/Library/Developer/Xcode/DerivedData/Nimble-geamnsituxelwdbwhhulkgurwaku/Build/Intermediates/Nimble.build/all-product-headers.yaml
--serialize-diagnostics /Users/vhbit/Library/Developer/Xcode/DerivedData/Nimble-geamnsituxelwdbwhhulkgurwaku/Build/Intermediates/Nimble.build/Debug-iphonesimulator/Nimble-iOS.build/Objects-normal/i386/NMBStringify.dia
(if it'll be helpful, here is full list of args)
I had no time to play more yet, but it seems that missing ditto
+ -ivfsoverlay
are real show stoppers for Obj-C part.
Steps to reproduce:
at some point it fails with:
My guess would be that in case of mixed code Swift module has to be built first.
xcbuild
was built from 9754643ae0c237593292af22b7332110268edb62