I have created an iPhone project that uses uses the ZXing bar code scanning library. I added ZXing using CocoaPods and it works perfectly when I compile it on my system (Mountain Lion with Xcode 4.5 (4G182)). But when I passed it on to the person in charge of producing the signed ipa for enterprise distribution, who from what I understand is also using the same version of Xcode, he is seeing the following parse error when compiling:
Parse Issue
Expected unqualified-id in file included from /The/Absolute/Path/to/Pods/ZXing/objc/src/ZXing/ZXBinarizer.mm
The line that is highlighted is:
#import <ZXing/ZXBinarizer.h>
^
I was able to look at his system via WebEx and I checked the header search paths and the values that were apparently configured via CocoaPods do resolve to the actual location of the files.
When I clicked on the "Parse Issue" line in the issue navigator, it showed only:
../../ZXing/objc/src/ZXing/ZXBinarizer.h
^
I've searched the web quite a bit for a solution and I see plenty references to 'Expected unqualified-id', but most of them are due to malformed code.
There are still quite a few things about Xcode that I do not understand, so I'm hoping that someone will tell me that I've overlooked something simple here.
Posting links to the exact code being compiled would help.
You can use clang -E to see what the code looks like after preprocessing (with all the #imports expanded), and then diff the preprocessed output on your system against the output of the same command on your colleague's system.
I do see in
http://code.google.com/p/zxing/source/browse/trunk/objc/src/ZXing/ZXBinarizer.h
that they're referring to NSObject without #importing <Foundation/Foundation.h> first. This is a bad idea, but it's probably not your actual problem. (I would expect a different error message if it were the culprit.)
Are you 100% sure that your colleague is compiling ZXBinarizer.mm as Objective-C++, not as regular C++?
Are you 100% sure that Xcode doesn't give you any specific file and line information for the error? If Xcode really is just pointing to an #import line, then can you post the 10 lines before and after that line, and also the first 10 lines of the file being #imported?
I ended up having to revert out of using CocoaPods for dependency management and just include the project manually. Since the problem was on someone else's machine, but worked fine on my own, I was unable to determine the real cause. After I just included ZXing directly in my project, he was able to compile it.
smcmahon, I've had a very similar issue with building an iOS project with CocoaPods and seeing those weird errors, and was able to figure out the problem. Make sure that the symlinks that CocoaPods has created (like ZXing/ZXBinarizer.h) are indeed symlinks, and not just regular text files with a filepath in them.
A bit more detailed explanation is in my blog: http://www.egeek.me/2013/01/26/note-about-building-cocoapods-powered-ios-projects/
Hope this will help.
Related
When attempting to compile my app, I’m getting an error from the SDK itself:
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "LibcOverlayShims.h"
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/shims/LibcOverlayShims.h:66:10: error: use of undeclared identifier 'errno'
return errno;
^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "LibcOverlayShims.h"
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/swift/shims/LibcOverlayShims.h:70:3: error: use of undeclared identifier 'errno'
errno = value;
^
<unknown>:0: error: could not build Objective-C module 'SwiftOverlayShims'
It almost seems like errno.h isn’t included, but I can see that it is on line 33 of that file. I’ve tried the usual derived data delete, product clean, reinstall Xcode, reboot. I’ve tried stripping parts out of the app to try to see what’s causing it, but haven’t gotten very far.
Edit: An archive of the app appears to trigger it. Running in debug mode is perfectly fine, then I archive and it breaks it. Trying to run from debug again fails. Making random changes to the project file, then running a git reset --hard then allows debug to work again until I try to archive. It seems like something is wrong with the release settings that then carries over into subsequent debug builds (even with a clean)
I ended up figuring this out months later. Our software ships with this folder /usr/local/opt/company_name that contains a few libraries, software packages, etc. Our Swift code links with a number of them, so it was easiest to set Xcode to recursively search that directory for both headers and libraries rather than individually specifying them.
For some rather painful reasons, a copy of python is actually shipped in that folder. Well turns out some header file in that python directory was making Xcode very unhappy and triggering that compiler error. I manually specified the libraries we needed to link against and problem solved.
I have an objc_library rule that tells me that it can't find any SDK framework header (this problem is not specific to IOKit, I can't find any frameworks at all).
#import <IOKit/IOKitLib.h>
fatal error: 'IOKit/IOKitLib.h' file not found
I already have "IOKit" in my sdk_frameworks. If I take a peek in /System/Library/Frameworks/IOKit.framework, I find that there is no directory Headers which would contain this file. Perhaps no surprise if that's where Bazel is looking.
If I look a little harder, I find more results for the SDK.
$ find /Applications/Xcode.app/ -name IOKit.framework
/Applications/Xcode.app//Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/Frameworks/IOKit.framework
/Applications/Xcode.app//Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/IOKit.framework
/Applications/Xcode.app//Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/IOKit.framework
/Applications/Xcode.app//Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/IOKit.framework
/Applications/Xcode.app//Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/System/Library/Frameworks/IOKit.framework
/Applications/Xcode.app//Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdk/MacOSX.sdk/System/Library/Frameworks/IOKit.framework
I would think that this is the one I want, since I'm developing for MacOSX.
/Applications/Xcode.app//Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/IOKit.framework
Can I tell Bazel to use that SDK? Should I have to? How can I figure out where Bazel is looking for these things? I'm pretty familiar with using Bazel, but I'm really not sure how to debug when the most basic of things is failing.
Here is the simplest example that fails.
BUILD:
objc_library(
name = "test",
srcs = ["test.cpp"],
copts = ["-ObjC++"],
sdk_frameworks = ["IOKit"],
)
// test.cpp
#import <IOKit/IOKitLib.h>
I posted this on bazel-discuss, but it isn't getting much traction. I'm using Bazel 0.5.2.
https://groups.google.com/forum/#!topic/bazel-discuss/HhAjKblwHwk
Resolved in the bazel-discuss thread, but I'll summarize here:
The issue you are finding here is most likely because IOKIt is a MacOS-only SDK, and you're building this library for iPhoneSimulator.
(I think the former is the case, anyway. It looks like there is indeed an IOKit.framework directory under iPhoneSimulator9.3.sdk, but it doesn't include headers -- I'm not sure what the point of that is)
Correctly building the library for MacOS is key here and should fix your issues. You can either do that by depending on this library via an apple_binary with platform_type="macos", or you can tailor command line flags to this end. I believe --apple_platform_type=macos --cpu=darwin_x86_64 should do the trick
When i tried to build and run my project im getting this error.I tried may steps like clean and run, check with workspace.project but still im getting the error.No further details were in the error message. "Linker command failed with exit code 1(use -v to see invocation)
There can be many reasons for this problem, sadly with such little knowledge of your project I can only suggest some fixes
Check for any caution messages and try to fix them
This can also be caused by using #import to import an .m file, if you are using this then remove it.
Sometimes this can be caused by frameworks and libraries, If you are using an external or custom framework, you probably need to add it to the "Frameworks" folder inside the application.
Hope this helped but if it didn't I might need some more info on your project.
Go to Project file -> Build Phases and check if there ara any red icons (specially for Compile Sources or Copy Bundle Resources)
Everything's fine building in xcode and testing the app until I built in for archive.
I am capable of running my program in xcode and it does really work.
My problem is that when I tried to archive the project the error come out.
This is the error:
Lexical or Preprocessor Error issue
'TapkuLibrary/TapkuLibrary.h' file not found
Please help!
Do you have different Header search paths for develop/archive/release?
Well I've recently come out of the dark ages and upgraded my GCC from 3.4.4 to 4.5.0 with Cygwin (I use Netbeans 6.8 on Windows for future reference). I tried testing the new compiler by attempting to run a simple program through it. The run failed however, citing that NetBeans "cannot find -lstdc++".
Interesting.
I look in ...
C:\cygwin\lib\gcc\i686-pc-cygwin\4.5.0
...where libstdc++.a, libstdc++.dll.a, libstdc++.la, libsupc++.a, and libsupc++.la are supposed to be (they're in that spot in the 3.4.4 folder), and they're not there. I also notice something else: there's a 4.3.4 folder in...
C:\cygwin\lib\gcc\i686-pc-cygwin
which contains these exact files! Good. So I copy them in to the 4.5.0 folder and try to run the program again. This time i'm getting two other errors:
build/Debug/Cygwin-Windows/extract_fail_operations.o:/usr/lib/gcc/i686-pc-cygwin/4.5.0/include/c++/bits/stl_list.h:1435: undefined reference to `std::_List_node_base::_M_hook(std::_List_node_base*)'
and:
build/Debug/Cygwin-Windows/extract_fail_operations.o:/usr/lib/gcc/i686-pc-cygwin/4.5.0/include/c++/bits/stl_list.h:1451: undefined reference to `std::_List_node_base::_M_unhook()'
At this point I figured that I was way over my head and decided to come for help before copying and pasting any more files. If anyone could tell me how to get this working, i'd be really appreciative.
(If any solutions involve the command line, please be warned that i'm not well versed in it... you may have to provide extra details that you wouldn't need to to other SO users!)
EDIT: The PATH variables are as follows:
C:\Program Files\SSH Communications Security\SSH Secure Shell;C:\Program Files\CVSNT\;C:\cygwin\bin
And yes, the Cygwin installed is the latest from the site.
You need to install version 4.5.0 of libstdc++6-devel.