-
Notifications
You must be signed in to change notification settings - Fork 105
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
Could not build Objective-C module 'CSSH' #34
Comments
Can you try running swift package reset
swift build and see if that happens to fix it? I've been planning to merge CSSH into this repo anyway and use the library targets introduced in Swift 4.2, so that could potentially fix it even if |
That did not fix it. Any other suggestions? Thanks |
I merged |
Jake,
Thanks for the update. I created a brand new project in Xcode 11.3. I used the Add Package Dependency to add Shout in but got these errors when I built it:
This might be because I have never used this feature and have got it wrong. 😀
Thanks
Andrew
… On 3 Jan 2020, at 03:04, Jake Heiser ***@***.***> wrote:
I merged CSSH into Shout, hopefully version 0.5.4 should fix the issue
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#34?email_source=notifications&email_token=AADD7TTY7LNTMVQMLSLW2JTQ32TLJA5CNFSM4I7CR2GKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIAEVWA#issuecomment-570444504>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AADD7TVDH5DWSMB5QMPRQOLQ32TLJANCNFSM4I7CR2GA>.
|
I am seeing several of the same build errors (both if I try to integrate Shout via Xcode 11's Swift Packages feature, or even if I try to build Shout itself by cloning the repo and then opening it in Xcode 11 directly).
This was using the latest 0.5.4 release, so the attempted fix doesn't appear to have worked. Any advice @jakeheis ? |
I have the same issue. |
Just chiming in: same issue here. |
I also have the same issue |
I am having the same issue with the latest 0.5.4. release. @jakeheis any feedback? |
Same issue here too, also on 0.5.4 release (on Xcode 11.4, targeting iOS 13.4, although not sure it matters). Added using Xcode Package Manager. I'd love to find a fix for this as this is the exact function I have been searching for. Would love to see it in action! :-) Thank you in advance. |
libssh2 is dependent of openssl. and run [email protected] is keg-only, which means it was not symlinked into /usr/local, If you need to have [email protected] first in your PATH run: For compilers to find [email protected] you may need to set: For pkg-config to find [email protected] you may need to set: I have managed to build with: |
@gopito - thank you for the reply! This has gotten me a little closer and given me a little more insight, but I'm still having problems. Keep in mind that I'm relatively new to Xcode and I'm also using the Xcode GUI, not command line tools :) That said, I did not have brew previously installed ... but I do now, and reinstalled the [email protected] cask and now libssh2. They both successfully installed and I can see them both in the 'Cellar' directory, along with Symbolic links in the /usr/local/opt directory. Note that my symlink in the opt directory for openssl points to the latest [email protected] module: All good so far. Then in Xcode, after adding the Shout package using the package manager and then, under the Build Settings I added recursive elements to the Header Search Paths for both the openssl and libssh2 installs. Similarly, I've added the openssl and libssh2 libraries (*.dylib) explicitly in the Other Linker Flags. I've tried defining these both explicitly (mapped to the brew Cellar directories with specific versions) as well as using the symlinks, but here is what they look like now in the Xcode Build Settings: However, after all of that I still get errors building the Shout package, and of course my command to: So, I think I'm stuck at this point. I also tried adding the export statements and PATH additions to .zshrc as you suggested above, and sourced the new .zshrc file and restarted Xcode GUI (although I'm not sure the Xcode GUI uses these ZSH environment variables), here is the output of the zsh env command: Finally, along similar lines to adding openssl paths to LDFLAGS, CPPFLAGS, and PKG_CONFIG_PATH, I added the references to the libssh2 lib/header/pkg files ... ... and restarted Xcode, rebuilt my project, and unfortunately I get the same errors while building the Shout package. Anyway, I feel like I am very close to having this working and wouldn't doubt that I made some simple error along the way or am missing one basic step (perhaps I still haven't found the right combination of settings to point Xcode to the right spot). I can physically see the libssh2.h header file it is complaining about, I don't know why it can't ;-) I appreciate any other advice you, @jakeheis or anybody else can offer. Thank you! Peace. |
I have the same issue, but with my SPM command line tool. For me, the build stopped working after update to Xcode 11.4. I've made some research here: https://forums.swift.org/t/xcode-11-4b3-spm-does-not-see-brew-deps/34307/8 |
It does seem as though the most recent version of Swift has broken libs which depend on system libraries. It has worked for me in the command line to use export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"
swift build and Xcode 11.4.1 is able to successfully build a project when the project is generated as such: export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"
swift package generate-xcodeproj Could someone see if this fixes the problem when the target is "My Mac" in Xcode? |
@jakeheis is there any way to set these as flags in the SPM file? Or does it have to be done on the command line? |
As far as Xcode (as opposed to command line) is concerned I can confirm this worked when generating a project from this repo. I've used the generated project in place of a framework in my own project but had to point "Import Paths" under "Swift Compiler - Search Paths" in the build settings to the CSSH folder of this repo. It does seem to be the problem that openssl is installed in a directory that is not in the pkg-config search path. I couldn't find a way to export PKG_CONFIG_PATH from the Xcode gui, would be nice if a fix could be applied so it works out of the box with SPM without workarounds. Edit: target used was "My Mac" as specified. |
I ran into this problem attempting to use Shout in my Vapor project.
During trial-and-error I had the following line after all
This listed all files and folders related to those packages. This way I found the right paths to use for I must admit I'm not entirely sure if both See also: |
While it may be less than ideal, I was able to solve this issue by providing linkerSettings within Example package config which is working with Shout as a dependency. let package = Package(
name: "test",
platforms: [
.macOS(.v10_14)
],
dependencies: [
.package(name: "Shout", url: "https://github.com/jakeheis/Shout", from: "0.5.6")
],
targets: [
.target(
name: "test",
dependencies: [
.product(name: "Shout", package: "Shout")
],
linkerSettings: [
.unsafeFlags(
[
"-L/usr/local/opt/[email protected]/lib",
"-I/usr/local/opt/[email protected]/include"
],
.when(platforms: [.macOS], configuration: .release)
),
]
),
.testTarget(
name: "testTests",
dependencies: ["test"]),
]
) Once the LinkerSettings were in place, xcode and SPM were able to be used without issue.
|
With the above I am getting: @cloudnull, how did you get around this?
https://developer.apple.com/documentation/swift_packages/swiftsetting/3112770-unsafeflags |
@klmitchell2 I've not hit that issue. Are you seeing that message when you build with Xcode? Do you see the same error with |
MAC OS: macOS Catalina 10.15.5 @jakeheis : I am getting the same issues. How long are we expect a stable version of it? If anyone have solved this issue then provide me the steps. So, I can follow it. Thanks in advance. |
@mital-defsys you can either figure it out and commit a fix yourself, or follow the solutions above. E.g. mine (for which I tend to blame brew). I don't think it is nice to such tone ("How long are we expect a stable version of it?"). |
@cloudnull tried it your way with linkerSettings unsafeFlags, no success when using Package.swift opening folder with Xcode 11.6, meaning I do not generate xcode project but rather allow xcode to setup .swiftpm folder and do it instead of myself. Have you tried this way? Any success? |
Still having issues with this, none of the above solutions have worked for me. Looking in the
|
The above change fixes it. No need to run |
Would this work on macOS, because I'm having issues with using this SPM on macOS? |
This package is only for macOS . Works for me with swift-tools-version:5.3 |
That's too bad because I've been hoping that it would be used for macOS(.v10_15) |
it works with v10_15 if you are using swift-tools-version:5.3. It works for me in macOS(.v10_15) . What error are you getting ? |
it works with v10_15 if you are using swift-tools-version:5.3. It works for me in macOS(.v10_15) . What error are you getting ? |
I'm currently trying to use Shout in my Swift project (which isn't itself a package) and I come across the same issue. Now, the most pressing issue is the ability to build and use Shout in another Swift project. I tried all the above described methods but XCode still can't find I tried @cloudnull unsafe flags here but I do come across the issue of I tried symlinking libssh2 headers into Is there no way to use Shout in another Swift |
For any who need to use this in an xcodeproject that isn't a swift package, symlinking the headers to
|
Has anybody else the problem that it builds sometimes and sometimes not? I tried @JacobHearst way and it worked for me. But sometimes I get the error "Command CompileSwift failed with a nonzero exit code" or "libssh2.h file not found". Sometimes it helps just reinstalling the package. |
This should be fixed in 7d9346f thanks to @pelopina6. I'll leave this issue open for a bit longer to see if anyone continues to have problems, but it should now be resolved |
Unfortunately still seems not working 😕 I tried to install latest version (and also latest master) into new project on latest xcode/macos and getting still same issue: 'libssh2.h' file not found and "Could not build Objective-C module 'CSSH'". Thou I am also getting warning mentioning brew install libssh2 openssl. Those were successfully installed and still same error. |
I am using XCode 12.4 on macOS 10.15 and I can build fine but at runtime it fails because libssh2 is not signed: dyld: Library not loaded: /usr/local/opt/libssh2/lib/libssh2.1.dylib If I embed libssh2.1.dylib in my app at runtime it still looks for it in /usr/local/opt. How can I get it to look at the embedded copy? |
I am using Xcode 13 Beta 5 on macOS 12 beta, and it is still an issue. I have created a new multiplatform SwiftUI App, and added the package dependency to the macOS target. It fails to build with the following errors: ..../Shout/Sources/CSSH/shim.h:4:10: 'libssh2.h' file not found I have updated brew and upgraded both libssh2 and [email protected]. I have also tried creating the symlinks as suggested by JacobHearst, and have tried running
but to no avail |
I’m having the same issue. I can’t build my project with Xcode. All I get is this error: I did a fresh homebrew install, then I installed [email protected] and libssh2.
I created a new Xcode project (Mac app) and I added the Shout package (File->Add Packages) I configured the header search paths in build settings like this (recursive):
I also added these flags to the "Other C Flags" section:
Is there anything else I can try? |
I was able to include Shout into my Xcode project the hard way by following these steps:
|
I'm trying to use this package through SPM in a Universal app generated by Xcode 13.2.1. I tried everything mentioned above, but still can't get
|
I have copied libssh2 (include and lib) into my xcode project and no matter what I put into header search paths xcode can never find libssh2.h. I'm using Xcode 13.2.1. This seems like it should be a simple operation to get Xcode to see some headers and libs. |
Does anyone have any updates on this issue? This would make my life so much easier... no other 3rd party makes it that simple. It just needs to work lol - I wish I could help but I honestly have no idea why this happening. |
Here is how I got this to work. I cloned https://github.com/build-xcframeworks/libssh2 and built it. Then I added it to my Xcode project that uses Shout and CSSH. Details: $ git clone https://github.com/build-xcframeworks/libssh2 // now build the build-xcframeworks/libssh2 project: // You may also need to codesign the library files. Run this in the libssh2 folder // Now back in Xcode, add to your project target libssh2.xcframework and libcrypto.xcframework from the libssh2 Now your Xcode project should build! The trick here seems to be that using an xcframework to bring external libraries and header files into an Xcode project allows Xcode to properly find and link everything. I hope this works for everyone. Please comment or add any other details. Update =============== Don't use this xcframework idea. Use @glushchenko's fork of this repo. It works great. I suppose his fix should be merged in here. I notice there is already pull request here for the same fix, just with a slightly old ssh version. |
@rob-dodson very interesting, this working for run in debug mode, but app store does not accepted self signed builds with libssh2.xcframework for notarization :( |
Yes, you are correct. I have not found a way to get it notarized.
…On Sep 2, 2022 at 12:41 AM -0700, glushchenko ***@***.***>, wrote:
@rob-dodson very interesting, this working for run in debug mode, but app store does not accepted self signed builds with libssh2.xcframework for notarization :(
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@rob-dodson i found workaround, now notarization works fine https://github.com/glushchenko/Shout |
How does it work?
Where should I look for your solution?
…On Sep 4, 2022 at 3:08 PM -0700, glushchenko ***@***.***>, wrote:
@rob-dodson i found workaround, now notarization works fine https://github.com/glushchenko/Shout
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@rob-dodson just add my fork over SPM, thats all. |
Hey thanks, that works!
…On Sep 4, 2022 at 11:45 PM -0700, glushchenko ***@***.***>, wrote:
@rob-dodson just add my fork over SPM, thats all.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Do you want to change the Readme to change the PM instructions to point to your repo instead of jakeheis?
…On Sep 4, 2022 at 11:45 PM -0700, glushchenko ***@***.***>, wrote:
@rob-dodson just add my fork over SPM, thats all.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
I am running Xcode 11.0 on Catalina. (10.15.0). I'm getting a Could not build Objective-C module 'CSSH' error when I try to build. Sure enough CSSH isn't in my dependencies.
Package.swift
import PackageDescription
let package = Package(
name: "myapp",
dependencies: [
.package(url: "https://github.com/jakeheis/Shout", from: "0.5.0")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "myapp",
dependencies: ["Shout"]),
.testTarget(
name: "myappTests",
dependencies: ["myapp"]),
]
)
$ swift package update
Updating https://github.com/jakeheis/Shout
Updating https://github.com/IBM-Swift/BlueSocket
Updating https://github.com/jakeheis/CSSH
Completed resolution in 2.91s
Everything is already up-to-date
$ swift package generate-xcodeproj
generated: ./myapp.xcodeproj
//
// Agent.swift
// Shout
//
// Created by Jake Heiser on 3/4/18.
//
import CSSH <- Could not build Objective-C module 'CSSH'
CSSH doesn't appear to be installed in the dependencies:
Any thoughts? Thanks.
The text was updated successfully, but these errors were encountered: