Apple Mach-O Linker Warning (id): creation for MacOSX, but connection to dylib created for iOS

Starting at some point in the past, xCode 4 complaining about problems with the linker:

ld: warning: creation for MacOSX, but connection to dylib created for IOS: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks//CoreGraphics.framework/CoreGraphics

I checked everything, but still nothing suspicious about the configuration, and it compiles and runs. The only thing I see is the double slashes in front of CoreGraphics.framework, why I don't know. I tried to remove and add the library again to the "Assembly Phases", which did not help.

+25
ios linker xcode mach-o dylib
Aug 24 2018-11-11T00:
source share
4 answers

It is sometimes easier to debug Xcode problems by looking at the build log for the commands it uses.

If you are building from the command line, you can get this message if you do not specify -miphoneos-version-min =

This compiles: (where conftest.c just contains int main() {}) /Applications/Xcode5.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 --sysroot /Applications/Xcode5.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk --sysroot /Applications/Xcode5.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk -miphoneos-version-min=6.0 conftest.c And this gives the error: /Applications/Xcode5.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 --sysroot /Applications/Xcode5.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk --sysroot /Applications/Xcode5.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk conftest.c ld: building for MacOSX, but linking against dylib built for iOS Simulator file '/Applications/Xcode5.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk/usr/lib/libSystem.dylib' for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation) 
+5
Jul 29 '13 at 16:00
source share

Test your wireframe search paths for your main goal and your test goal.

I had a lot of crap in mine.

had an old project written in Xcode 4, and just started using Unit Tests in Xcode 5.

Here is the minimum, I have to run my test project

 Project Navigator > click on project at top > Targets > Build Settings > Framework Search Paths 



 TARGET:my_project $(inherited) "$(SRCROOT)" "$(SRCROOT)/my_project" TEST:my_projectTests "$(SDKROOT)/Developer/Library/Frameworks" <<XCTest.framework is here "$(DEVELOPER_LIBRARY_DIR)/Frameworks" "$(SRCROOT)/.." "$(SRCROOT)" << Documents/my_project "$(SRCROOT)/my_project" << Documents/my_project/my_project where directory structure is Documents/my_project my_project.xcodeproj /my_project 

Note. If you drag and drop the framework into Xcode. Xcode 5 has a bad habit of hard-coding a path

 /Users/gbxc/Documents/my_project 

it should be

 "$(SRCROOT)" << Documents/my_project "$(SRCROOT)/my_project" << Documents/my_project/my_project 

therefore, if you move the project, problems may arise.

The best way to verify the correctness is to create a new project with one view that runs the tests in order.

 Run the Test action By default it fails but at least testing is running then compare the Framework Search Paths. 
+4
Nov 07 '13 at 15:48
source share

If you use Carthage and compile a Mac application, search your Framework Search Paths project, you may find something like $(PROJECT_DIR)/Carthage/Build/iOS .

Removing the fix for my problem.

0
Dec 24 '15 at 19:03
source share

This problem is due to the incorrect frame version in Xcode. The project is built for Mac OS X, but it uses the iOS version infrastructure.

-3
Jul 16 '13 at 3:56 on
source share



All Articles