Info.plist file processing modifies executable - iphone

I've been working on an iPhone application had an issue where dSYM file generation was seg faulting on me.
GenerateDSYMFile /Users/kaom/Projects/build/Release-iphoneos/NodeAppGen.app.dSYM /Users/kaom/Projects/build/Release-iphoneos/NodeAppGen.app/NodeAppGen
cd /Users/kaom/Projects/Apps/NodeAppGen
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/usr/bin/dsymutil /Users/kaom/Projects/build/Release-iphoneos/NodeAppGen.app/NodeAppGen -o /Users/kaom/Projects/build/Release-iphoneos/NodeAppGen.app.dSYM
Command /Developer/usr/bin/dsymutil failed with exit code 11
I tracked this bug down to an error in the application's Info.plist file.
Instead of
<key>CFBundleVersion</key>
<string>1.0</string>
I had
<key>CFBundleVersion</key>
<real>1.0</real>
To my knowledge, dSYM file generation is only dependent on the executable and the plist file should not affect the executable. So my question is why did this break dSYM file generation?

Look for an error earlier in the build log, possibly one that didn't actually get parsed out as an explicit error by Xcode.
More likely than not, something was chomping on the Info.plist and was mighty confused to find a <real/> instead of a <string/> value.
In any case, file a bug via http://bugreport.applec.om, as having the dev tools produce a useful error message is always desirable.

Related

Programming Arduino with avrdude within Eclipse- cannot find -l/usr/avr

I am trying to program the Arudino Nano from Eclipse. It has the same processor as the Uno (Atmega328p). I have had this working before with the Uno, but have since gotten a new hard drive and had to reinstall/reconfigure everything. I am running Fedora 19 with Eclipse Kepler. I am getting an error in the build process that I don't even know where to start looking to solve, and Google hasn't been much help...
Here is the error:
make all
Building target: Arduino_Template.elf
Invoking: AVR C Linker
avr-gcc -Wl,-Map,Arduino_Template.map -mmcu=atmega328p -o "Arduino_Template.elf" ./Analog.o -l/usr/avr
/usr/lib/gcc/avr/4.8.2/../../../../avr/bin/ld: cannot find -l/usr/avr
collect2: error: ld returned 1 exit status
make: *** [Arduino_Template.elf] Error 1
17:29:38 Build Finished (took 124ms)
Has anyone encountered this before? Or does anyone have any suggestions?
Thanks.
The problem could be described like this:
First, the library should be specified only by its name and without the "lib" prefix and the ".a" suffix. The linker (this is where you get the error) will look for the library within the specified in the project paths and will add whatever is necessary to the file library name. So if the library you need is named mystuff it will look for a file named libmystuff.a.
In your case this is specified by the -l/usr/avr which I think could be misconfiguration or you did not copy/paste the entire error output. With the '-l' option you specify the name only, not the entire path to the file.
Second, the path should be specified, in the project configuration, where to look for the libraries, otherwise the linker will look for the library files only within your own project only. Often libraries are part of another project - so you need to adjust the project configuration accordingly.
I had similar problem and this is how I solved it ...
Go to menu Project/Properties. On left - choose "C/C++ Build". On right - choose the tab "Tool Settings". On the tree view choose "AVR C Linker" then "Libraries" sub-item. You are where you may need to make changes.
The list of "Libraries" is where you add libraries names, such as mystuff.
The Libraries Path is where you specify the paths to the libraries. This may look like this: "${workspace_loc:/mystuff/Release}"
The result of this is that the linker will look for this file: /mystuff/Release/libmystuff.a under you workspace root folder.

Struggling with Xcode 4

I've recently downloaded Xcode 4 and now two of my projects that were working perfectly fine before have started giving me errors. Both errors are effectively to do with linking options, but I can't figure out how to change these options and get rid of the errors.
The first problem is with a project written in C++ using the SDL_ttf and SDL_image frameworks. The project builds correctly, but when I try to run, it gives me the following warnings on the console:
warning: Unable to read symbols for #executable_path/../Frameworks/SDL_ttf.framework/Versions/A/SDL_ttf (file not found).
warning: Unable to read symbols from "SDL_ttf" (not yet mapped into memory).
warning: Unable to read symbols for #executable_path/../Frameworks/SDL_image.framework/Versions/A/SDL_image (file not found).
warning: Unable to read symbols from "SDL_image" (not yet mapped into memory).
Since the files are not being found, the executable cannot load any images making it exit straight away when I try to load images. I think the issue here is that the frameworks are not in the directory above the executable, they are in /Library/Framework/ which worked fine before in Xcode 3.2. How do I resolve this?
The second problem comes when compiling an application I wrote for iOS. Along with giving me a bunch of warnings about depracated code on iOS 5, which I will deal with later, it fails to build due to a linker error which I have no clue how to resolve, it says:
ld: library not found for -lz.1.2.3
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1
I can answer the second question.
-lz.1.2.3
should be
-lz
You might have accidentally added the zlib.1.2.3.dylib to the project's "link binary with libraries" build phase. You should use the standard zlib without any version in its filename, or simply add -lz to the Other Linker Flags under Build Settings and not add zlib in the "link binary with libraries" build phase.
As for the missing frameworks my best guess is that it has to do with the relative path, ie if you can get rid of the /../ part and instead provide an absolute path that might resolve the issue.

