In XCode 9 (running the app from XCode) I am getting this build error:
Typedef redefinition with different types (‘uint_least16_t’ (aka ‘unsigned short’) vs ‘char16_t’)
On the line of import of the generated [Target]-Swift.h header (we have swift code used in obj-c code).
I tried changing the “C++ Language Dialect” from “Compiler Default” to anything above C++ 98 and it solved the build issue in XCode, but now the gradle build fails with this error:
The following build commands failed:
CompileC /[path]/build/moe/xcodebuild/obj/Muvix.build/Release-iphoneos/[…].build/Objects-normal/armv7/[…].o [path]/[…].m normal armv7 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
:[…]:moeMainReleaseIphoneosXcodeBuild FAILED
So, what compiler dialect should I choose and how do I make it work in gradle too?
It’s not so clear in the explanation… it says to download the samples first… And then it says “Import the project into your favorite IDE”, do I need to re-import?
If you are testing your project, just update the moe-gradle plugin version to 1.4.+, and then call gradlew moeUpdateXcodeSettings. If you are using Maven, you should also update it to 1.4.0.
After this, your app should work with MOE 1.4 and Xcode 9. If not, please let us know.
Still getting the same error when running gradlew moeIpaBuild from command line:
The following build commands failed:
CompileC /[path]/build/moe/xcodebuild/obj/Muvix.build/Release-iphoneos/[…].build/Objects-normal/armv7/[…].o [path]/[…].m normal armv7 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
And BTW, the moeUpdateXcodeSettings didn’t change anything in my files… was it supposed to?
BTW 2, the simple ‘gradlew build’ succeeds… only the moeIpaBuild fails.
I deleted the ‘build’ folder before building, if that matters.
Also, archiving from Xcode works (after changing the compiler to gnu 17)
Where do you import this Swift header? In ObjC code? Can you regenerate it with Xcode 9?
Could you provide a short Swift code snippet that is similar to the one you try to interface into ObjC and causes this error with moeIpaBuild? This would be a great help for us to reproduce this issue.
Yes, in ObjC code. I think it’s regenerated every time I build, no?
Anyway, when I change the compiler dialect to “gnu 17” in xcode settings then I don’t get this error, but I get an error in command line build.
I will try to make you a sample. should I change the compiler dialect to “gnu 17” or leave it on “default” in my project?
I think this is happening because we have set in the build settings “Compile Sources As = Objective-C++” (without that we get a million build errors).
If I set this setting in a vanilla MOE project, I get the compile error in Xcode, but when I change the Compiler Dialect to gnu11 then it works both in Xcode and the command line.