Cocos2d 2.x ARC issue on device - xcode

I'm working on a game that has cocos2d with ARC.
The game builds & runs fine in Simulator, but when I build for device I get Apple Mac-O Linker Errors, saying that I'm missing the libraries for libcocos2d.a etc.
clang: error: no such file or directory: '/Users/aleksandartrpeski/Library/Developer/Xcode/DerivedData/jellyfish-fsomqwhqasishxcfzhgvccrdvzpt/Build/Products/Debug-iphoneos/libcocos2d.a'
clang: error: no such file or directory: '/Users/aleksandartrpeski/Library/Developer/Xcode/DerivedData/jellyfish-fsomqwhqasishxcfzhgvccrdvzpt/Build/Products/Debug-iphoneos/libCocosDenshion.a'
clang: error: no such file or directory: '/Users/aleksandartrpeski/Library/Developer/Xcode/DerivedData/jellyfish-fsomqwhqasishxcfzhgvccrdvzpt/Build/Products/Debug-iphoneos/libkazmath.a'
clang: error: no such file or directory: '/Users/aleksandartrpeski/Library/Developer/Xcode/DerivedData/jellyfish-fsomqwhqasishxcfzhgvccrdvzpt/Build/Products/Debug-iphoneos/liblibpng.a'
When I go to the folder where the file is missing I only see jellyfish.app.
I don't have much experience in this kind of issues & I'm not clear why this happens,
I checked how to start the project from TinyTimGames & LearnCocos2D, still not clear what I'm doing wrong.

I've solved the issue, the builds for the binaries were somehow ignored by XCode because they were for another architecture, by settings the build settings for the cocos2d target Build For Active Architectures Only to NO, the issue dissapeared.

Sounds like you'll have to add these libraries to the Link Binary With Libraries build phase.
See my tutorial on Enabling ARC for Cocos2D projects for details.
It's strange that it would work for the Simulator though, since it's using the same target. I wouldn't rule out that the device is incompatible, you'll have to have at least a 3rd generation (iPhone 3GS) device running iOS 4.0 or higher.

Related

building for UIKitForMac, but linking in .tbd built for macOS

I'm trying to compile my iOS app to work on macOS and after checking the Mac checkbox, I'm getting this error on compile:
d: building for UIKitForMac, but linking in .tbd built for macOS, file '/Users/jan/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks//GLKit.framework/GLKit.tbd' for architecture x86_64
Any idea what it means and how to fix it?
Though I've not had this particular error I have had similar ones when trying to port from iPad to UIKitForMac. UIKitForMac appears to be the iOS SDK built for x86_64 when you're linking with frameworks. As a result it shouldn't be trying to pull the x86_64 files from the macOS SDK.
I'd be tempted to check over your 'architectures' and 'valid architectures' settings in Xcode to make sure that any settings you have are deleted and switched back to the standard ones.
Remove architectures

Some doubts on kernel building

I was trying to build a kernel for my android device. I would have used my Linux system for building a kernel but unfortunately it had its hdd failed. So I am now using Windows 10 WSL for building the kernel. I am really new in building kernel and I have a few doubts:
When I tried to use arm-linux-gnueabihf 4.7 for making clean I got this error:
ccache execv 'my toolchain path' execv format error
I tried it with few other toolchains but same error came. Then I used arm-eabi 4.8 which worked correctly. This solved the problem but I would like to know what the error was and what caused it and is there a fix?
How should I know what toolchain I should use for building kernels like some people tell me to use a toolchain some people tell me to use someother toolchain.
When I tried to build the kernel with arm-eabi 4.8 I got an error
/home/inkiluz/kernel/security/tima_uevent/tima_uevent.c:217:1: fatal error: opening dependency file security/tima_uevent/.tima_uevent.o.d: No such file or directory
module_exit(tima_uevent_exit);
^
compilation terminated.
Is this a toolchain error or did i do something wrong? How can I rectify this?
Here is the the error log: https://del.dog/diwijegetu.
Please do help me out...

Xcode 10 static library doesn't include x86_64 arch

I am building a static library to be used with another project I'm working on, and eventually it will be included in a framework I'm developing. When I bring the library into my project, the arm builds work fine, but the simulator builds fail with missing symbols for the x86_64 build. I have set the build architectures in the library to
arm64 arm64e armv7 armv7s x86_64
I have tried various settings, like $(ARCHS_STANDARD) to no avail. I have also tried all of the potential solutions I could find on SO, most of which are pretty old.
Any and all suggestions would be greatly appreciated.
As mentioned in the comments and the edit, you have to build a fat library, but there are steps missing in all of the answers and many of them are badly out of date. Hopefully this will help.
Build a version of the static library for iPhoneOS and iPhoneSimulator.
On the command line, cd to the derived data directory for your project.
You will see directories for the OS and simulator libraries.
Execute the lipo command as below
lipo -create -output [desired fat library name] [path to iPhoneOS library] [path to iPhoneSimulator library]
Drag the fat library from finder to your target project.
You can probably automate this with a build script, but I was under a deadline so it was faster to just build and drag. If you come up with a good script, feel free to post it here.
P.S. The script presented in the Agile Warrior post did not work.

Apple Mach-O linker exits error code 1 (possibly a failed assert)

Has anyone had any experience with this crash from the XCode 4.2 linker:
Command /Developer/usr/bin/llvm-g++-4.2 failed with exit code 1
No other information was generated, even with -v verbose turned on, however I noticed this showing up in the Console log:
1/20/15 11:47:30 AM [0x0-0x1b01b].com.apple.dt.Xcode[240] 2015-01-20 11:47 Xcode[240] (CarbonCore.framework) FSEventStreamFlushSync(): failed assertion '(SInt64)last_id > 0LL'
The only changes I've made to the project was to strip symbols from various libraries...
NOTE: I've isolated a particular library where I had changed the Strip Style from "Debugging Symbols" to "Non-Global Symbols". But this really feels like a genuine bug in Xcode 4.2. The good news is that I assume this is a bug that is fixed in Xcode 5.x and 6.x. The bad news is that for this particular build I'm stuck with Xcode 4.2.

Error when trying to archive xcode project

My project runs fine when I run it using the iPhone simulator, and when I run it on a device. When I try to archive it for submission, I get this error:
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This was directly before the error and I'm not sure if it's related:
ld: file is universal (2 slices) but does not contain a(n) armv7s slice: /Volumes/Macintosh HD/Users/dog94a/Google Drive/Capstone/Backups/Approach/Approach/GMaps/GoogleMaps.framework/GoogleMaps for architecture armv7s
The default behavior of the Debug build configuration is to only build the active architecture (Build Active Architecture Only build setting is YES). This is not the case for the Release build configuration, which will build all architectures supported by your Valid Architectures build setting. What this means is that you're likely not targeting an armv7s device during your Debug builds (iPhone 5, latest iPad, etc), so you're not attempting to build that architecture until you do an archive which uses the Release build configuration by default.
The error indicates that your project is configured to create a binary that has armv7s instructions for when it runs on devices of that type, but the GoogleMaps.framework binary you're trying to link against was not built with an armv7s slice. To fix this, you either have to update to the latest version of the GoogleMaps.framework and hope they built it with armv7s enabled, or remove armv7s from your Valid Architectures build setting (obviously the former is preferable).
Once I have included a framework and at compile time nagged the linker for armv7. Now you have armv7s, which is the iphone5?
Solution to my problem it was: remove all files from that framework.
Compile that framework ( double check at Valid architectures settings to be there the desired architecture
Re-add the newly compiled framework.
Try and maybe it helps or even solve your problem too!

Resources