Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Pods-testTarget.xcconfig #653

Closed
felix1m opened this Issue · 23 comments

8 participants

Felix Müller Fabio Pelosin Jonathan Penn Stephen Vanterpool José González Eloy Durán Allen Ding Victor Ilyukevich
Felix Müller

When i use kiwi for testing, link it to a test-target and respect that in the Podfile, cooaPods creates a xconfig for that target like this:

PODS_ROOT = ${SRCROOT}/Pods
PODS_HEADERS_SEARCH_PATHS = ${PODS_PUBLIC_HEADERS_SEARCH_PATHS}
ALWAYS_SEARCH_USER_PATHS = YES
OTHER_LDFLAGS = -ObjC -framework SenTestingKit
FRAMEWORK_SEARCH_PATHS = "$(inherited)" "$(SDKROOT)/Developer/Library/Frameworks" "$(DEVELOPER_LIBRARY_DIR)/Frameworks"
HEADER_SEARCH_PATHS = ${PODS_HEADERS_SEARCH_PATHS}
PODS_BUILD_HEADERS_SEARCH_PATHS = "${PODS_ROOT}/BuildHeaders" "${PODS_ROOT}/BuildHeaders/AFNetworking" "${PODS_ROOT}/BuildHeaders/Kiwi"
PODS_PUBLIC_HEADERS_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/AFNetworking" "${PODS_ROOT}/Headers/Kiwi"

But i always have to fix the file to that, beause it throws linker errors for sentestingkit.

PODS_HEADERS_SEARCH_PATHS = ${PODS_PUBLIC_HEADERS_SEARCH_PATHS}
PODS_PUBLIC_HEADERS_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/Kiwi" "${PODS_ROOT}/Headers/AFNetworking"
OTHER_LDFLAGS = -ObjC -framework SenTestingKit -framework MobileCoreServices -framework SystemConfiguration
ALWAYS_SEARCH_USER_PATHS = YES
FRAMEWORK_SEARCH_PATHS =  "$(SDKROOT)/Developer/Library/Frameworks" "$(DEVELOPER_LIBRARY_DIR)/Frameworks"
PODS_ROOT = ${SRCROOT}/Pods
HEADER_SEARCH_PATHS = ${PODS_HEADERS_SEARCH_PATHS}
PODS_BUILD_HEADERS_SEARCH_PATHS = "${PODS_ROOT}/BuildHeaders" "${PODS_ROOT}/BuildHeaders/Kiwi" "${PODS_ROOT}/BuildHeaders/AFNetworking"

is there a way i can configure this somewhere so that it does not get overwritten every time i update the pods?

Fabio Pelosin

The change is that you add -framework MobileCoreServices -framework SystemConfiguration?

Felix Müller

yes, and:
FRAMEWORK_SEARCH_PATHS = "$(SDKROOT)/Developer/Library/Frameworks" "$(DEVELOPER_LIBRARY_DIR)/Frameworks"

Jonathan Penn

I'm having a similar problem. While I don't need to add the -framework MobileCoreServices -framework SystemConfiguration to use Kiwi, the problem is the extra "$(inherited)" in the FRAMEWORK_SEARCH_PATHS line.

The error is during the linking phase when trying to run unit tests. Here's what it says:

ld: warning: directory not found for option '-F-F/Applications/Xcode46-DP2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk/Developer/Library/Frameworks'
Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_SenTestCase", referenced from:

Notice the double "-F-F" above. It looks like when trying to specify the framework directories that Xcode is trying to specify a blank directory and doesn't put a space between the two parameters. This is solved by removing the "$(inherited)" as the bug suggests.

For full reference, here's the linker command being executed by Xcode when it fails:

Ld /Users/jonathan/Library/Developer/Xcode/DerivedData/ReadMore-edcsexifyvljaodzjyzlhleryjvm/Build/Products/Debug-iphonesimulator/KiwiSpecs.octest/KiwiSpecs normal i386
    cd /Users/jonathan/Projects/iOS/ReadMore/Base
    setenv IPHONEOS_DEPLOYMENT_TARGET 5.1
    setenv PATH "/Applications/Xcode46-DP2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode46-DP2.app/Contents/Developer/usr/bin:/usr/local/heroku/bin:/Users/jonathan/.rbenv/shims:/Users/jonathan/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin:/Volumes/ec2/bin:/Users/jonathan/bin/subs/book/bin:/Volumes/ec2/bin"
    /Applications/Xcode46-DP2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -bundle -isysroot /Applications/Xcode46-DP2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk -L/Users/jonathan/Library/Developer/Xcode/DerivedData/ReadMore-edcsexifyvljaodzjyzlhleryjvm/Build/Products/Debug-iphonesimulator -L/Users/jonathan/Projects/iOS/ReadMore/Base -F/Users/jonathan/Library/Developer/Xcode/DerivedData/ReadMore-edcsexifyvljaodzjyzlhleryjvm/Build/Products/Debug-iphonesimulator -F -F/Applications/Xcode46-DP2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk/Developer/Library/Frameworks -F/Applications/Xcode46-DP2.app/Contents/Developer/Library/Frameworks -filelist /Users/jonathan/Library/Developer/Xcode/DerivedData/ReadMore-edcsexifyvljaodzjyzlhleryjvm/Build/Intermediates/ReadMore.build/Debug-iphonesimulator/KiwiSpecs.build/Objects-normal/i386/KiwiSpecs.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -ObjC -framework Foundation -framework SenTestingKit -framework UIKit -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=5.1 -framework CoreData -framework Foundation -framework QuartzCore -framework MessageUI -framework CoreGraphics -framework AVFoundation -framework AudioToolbox -framework UIKit -lPods-KiwiSpecs -o /Users/jonathan/Library/Developer/Xcode/DerivedData/ReadMore-edcsexifyvljaodzjyzlhleryjvm/Build/Products/Debug-iphonesimulator/KiwiSpecs.octest/KiwiSpecs