Error to compile after to add internationalization iphone

I have a problem. I have a iphone Project in Xcode 4, and I this project compiled perfect, but I have add internationalization to application and now if I try compile the application compile Failed, and give me the next error: "Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1"
"ld: duplicate symbol _OBJC_IVAR_$_Detail.tweets in /Users/user/Library/Developer/Xcode/DerivedData/ApplicationName-cofhylaattdxjreknuzixudblevt/Build/Intermediates/ApplicationName.build/Debug-iphonesimulator/ApplicationName.build/Objects-normal/i386/Detail-7AC84D3333010C52.o and /Users/user/Library/Developer/Xcode/DerivedData/ApplicationName-cofhylaattdxjreknuzixudblevt/Build/Intermediates/ApplicationName.build/Debug-iphonesimulator/ApplicationName.build/Objects-normal/i386/Detail-A96D1FAB88823E17.o for architecture i386"
What I can do to make it work?
Thank you.
Did you accidentally created a localized version of an .m file?
From the error message it sounds like you have two times the same file with your object.
If you did it on purpose because you wanted to localize all those #"words" in your code, you did it wrong.
In that case read the iPhone Applications Localization Guide.

Dyld: Library not loaded

I am trying to link the library libssh2.1.dylib to my iPhone Xcode project but I get this error when I try to link it. If I don't add this as a framework I get Symbols not found error. Now /Users/Matt/Documents/Development/iPhoneApps/Portscanner/lib/libssh2.1.dylib is not the correct pathway to that file. I downloaded the library off the internet and its the pathway of the Author's computer. I have the file located in a totally different place. How do I change the pathway reference? Heres the error I get:
dyld: Library not loaded: /Users/Matt/Documents/Development/iPhoneApps/PortScanner/lib/libssh2.1.dylib
Referenced from: /var/mobile/Applications/5353E047-05FE-42E4-8F32-617E8D02A11D/Port Scanner.app/Port Scanner
Reason: image not found
You can use the install_name_tool to change the installed path name on a .dylib file:
http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/install_name_tool.1.html
Example of changing an install name:
install_name_tool -id <yourpath>/libssh2.1.dylib /Users/Matt/Documents/Development/iPhoneApps/Portscanner/lib/libssh2.1.dylib
first parameter is the path that you want
second parameter is the real path to the file so drag the file in from the Finder
Also you may need to change dependency names too, and you can use the same tool to do that:
install_name_tool -change <old path> <new path> <library name>
You can check what the current names are using the otool. So you can verify the change with the otool like this:
otool -D libssh2.1.dylib and dependencies with otool -L libssh2.1.dylib
Or you can get the source code and rebuild it yourself with the current path in it.
If you need a relative path you should look into changing your install name to #rpath/libssh2.1.dylib and add the path to your project settings.

Xcode compile error: Can't find an (old) file I used to have

This is what happens when I try to compile my iPhone app with Xcode v3.1.4
What in the world does it all mean? (And how do I fix it?)
Processing /Users/carol/Documents/MyApp/build/Release-iphonesimulator/MyApp.app/Info.plist TabBarDemo2-Info.plist
cd /Users/carol/Documents/MyApp
setenv PATH
"/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
<com.apple.tools.info-plist-utility> TabBarDemo2-Info.plist -genpkginfo
/Users/carol/Documents/MyApp/build/Release-iphonesimulator/MyApp.app/PkgInfo -expandbuildsettings -format binary -o /Users/carol/Documents/MyApp/build/Release-iphonesimulator/MyApp.app/Info.plist
error: The file “TabBarDemo2-Info.plist” does not exist.
This means your "TabBarDemo2-info.plist" is no longer available. You need to make another .plist with the same under the name "TabBarDemo2-info.plist" and then give it the properties your previously had and then everything should work fine. Also when it comes to creating new plist do the following:
Add a new file. Then go under Mac OS X > Resource > Property List.