I have seen that there are some topics with the "Cast of Objective-C pointer type 'NSString *' to C pointer type 'CFStringRef'" problem solved, but my case is slightly different.
I am doing some iOS cross compilation from linux and I have a local desktop pc with ubuntu where I can manage to compile without any issues all my code. When I try to port this into a AWS machine I get the following compilation error:
"Cast of Objective-C pointer type 'NSString *' to C pointer type 'CFStringRef'" on this code:
- (NSString *)stringByEscapingQueryString:(NSString *)string { return (NSString *)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)string, NULL, (CFStringRef) @":/?#[]@!$&'()*+,;=", kCFStringEncodingUTF8)); }
using the following compilation command:
arm-apple-darwin11-clang -v -E -I/home/ubuntu/source/common -I/home/ubuntu/source/ios -I/home/ubuntu/source/posix -I/home/ubuntu/generated_include -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -fobjc-arc -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-implicit-atomic-properties -Wno-arc-repeated-use-of-weak -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wno-undeclared-selector -Wno-deprecated-implementations -fstrict-aliasing -Wprotocol -Wno-sign-conversion -Wno-infinite-recursion -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -fmessage-length=0 -fdiagnostics-show-note-include-stack -Wno-infinite-recursion -Wmost -w -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -fobjc-arc -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-implicit-atomic-properties -Wno-arc-repeated-use-of-weak -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wno-undeclared-selector -Wno-deprecated-implementations -fstrict-aliasing -Wprotocol -Wno-sign-conversion -Wno-infinite-recursion -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -fmessage-length=0 -fdiagnostics-show-note-include-stack -Wno-infinite-recursion -Wmost -w -DW_DEBUG=1 -fvisibility=hidden -DBUILD_VARIATION=DEV -DFF_DEBUG_STRING_ID=1 -DFF_CRASH_HANDLING=1 -DGTEST_USE_OWN_TR1_TUPLE=1 -DENGINE_PLATFORM_IOS=1 -DUSECPP11=1 -miphoneos-version-min=6.0 -Wfatal-errors -Wno-return-type -g -arch arm64 -isysroot /home/ubuntu/ios-linux-cross-compile/cctools-port/usage_examples/ios_toolchain/target/SDK/iPhoneOS10.2.sdk -o BFAppLinkNavigation.m.o -c /home/ubuntu/source/ios/BFAppLinkNavigation.m
What's interesting about this is the following:
- Both machines have exactly same LLVM/Clang version: 3.9.1~svn288847-1~exp1
- Both machines are using exact same SDK (iPhoneOS10.2.sdk)
- If I manually add on the AWS machine the "__bridged" attribute on the second parameter everything else compiles properly.
- I have compared the generated code with clang -E and the resulting file is exactly the same.
Do you guys have any idea of what can be done to solve this issue? I can't add the __bridged attribute to the files since OSX is not requiring them and I need to get the same compilation results.
I can provide more details if needed, I have already ran out of ideas :(