You can see the -F flag with no framework specified. It looks like Xcode thinks the next piece of the command line is a framework path including the -F flag.

Hope that helps.

Fabio Pelosin

@jonathanpenn Thanks for the report.

For the record, at the moment I'm not sure how to handle the inherited issue. See #546 and #523.

Also I'm on the fence whether we should automatically add $(SDKROOT)/Developer/Library/Frameworks if SenTestingKit is present in the frameworks.

Jonathan Penn

I don't know if this is common for others or not, but if I leave off the $(SDKROOT)/Developer/Library/Frameworks in the xcconfig file I get this error:

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_SenTestCase", referenced from:
      _OBJC_CLASS_$_KWTestCase in libPods-KiwiSpecs.a(KWTestCase.o)
      _OBJC_CLASS_$_KWSpec in libPods-KiwiSpecs.a(KWSpec.o)
  "_OBJC_METACLASS_$_SenTestCase", referenced from:
      _OBJC_METACLASS_$_KWTestCase in libPods-KiwiSpecs.a(KWTestCase.o)
      _OBJC_METACLASS_$_KWSpec in libPods-KiwiSpecs.a(KWSpec.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

It looks like that directory is required.

Stephen Vanterpool

Im getting the same error, even with the frameworks path set correctly

Felix Müller

my updated solution with newer pod versions is now to just add
"SenTestingKit -framework MobileCoreServices -framework SystemConfiguration"
to "other linker flags in the Pods project's Build settings inside my workspace.
A better solution would be to add this to Kiwi's podspec but a quick search on google didn't provide me with a way to set "other linker flags" in there. If this is possible after all, it would be nice if someone would let me now, because then the guys from Kiwi can just update their podspec and this would be resolved properly.

José González

I faced the same problem as @jonathanpenn, and have solved it including /var/empty in the project global "Framework Search Paths" option. This workaround causes $(inherited) to have a non empty value, that was causing the linker command to fail. I know this is lame, but the linker doesn't emit any warning, as this directory is a standard linux directory supposed to be always present, and should always be empty, so I guess the impact in linking is minimal.

Eloy Durán
Owner

@felix1m It’s called OTHER_LDFLAGS. See this example.

Eloy Durán
Owner

@felix1m Although, this is automatically done when the frameworks attribute of the pod spec is used, so you should probably use that instead.

Eloy Durán
Owner

I’m thinking the only real solution is to check the user’s project-level settings (for settings defined in the Pods xcconfig) and if defined by the user we insert $(inherited). I’m not happy about using more reflection, though, so if someone knows of another solution, I’m all ears.

James Frost frosty referenced this issue in kiwi-bdd/Kiwi
Closed

Kiwi 2.0 - Installing/configuring Kiwi #180

Allen Ding

Does anyone have a minimal project where this happens? It seems to work fine for me.

Victor Ilyukevich

@allending I will try to prepare it for you.

@alloy why not to just remove inherited option from Kiwi's spec for now? How often CocoaPods users have to edit FRAMEWORK_SEARCH_PATHS by hands?) And why there is no such option (I mean $(inherited)) in all other specs?

~  grep -R "FRAMEWORK_SEARCH_PATHS" ~/.cocoapods/master | wc -l                  
      55
➜  ~  grep -R "FRAMEWORK_SEARCH_PATHS" ~/.cocoapods/master |  grep inherited | wc -l
       4
Eloy Durán
Owner

@yas375 @allending @irrationalfab Atm I’m in favor of removing the $(inherited) addition, unless someone has a good reason not to.

Eloy Durán
Owner

Actually, wait, no, there seems to be another issue going on, about the flag being quoted: #753.

/cc @tonyarnold

Eloy Durán
Owner

Ok, I have just pushed the following changes to the specs: CocoaPods/Specs@1ebea1a.

As described in #753, the issue would appear to be that $(inherited) was being quoted. Now I’m not sure why some have no problems with this, so it would be great if you could all try if this solution doesn't break it for anyone.

Eloy Durán
Owner

@felix1m Did you, or anyone else, find the cause of the issue you had with the missing frameworks?

Eloy Durán
Owner

@allending Forgot to add, if this fix does indeed work for you too, then please also update it in your repo.

Allen Ding

Works for me, I'll update repo. @alloy @felix1m

Allen Ding allending referenced this issue in kiwi-bdd/Kiwi
Closed

2.0 podspec is problematic #199

Victor Ilyukevich

@alloy it's working for me too. Thank you! And thanks to @tonyarnold! =)

@allending it seems that there is no reason in test app anymore.

Alejandro aleph7 referenced this issue in EasyMapping/EasyMapping
Merged

Support for managed objects #4

Fabio Pelosin
Owner

As the issues appears to be solved, I'm closing it. Please inform us you are still experiencing problems.

Abizer Nasir Abizern referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.