0
votes

When I choose "Build Active Architecture Only" = "YES", I can run the project in my devices. But when I choose "NO", it shows more than 200 errors with the same project.

Provided, I chose Standard architectures (armv7, arm64) as the Architecture and arm64, armv7, armv7s as the Valid Architectures for this project.

Here is the part of the errors I received:

ld: warning: ld: warning: ignoring file /Users/john/Library/Developer/Xcode/DerivedData/Hero-hbrtqluudvdwemgbwcyacbfeysqv/Build/Products/Debug-iphoneos/libbox2d iOS.a, file was built for archive which is not the architecture being linked (armv7): /Users/john/Library/Developer/Xcode/DerivedData/Hero-hbrtqluudvdwemgbwcyacbfeysqv/Build/Products/Debug-iphoneos/libbox2d iOS.aignoring file /Users/john/Library/Developer/Xcode/DerivedData/Hero-hbrtqluudvdwemgbwcyacbfeysqv/Build/Products/Debug-iphoneos/libchipmunk iOS.a, file was built for archive which is not the architecture being linked (armv7): /Users/john/Library/Developer/Xcode/DerivedData/Hero-hbrtqluudvdwemgbwcyacbfeysqv/Build/Products/Debug-iphoneos/libchipmunk iOS.a

ld: warning: ignoring file /Users/john/Library/Developer/Xcode/DerivedData/Hero-hbrtqluudvdwemgbwcyacbfeysqv/Build/Products/Debug-iphoneos/libcocos2dx-extensions iOS.a, file was built for archive which is not the architecture being linked (armv7): /Users/john/Library/Developer/Xcode/DerivedData/Hero-hbrtqluudvdwemgbwcyacbfeysqv/Build/Products/Debug-iphoneos/libcocos2dx-extensions iOS.a
ld: warning: ignoring file /Users/john/Library/Developer/Xcode/DerivedData/Hero-hbrtqluudvdwemgbwcyacbfeysqv/Build/Products/Debug-iphoneos/libCocosDenshion iOS.a, file was built for archive which is not the architecture being linked (armv7): /Users/john/Library/Developer/Xcode/DerivedData/Hero-hbrtqluudvdwemgbwcyacbfeysqv/Build/Products/Debug-iphoneos/libCocosDenshion iOS.a
ld: warning: ignoring file /Users/john/Library/Developer/Xcode/DerivedData/Hero-hbrtqluudvdwemgbwcyacbfeysqv/Build/Products/Debug-iphoneos/libcocos2dx iOS.a, file was built for archive which is not the architecture being linked (armv7): /Users/john/Library/Developer/Xcode/DerivedData/Hero-hbrtqluudvdwemgbwcyacbfeysqv/Build/Products/Debug-iphoneos/libcocos2dx iOS.a

Undefined symbols for architecture armv7:
  "cocos2d::Touch::getLocation() const", referenced from:
  Credits::onTouchBegan(cocos2d::Touch*, cocos2d::Event*) in Credits.o
  Credits::onTouchMoved(cocos2d::Touch*, cocos2d::Event*) in Credits.o
  "cocos2d::MoveTo::create(float, cocos2d::Vec2 const&)", referenced from:
  Credits::resetCreditAction() in Credits.o
  "cocos2d::CallFunc::create(std::__1::function<void ()> const&)", referenced from:
  Credits::resetCreditAction() in Credits.o
  "cocos2d::Application::setAnimationInterval(double)", referenced from:
  vtable for AppDelegate in AppDelegate.o
  "cocos2d::Director::runWithScene(cocos2d::Scene*)", referenced from:
  AppDelegate::applicationDidFinishLaunching() in AppDelegate.o
  "cocos2d::Application::~Application()", referenced from:
  AppDelegate::~AppDelegate() in AppDelegate.o
  "cocos2d::Application::Application()", referenced from:
  AppDelegate::AppDelegate() in AppDelegate.o
2

2 Answers

1
votes

add armv7 and armv7s only in the valid architecture as well as architecture section of the game and cocos2d-x project. (in both project and target section build settings)

0
votes

I have fixed this issue by using the following settings in my Cocos2d-x 3.7 projects.

  • Select your top-level project in Xcode (in this case 'ZooCubes')
  • Set iOS Deployment Target to "iOS 7"
  • Set Valid Architectures to: "arm64 arm7"
  • Also make sure that Architectures to set to "Standard architectures arm7, arm64"

Make sure to repeat this process for cocos2d_libs.xcodeproj

enter image description here

Sometimes the same error message may also be shown when a class references a missing framework. In my case I had to add the GameKit framework since one of my classes was trying to reference it.

Finally, I have also encountered situations (e.g. Creating a new project in cocos2dx-2.2.6) where the "Build Active Architecture Only" option needs to be set to 'No' for all targets in order to fix the 'Undefined symbols' error.