Xcode Cocos2D - warning all apps should include an armv7 architecture - ios

My project started doing something odd. I can build and test OK, but when I archive I get:
Warning all apps should include an armv7 architecture
In Target build settings I have Architectures set as $(ARCHS_STANDARD) and Base SDK as Latest iOS with Valid Architectures set as arm64 armv7 armv7s
I googled this and found several solutions saying to go to Target>Build Settings>Build Active Architecture Only and set that to NO.
Doing that, the project will no longer build and I get:
CCDirectorIOS.h Semantic issue
Redefinition of '__ccContentScaleFactor' with a different type:
'CGFloat' (aka double) vs 'float'
I'm quite a way through with this project and this is the first time I've had this problem. I've tried restoring from an earlier good backup and I get the same problem so presumably this has been caused by an Xcode update, and not by my own code.
Any suggestions?

Solution is simple, Change CGFloat to float
extern float __ccContentScaleFactor;
Here is discussion about Cocos2d 64 bit support

Related

Mach-O Linker error, undefined symbols for architecture after upgrading xcode to 8.0

I have upgraded to XCode 8.0 and it is giving me grief. The first issue was to do with code signing. Which I fixed by selecting a provisioning profile for debug and release from the General project settings. Weird not sure why it couldn't just work as it was compiling perfectly with the previous XCode. Previously XCode would say there is not provisional profile and prompt to fix it and would fix it. Seems a step back here. Anyways, went passed that issue.
The issue I have been facing all day is this error when I compile
Undefined symbols for architecture arm64:
"_write_ret", referenced from:
_dwsl in libtestlib.a(testlib.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I searched for write_ret and it is only a prototype in a header file, this function isn't called anywhere at all!! (Background the static library is part of a bigger project I brought only the files/code I needed to compile the static library for iOS). This was compiling perfectly before for years. I went back to the static libary source code and to humour myself I deleted the write_ret prototype and compiled it and updated the library in the my project and rebuilt. Same error again!. What is going on here?? I confirmed it was definitely using the correct built library.
I then decided I'll just built for armv7 only as this is an enterprise app. I went back to the static library project file and got rid of armv7s and arm64 from "valid architectures". I change "architectures" to armv7. I rebuilt the library and updated the project with the new library.
I also went into the main project and change the valid architectures to build for only armv7.
This time when I built my project I get this error
ld: warning: ignoring file /Users/rrr/Library/Developer/Xcode/DerivedData/P-eaxegvaceikvgqgllfiardmoorbv/Build/Products/Debug-iphoneos/libtestlib.a,
file was built for archive which is not the architecture being linked (armv7):
/Users/rrr/Library/Developer/Xcode/DerivedData/P-eaxegvaceikvgqgllfiardmoorbv/Build/Products/Debug-iphoneos/libtestlib.a
In the terminal I ran lipo libtestlib.a -info I get this:
input file libtestlib.a is not a fat file
Non-fat file: libtestlib.a is architecture: armv7
So it is built for armv7, so what is XCode complaining about really?
I am out of ideas now. Can anyone shed some light here?
I would like to get it to work with all the architectures as it was doing before the XCode upgrade I did on Friday. But worst case atleast compile to work only for armv7. My understanding is that it will still run on anything iPhone 5s and newer anyway.
At first, As you already know, you should support arm64 in order to support 64 bit architecture following Apple's rule.
At second, let's talk about undefined symbol issue, your first question.
I am not sure exactly from your situation description but, one thing to my mind reading the question is that your static library may depend on some dylib(dynamic or shared library) which is deprecated from Xcode 7.The possible scenario is your dylib library was red-marked in the project from Xcode 8 update version because this was replaced with tbd instead of dylib. So, this library is now missing status, and you did remove it in the library list and you forgot it. That's why your _write_ret symbol in libtestlib.a cannot be linked for architecture arm64 anymore.(dylib is missing status.)
if this scenario is true, import tbd instead of dylib.(text-based stub libraries).
let's talk about your second question related to error log.
ld: warning: ignoring file /Users/rrr/Library/Developer/Xcode/DerivedData/P- eaxegvaceikvgqgllfiardmoorbv/Build/Products/Debug-iphoneos/libtestlib.a,
file was built for archive which is not the architecture being linked (armv7):
/Users/rrr/Library/Developer/Xcode/DerivedData/P- eaxegvaceikvgqgllfiardmoorbv/Build/Products/Debug-iphoneos/libtestlib.a
This log can be about Build Active Architecture Only in Xcode build setting.
check 'Build Active Architecture Only' from Yes to No.
It error log could be generated when Build Active Architecture Only is set to YES in your build setting situation.
and, if it does not work, Have you ever clean your DerivedData directory and project?
If you already tried, it could be possible that your static library is actually not in the /Users/rrr/Library/Developer/Xcode/DerivedData/P-eaxegvaceikvgqgllfiardmoorbv/Build/Products/Debug-iphoneos/libtestlib.a.
so, you can move your static library output into this project and try it again.
These are just scenario for your situation as I got your question.
I wish it became a little help.
Thanks.

Undefined symbols for architecture x86_64 on Xcode 6.1

All of a sudden Xcode threw me this error at compilation time:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_Format", referenced from:
objc-class-ref in WOExerciseListViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
After doing some research, I may understand that a library I'm using is not compatible with 64 bit version. But this is very strange since I've been working with the same libraries for at least a week without having a single compilation problem during that time. The two libraries are just composed of a bunch of classes, and when I removed them from my project I got the same issue. Since I have never created libraries myself, I have no idea how I can find wether the ones I'm using are compatible with 64 bit (?)
I also tried the following changes for architectures under the target panel :
added $(ARCHS_STANDARD_INCLUDING_64_BIT) to the Architectures
build active architecture only -> set to 'NO'
for 'valid architectures' -> set to arm64, armv7 and armv7s
deleted the DerivedData folder and its contents, cleaned and built again
But none of these changes work. Please, does someone have a clue on this?
Thanks
Apparently, your class "Format" is involved in the problem. Check your declaration of this class, especially if you did it inside another class you probably forgot the #implementation or something similar.
Check if that file is included in Build Phases -> Compiled Sources
Make sure the WOExerciseListViewController is a Target Member; that worked for me!
Yes, I think the library you are using is not compatible with 64 bit version but you can solve the problem -
Just navigate to Build Settings>Architectures & replace $(ARCHS_STANDARD) to $(ARCHS_STANDARD_32_BIT)
So that your xcode build your project with 32 bit supported version.
I just had this error when I opened a (quite) old project, created in Xcode 4~ish, in Xcode 6.4. While the linked Frameworks were visible in the Project sidebar, I overlooked that there were no linked libraries in the Target Build Phases tab. Once I fixed that, it compiled fine.
It turned out I forgot to write my #implementation part.
I simply wasn't linking the libraries in the "Link Binary with Libraries" section.
I solved the same issue by going to Xcode Build Settings and in Architectures, I changed
the Xcode 6.1.1 standard architecture to:-
$(ARCHS_STANDARD_32_BIT)
I just had the exact same error, and solved it by restarting xcode.
For me the issue occurred after an svn update, the file in question was added to the projects folder, but it never appeared in xcode(9.3.1) – until I restarted it.
Same error when I copied/pasted a class and forgot to rename it in .m file.
I solved the problem by deleting reference to the file and adding it again in project. In my case it works.
this setting worked for me:
Architectures=$(ARCHS_STANDARD_32_BIT)
Build Active Architecture Only:YES
Valid Architectures armv6 armv7 armv7s arm64
Delete the $(ARCHS_STANDARD) and add the $(ARCHS_STANDARD_32_BIT).

What happens when you compile with Standard Architectures (armv7, armv7s)?

I have an SDK that I'm trying to compile and I was wondering what happens when I choose the Standard Architectures (armv7, armv7s) option under "Architectures"?
It is my understanding that the armv7 instruction set can run on devices that support armv7s as well but not the other way around. So when I compile with this option is the compiler outputting a binary with two SDKs, each using a different instruction set or just one with armv7?
I'm confused and not sure if I'm thinking about this correctly.
Yes, if you specify both armv7 and armv7s, it builds a "fat binary" containing two sets of object code, one targeted for armv7 and the other for armv7s. When the app is installed on a phone, the installer uses the correct object code for the device it is installed on.
You could specify just "armv7" and, you are correct, the generated object code will run on both an armv7 and an armv7s. However, it will run slower on the armv7s than a binary containing both sets of code.
In general, unless you have a specific reason for not doing it, stick with "Standard Architecture", since that provides the best support for the currently supported iOS devices.

How to turn off Xcode 5 warnings about upgrading project?

My question is partially related to this one After update to Xcode 5 - ld: symbol(s) not found for architecture armv7 or armv7s linker error
The problem is: I have several projects which project files are automatically generated. After upgrade to 5th version, Xcode started to show me warnings regarding "Build only active architectures" so after some googling I discovered the problem which described in a question I've mentioned. So basically there is a good reason not to enable that behaviour and I end up with a lot of warnings which are kind of annoying. Of course I do not want to suppress all warnings just these ones.
Does someone know how to turn off Xcode 5 warnings about upgrading project?
Thanks in advance.
In Build settings -> Architectures You need to add armv7 only. Remove armv7s.

zxing in xcode 4.5 and ios 6

As many of you noticed; zxing does not work in latest xcode (4.5/ios 6)
Here is use case:
checkout latest version from trunk (as some fixes were already added)
create single view application in xcode 4.5 with ios 6.0
use README to add dependencies, paths etc (just follow step by step)
add zxingcontroller call to class (renamed to mm)
Compilation fails both for simulator and device
It shows 31 error like this one:
Undefined symbols for architecture i386:
"std::string::c_str() const", referenced from
all 31 errors are similar, difference is in symbols name
May be somebody knows how to solve it with this use case?
p.s. if you have app from previous Xcode, it works. Problem is only if you create new app in Xcode 4.5
The issue you have encountered seems to be C++ standard library related.
Actually, whenever you see linker failures in relationship with standard library objects (e.g. std::string), you should check the project settings on all linked libraries and the app-project itself. They usually need to match!
The original ScanTest (which builds ZXingWidget as a subproject) uses the following settings and those need to match your App build-settings if you use the library as is.
For making sure, I created a brand-new project using Xcode 4.5. That project uses ZXingWidget as a prebuilt library but not as a subproject - I dont like subprojects for stuff that is not my own - though this specialty wont influence the results.
The important setting is C++ Standard Library - make sure that is set towards Compiler Default
Little clarification
Actually, you do not need to use C++ Standard Library, you may as well use LLVM C++ standard library with C++11 support. But you will have to use that exact same library in all projects, sub-projects and libraries that link with your project. So if you insist on using the more recent version of that library (C++11 support), then you will have to build the ZXing library with those settings as well.
Last but not least, make sure your Architectures and Valid Architecture settings are matching over all projects and sub projects (fixing the common armv7s linker issue).
First, make sure your Architectures setting is set towards armv7 armv7s within all projects. Then also edit the project settings of all projects towards Valid Architecture armv7s armv7.
You might also want to switch the "Other Warning Flag" -Werror off. Seems to be necessary in Xcode versions > 4.5 (LLVM compiler > 4.1).
It works for me, have you enabled -lstdc++ in your list of Other Linker Flags in the Build Settings tab of the project target? It sounds like it is not recognizing the c++ symbols needed for zXing to build. If this is the case, the above advice should help.

Resources