Question

I'm trying to use xcodebuild to compile an iOS project. The project builds fine via XCode GUI; however, the builds fails with xcodebuild.

The problem seems to be that the project requires libiconv.dylib and xcodebuild links it against the wrong library location. Like its looking for the library at /sw/lib/ which contains the x86 versions, and not linking against the armv7/6 versions contained inside XCode.

My question is how do I tell Ld to look into the SDK directory and not /sw/lib/?????

Here's the build command:

xcodebuild -project MyProject.xcodeproj -target "release_iphone" -configuration Release -sdk "iphoneos7.0" PROVISIONING_PROFILE="${PROJ_PROF_UUID}"

And here's the error I receive:

ld: warning: ignoring file /sw/lib//libiconv.dylib, file was built for x86_64 which is not the architecture being linked (armv7s): /sw/lib//libiconv.dylib
Undefined symbols for architecture armv7s:
  "_iconv_open", referenced from:
      l2451 in libscanditsdk-iphone-3.1.1.a(mirasense.o)
  "_iconv", referenced from:
      l2451 in libscanditsdk-iphone-3.1.1.a(mirasense.o)
  "_iconv_close", referenced from:
      l2451 in libscanditsdk-iphone-3.1.1.a(mirasense.o)
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Things I've tried:

  • workspace/scheme vs project/target
  • re-adding libiconv.dylib to "Link Binary with Libraries"
  • adding the SDK directory to "Library Search Paths"
  • adding "-isysroot $SDKROOT" to the "Other Linker Flags"
Was it helpful?

Solution

There can be two reason for the error.In your build settings (search for) 1)Build option - Compiler C/C++/objective C that it is correctly working or there is no support option there

2)In search path - the framework,header,library search path have the right path of sdk

as these two are common issue since ios7 and xcode 5.But the first point seems more reliable to your issue

OTHER TIPS

It is saying that the file was built for 64 bits architecture. I think you should shange in project setting your app architecture from armv7/armv7s to armv7/armv7s/arm64.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top