Iphone Zxing: QR code scanning code not working in Release build - iphone

I have integrated Zxing source code for QR code scanning in my Iphone project.
Until I built Zxing's project in Debug mode, it scans QR codes perfectly but in Release mode, the application is not able to scan the QR code from QR Image.
It just stops scanning QR codes without any error/exception. When we revert our build in Debug mode then it again scans perfectly.
I built Zxing's project in release mode with below mentioned settings:
1. XCode: 4.0.1 Compiler: GCC 4.2 Optimization Level: -O0
2. XCode: 4.0.1 Compiler: GCC 4.2 Optimization Level: -Os
3. XCode: 4.0.1 Compiler: LLVM GCC 4.2 Optimization Level: -O0
4. XCode: 4.0.1 Compiler: LLVM GCC 4.2 Optimization Level: -Os
5. XCode: 4.0.1 Compiler: LLVM compiler 2.0 Optimization Level: -O0
6. XCode: 4.0.1 Compiler: LLVM compiler 2.0 Optimization Level: -Os
7. XCode: 4.2 Compiler: LLVM GCC 4.2 Optimization Level: -O0
8. XCode: 4.2 Compiler: LLVM GCC 4.2 Optimization Level: -Os
9. XCode: 4.2 Compiler: Apple LLVM compiler 3.0 Optimization Level: -O0
10. XCode: 4.2 Compiler: Apple LLVM compiler 3.0 Optimization Level: -Os
I have no clue where the issue is. Any help in this will be very helpful. Thanks..

The ZXing FAQ mentions that Release builds don't work with Xcode prior to 4.2 if you use llvm (llvm-gcc or clang) due to bugs in llvm. Both llvm-gcc and clang have been verified to work in Release mode with Xcode 4.2 and later, at least with ScanTest and Barcodes. I've still seen bugs with C++ and clang with Xcode 4.2 but they don't seem to affect ZXing, at least as seen with ScanTest and Barcodes.
The behavior with respect to the DEBUG symbol you mention is not repeatable on ScanTest or Barcodes. Neither of these projects defines DEBUG. Since defining DEBUG compiles in more debugging code, you may still be seeing an optimization bug.
You don't mention with architecture you're building for (armv6 or armv7). There are reportedly problems with optimizations with armv6 if you don't turn off Thumb mode. The projects in ZXing's svn do this; this change is not yet in any of the ZXing releases.

Related

Using GCC 4.2 in Xcode 4.2 iOS SDK 5.0

I found this post about using GCC 4.2 in Xcode 4.2 StackOverflow Post.
Did anyone else receive the error "Error writing -: Broken pipe" after following the steps in the above post?
After following the steps I can see GCC 4.2 as an option for the compiler.
Compiling a project using LLVM compiler 3.0 still works, but using LLVM GCC 4.2 or GCC 4.2 generates the pipe error.
I hope someone encountered the same problem and managed to fix it!
Simple and userful solution https://github.com/kennethreitz/osx-gcc-installer/
It automates the lists of the declaration on the stackoverflow

Malformed metadata record for architecture i386

I just upgraded from Xcode 4 to Xcode 4.2 and now I'm getting the following error when building for the Simulator:
ld: in /Users/rstaicut/Library/Developer/Xcode/DerivedData/iphone/Build/Intermediates/iphone.build/QA Server-iphonesimulator/Project iPhone Debug.build/Objects-normal/i386/CartController.o, could not parse object file
/Users/rstaicut/Library/Developer/Xcode/DerivedData/iphone/Build/Intermediates/iphone.build/QA Server-iphonesimulator/Project iPhone Debug.build/Objects-normal/i386/CartController.o:
**Malformed metadata record for architecture i386**
**Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1**
One thing to note is that I've changed the compiler to LLVM GCC 4.2 for this upgrade and I'm using armv6 and armv7 for the architectures. I'm only getting this error for the Simulator, the build finishes for the device.
Any ideas what malformed metadata record could mean?
Got the simulator to finally work. These are the things I changed:
Under Project > Build Settings > Architectures > Valid Architectures I took out i386 and left only armv6 and armv7. Under architectures I only have armv6 and armv7
I changed the Compiler from LLVM GCC 4.2 to Apple LLVM compiler 3.0 (Under Project > Build Settings > Build Options > Compiler for C/C++/Objective-C
Changed the iOS Deployment target from iOS 3.1 to iOS 4.0
The last step was to press on "Validate settings" (the button in the middle on the bottom). It's going to ask you to change some settings for the compiler from LLVM GCC to Apple LLVM Compiler 3.0. Hit OK.
My simulator started magically working after that. No errors, though plenty of warnings due to the change in compiler.
Hope this helps anyone else who runs into this issue.

can't compiler json-framework

I'm using json-framework to parse json, but when I compile I get the following errors:
xxx/SBJsonStreamParser.h
xxx/SBJsonStreamParser.h:105: error: expected a property attribute before 'unsafe_unretained'
xxx.h:106: error: expected a property attribute before 'strong'
etc....
Developer Information:
Version: 4.2 (4D199)
Location: /Developer
Applications:
Xcode: 4.2 (828)
Instruments: 4.2 (4233)
Dashcode: 3.0.2 (336)
SDKs:
Mac OS X:
10.6: (10K549)
10.7: (11C63)
iPhone OS:
5.0: (9A334)
iPhone Simulator:
4.3: (8H7)
5.0: (9A334)
Check in your Build Settings/Build Options the compiler: Use the default Apple LLVM compiler 3.0 instead of LLVM GCC 4.2.
Use JSONKit instead, it's faster, has less memory leaks, and it might be easier to switch than debugging this issue.
https://github.com/johnezang/JSONKit

Iphone application build error

I am using XCODE 3.2.5 and getting following error while compiling the code
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1
Here are my settings:
C/C++ compiler version -- LLVM compiler 1.6
Base SDK - 4.2
IOS deployment target - 4.2
What could be wrong here?
The issue was with compiler. It should by GCC for IOS and LLVM for MAC.

Xcode 3.2.2 and LLVM version 1.0.2 failing

I have Xcode 3.2.2 and I am trying to use LLVM version 1.0.2 as a compiler.
When I do that, I see the error
Library not found for -lgcc
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang
failed with exit code 1
How do I solve that?
thanks.
You can't use LLVM to compile iPhone apps in 3.2. You'll need to use GCC.
In fact it seems that you can use LLVM on Xcode 3.2.3. I've just downloaded it now and LLVM works!!!!