Xcode 7 Link Error With Universal Binary

My team has several third-party open source frameworks (Boost, Protobuf, etc) that we build and use with our application. These frameworks all contain valid slices in the Universal binary (armv7, armv7s, arm64, i386, x86_64) and link using Xcode 6.x. I downloaded and installed Xcode 7 Beta (1-4) and rebuilt my application only to discover the following link error:

ld: in ../../../../3rdParty/Boost/ios_framework/Boost.framework/Boost(bzip2.o), building for iOS simulator, but linking in object file built for OSX, for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)


I have rebuilt my frameworks to ensure the slices exist but continue to get this error when targeting both simulator and device. I am beginning to think this is an Xcode 7 issue and I welcome any insight on this issue.


--Ron

I encoutered similar error in Xcode 7 Beta 5:


ld: building for OSX, but linking in object file built for (unknown), file '/Volumes/DATA/MacMain/components/global/src/osx/libxl/lib/libxl.dylib' for architecture x86_64


libxl.dylib is a universal binary(x86_64 and i386).

I am also seeing this, new in Xcode 5.


This is the error I get:


ld: building for OSX, but linking in object file built for (unknown), file '[path]/cloudpull/SBJson.framework/SBJson' for architecture x86_64


John

This is definitely new in beta 5; I had no problems linking in beta 4.


I don’t think this is related to the framework binary being universal, as I thinned it with lipo and am still getting the same message:


% lipo -info /Library/Frameworks/Growl.framework/Growl
Non-fat file: /Library/Frameworks/Growl.framework/Growl is architecture: i386


Ld /Users/nicholas/Library/Developer/Xcode/DerivedData/Pester-dmqwzzanlsudtshkfhcnikgvqgcr/Build/Products/Debug/Pester.app/Contents/MacOS/Pester normal i386
[...]
ld: building for OSX, but linking in object file built for (unknown), file '/Library/Frameworks/Growl.framework/Growl' for architecture i386


It looks like somehow the linker is expecting the OS information, not architecture, to be embedded in the binary and not finding it?

I also saw some suggestions that this may be related to code signing, so I re-signed the framework but this did not appear to affect anything:

% codesign -fvs '[...]' Growl.framework
Growl.framework: replacing existing signature
Growl.framework: signed bundle with Mach-O thin (i386) [com.growl.growlframework]
% codesign -vvv Growl.framework
/Library/Frameworks/Growl.framework: valid on disk
/Library/Frameworks/Growl.framework: satisfies its Designated Requirement

I'm experiencing a problem similar to this one, too. I didn't see this thread, though, and created a new one:


https://forums.developer.apple.com/thread/13795


FYI, an Apple employee has responded on that thread about a known regression in Xcode 7 beta 5.

Make sure to recompile external libraries with Xcode 7.

If you are compiling them from command line, make sure that you are using the correct toolchain. Just do: "sudo xcode-select -s /path/to/Xcode7.app/Contents/Developer"

`

Hi,we were also facing same issues ,but we resolve it my removing the framework and we add it again,that fixed out issues.

Xcode 7 Link Error With Universal Binary
 
 
Q