Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XCParseCore can not be built for iOS. "Cannot find 'RTLD_DEEPBIND' in scope" #55

Open
tonyatoms opened this issue Nov 20, 2020 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@tonyatoms
Copy link

After adding xcparse as a Swift Package, my app fails to compile with this error:
...SourcePackages/checkouts/swift-package-manager/Sources/SPMUtility/dlopen.swift:63:69: Cannot find 'RTLD_DEEPBIND' in scope

Desktop:

  • OS:
    ProductName: Mac OS X
    ProductVersion: 10.15.6
    BuildVersion: 19G73
  • xcparse Version - installed as a package, so not-applicable? Package source is https://github.com/ChargePoint/xcparse - master
  • Swift version
    Apple Swift version 5.3.1 (swiftlang-1200.0.41 clang-1200.0.32.8)
    Target: x86_64-apple-darwin19.6.0
  • XCResult version:
    {
    "storage" : {
    "backend" : "fileBacked2",
    "compression" : "standard"
    },
    "dateCreated" : "2020-11-19T12:18:55.000-0600",
    "rootId" : {
    "hash" : "0~1KYWn-zjL12vpfze-XT3OstAX6PCli1ANopCw_6YC9bjeWt2PwZV4jK7si6gLfV002xhvNYgjK34bJ9rmrTNQQ=="
    },
    "externalLocations" : [

],
"version" : {
"major" : 3,
"minor" : 26
}
}

To Reproduce
Steps to reproduce the behavior:

  1. Add xcparse to project as Swift Package
  2. Run/Build <- fails

Expected behavior

  1. Add xcparse to project as Swift Package
  2. Run/Build <- suceeds

Additional context
Add any other context about the problem here.

RTLD_DEEPBIND is not defined, unlike some of the other constants in dlopen.swift - but this stuff is all a bit over my head.

Also, I don't know if this is a Bug per se, or the result of my installing the package incorrectly or something. I'm very grateful for your work so I hope this report is not burdensome.

@tonyatoms tonyatoms added the bug Something isn't working label Nov 20, 2020
@abotkin-cpi abotkin-cpi self-assigned this Nov 20, 2020
@abotkin-cpi
Copy link
Collaborator

Yeah not familiar with this error but I'll take a look this weekend. My first guess would be it is due to how xcparse has defined its dependency on SPM versus what your app has defined its dependency. It's possible xcparse set an exact version dependency for SPM rather than a "at or above" SPM version in our Package.swift & perhaps your dependency on SPM requires a higher version. Would you mind mind sharing what your app's dependency declarations are (especially if Swift Package Manager has a version listing)? My email is also in my profile if you'd prefer to email it privately.

@tonyatoms
Copy link
Author

Yeah not familiar with this error but I'll take a look this weekend. My first guess would be it is due to how xcparse has defined its dependency on SPM versus what your app has defined its dependency. It's possible xcparse set an exact version dependency for SPM rather than a "at or above" SPM version in our Package.swift & perhaps your dependency on SPM requires a higher version. Would you mind mind sharing what your app's dependency declarations are (especially if Swift Package Manager has a version listing)? My email is also in my profile if you'd prefer to email it privately.

We are not using SPM (yet!) for any other packages, so the app has no SPM dependencies other than what I added by attempting to include xcparse. But I did notice that when I added xcparse, the dependency for SPM that Xcode hooked up was in fact set for exactly 0.5.0. I'm not sure how that happened - but I don't recall doing anything specific about it other than what was listed in the docs for xcparse. (It was a long day yesterday though so I may have botched up something).

I noticed that the current release of SPM is 0.6.0, so I suspect that you may be onto something.

@abotkin-cpi
Copy link
Collaborator

abotkin-cpi commented Nov 20, 2020

@tonyatoms Any chance you haven't set the platforms in your Package.swift to limit to only macOS? I ask as looking in SPM, it appears like that flag should only be used when building for a platform that isn't macOS. That your build is tripping on line 63 seems to imply the preprocessor directive in line 58 went into the else as the build isn't for macOS.

@tonyatoms
Copy link
Author

I created a Hello World app just to test this issue and I can re-create it there. It is versioned at: https://github.com/tonyatoms/testingParser

There is no Package.swift in this app except the one introduced through the xcparser swift package.

It could be that I'm misunderstanding the purpose of xcparser. It is clear from the documentation here on github that it is a command line utility. But I'm trying to incorporate it into an iOS app so that I can (eventually) export code coverage from a Jenkins instance. (The simpler avenues of using fastlane tooling such as slather, gcov etc are not an option because I don't have admin access to Jenkins machines.)
The blog post at: https://www.chargepoint.com/engineering/xcparse/ shows xcparser being added to an iOS app. I followed those instructions to get to the point where I am at now.

@abotkin-cpi
Copy link
Collaborator

Yes, building for iOS would explain the error as xcparse & XCParseCore today only support macOS as the build target.

In the blog post, xcparse isn't being added directly to the iOS app; it's used on a macOS command line prompt to extract screenshots from an xcresult file previously created by Xcode's Test step. That Xcode Test step was testing an iOS app in the Simulator & generated the xcresult with all the screenshots, code coverage information, & logs from the test run. There is a section later on about adding xcparse or XCParseCore to your Swift tools if you want to expand on it (such as Swift Puma did), but those are limited to macOS still.

For your use case, the first thing you'll need to get is the xcresult generated by Xcode when you run Xcode test in the Jenkins job. If that is not getting saved as any build artifact in your Jenkins setup already, you won't have the data that xcparse & XCParseCore extracts to give you the code coverage & screenshots. If you do have the xcresult, on a macOS machine that you control, you can use "brew install ChargePoint/xcparse/xcparse" to install the xcparse CLI and then start extracting code coverage and whatever else.

@abotkin-cpi abotkin-cpi changed the title [BUG] Cannot find 'RTLD_DEEPBIND' in scope [BUG] XCParseCore can not be built for iOS. "Cannot find 'RTLD_DEEPBIND' in scope" Nov 21, 2020
@tonyatoms
Copy link
Author

Ok that all makes sense. Thanks! An xcresult is saved as a result of fastlane/scan on the Jenkins machine, so for the time being I'll just use xcresulttool on that for now.

@abotkin-cpi abotkin-cpi added enhancement New feature or request and removed bug Something isn't working labels Nov 23, 2020
@abotkin-cpi abotkin-cpi changed the title [BUG] XCParseCore can not be built for iOS. "Cannot find 'RTLD_DEEPBIND' in scope" XCParseCore can not be built for iOS. "Cannot find 'RTLD_DEEPBIND' in scope" Nov 23, 2020
@mattneub
Copy link

I encountered this same error and was helped by this discussion. What I was hoping to do was somehow attach xcparse to my iOS app so that I could run UI tests that take screenshots and then, as the aftermath of the testing, also obtain the screenshots and export them for later handling (because we are required to document our app with a lot of screenshots). I can do this by driving the test with xcbuild and using the homebrew-installed xcparse, but I was hoping to avoid the separate command-line tool as a dependency. Not a big deal, just wanted to let you know what the (very imaginary) use case was supposed to be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants