Open macaaw opened 4 years ago
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 swift package reset
doesn't.
That did not fix it. Any other suggestions? Thanks
I merged CSSH
into Shout
, hopefully version 0.5.4
should fix the issue
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 notifications@github.com 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 https://github.com/jakeheis/Shout/issues/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).
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "shim.h"
^
/Users/danbrowne/Downloads/Shout-master/Sources/CSSH/shim.h:4:10: error: 'libssh2.h' file not found
#include <libssh2.h>
^
/Users/danbrowne/Downloads/Shout-master/Sources/Shout/Agent.swift:8:8: error: could not build Objective-C module 'CSSH'
import CSSH
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.
After brew reinstall openssl
You will see:
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/usr/local/etc/openssl@1.1/certs
and run /usr/local/opt/openssl@1.1/bin/c_rehash
openssl@1.1 is keg-only, which means it was not symlinked into /usr/local, because macOS provides LibreSSL.
If you need to have openssl@1.1 first in your PATH run: echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc
For compilers to find openssl@1.1 you may need to set: export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib" export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
For pkg-config to find openssl@1.1 you may need to set: export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"
I have managed to build with:
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib" && \
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include" && \
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig" && \
swift build
@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 openssl@1.1 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 openssl@1.1 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:
import Shout
also fails as a result:
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:
... and still no luck. Same darn errors.
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/openssl@1.1/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/openssl@1.1/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?
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/openssl@1.1/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/openssl@1.1/lib/pkgconfig" swift package generate-xcodeproj
Could someone see if this fixes the problem when the target is "My Mac" in Xcode?
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.
While the above mentioned export PKG_CONFIG_PATH...
as proposed after brew install libssh2
works on my Mac, it does not when I build a Docker image for my Vapor project. However, I got it to work as follows:
FROM vapor/swift:5.2
...
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -y --no-install-recommends apt-utils
RUN apt-get install -y libssh2-1 libssh2-1-dev
# Compile with optimizations
RUN export LDFLAGS="-L/usr/lib/x86_64-linux-gnu" && \
export CPPFLAGS="-I/usr/include" && \
export PKG_CONFIG_PATH="/usr/lib/x86_64-linux-gnu/pkgconfig" && \
swift build \
--enable-test-discovery \
-c release \
-Xswiftc -g
During trial-and-error I had the following line after all apt-get install
's:
RUN dpkg -L libssh2-1; dpkg -L libssh2-1-dev
This listed all files and folders related to those packages. This way I found the right paths to use for LDFLAGS
, CPPFLAGS
and PKG_CONFIG_PATH
.
I must admit I'm not entirely sure if both libssh2-1
and libssh2-1-dev
are needed, but this works for me. Still fine-tuning this...
See also:
While it may be less than ideal, I was able to solve this issue by providing linkerSettings within Package.swift
.
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/openssl@1.1/lib",
"-I/usr/local/opt/openssl@1.1/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.
xcode version 11.5 swift version 5.2.4
With the above I am getting:
The package product '<Name>' cannot be used as a dependency of this target because it uses unsafe build flags.
@cloudnull, how did you get around this?
As some build flags can be exploited for unsupported or malicious behavior, the use of unsafe flags makes the products containing this target ineligible for use by other packages.
https://developer.apple.com/documentation/swift_packages/swiftsetting/3112770-unsafeflags
The package product '<Name>' cannot be used as a dependency of this target because it uses unsafe build flags.
@klmitchell2 I've not hit that issue. Are you seeing that message when you build with Xcode? Do you see the same error with swift
package manager (swift build ...
)?
MAC OS: macOS Catalina 10.15.5 Xcode: Xcode 11.5 iOS: iOS 13.5.1
@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 /usr/local/opt/openssl@1.1/lib/pkgconfig
directory I'm not actually seeing the libssh2.h
header that's being imported in Sources/CSSH/shim.h
nor am I seeing the libssh2.pc
file that swift build
is warning about . Did libssl get updated with new file names or something?
$ swift --version
Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)
Target: x86_64-apple-darwin19.6.0
$ ls /usr/local/opt/openssl@1.1/lib/pkgconfig
libcrypto.pc libssl.pc openssl.pc
$ swift build
warning: failed to retrieve search paths with pkg-config; maybe pkg-config is not installed
'CSSH' libssh2.pc: warning: couldn't find pc file
ld: warning: Could not find or use auto-linked library 'ssh2'
Undefined symbols for architecture x86_64:
"_libssh2_agent_connect", referenced from:
_$s5Shout5AgentC7connectyyKF in Agent.swift.o
"_libssh2_agent_disconnect", referenced from:
_$s5Shout5AgentCfd in Agent.swift.o
"_libssh2_agent_free", referenced from:
_$s5Shout5AgentCfd in Agent.swift.o
"_libssh2_agent_get_identity", referenced from:
_$s5Shout5AgentC11getIdentity4lastAC9PublicKeyCSgAH_tKF in Agent.swift.o
"_libssh2_agent_init", referenced from:
_$s5Shout5AgentC8cSessionACs13OpaquePointerV_tKcfc in Agent.swift.o
"_libssh2_agent_list_identities", referenced from:
_$s5Shout5AgentC14listIdentitiesyyKF in Agent.swift.o
"_libssh2_agent_userauth", referenced from:
_$s5Shout5AgentC12authenticate8username3keySbSS_AC9PublicKeyCtF in Agent.swift.o
"_libssh2_channel_close", referenced from:
_$s5Shout7ChannelC5closeyyKF in Channel.swift.o
"_libssh2_channel_free", referenced from:
_$s5Shout7ChannelCfd in Channel.swift.o
"_libssh2_channel_get_exit_status", referenced from:
_$s5Shout7ChannelC10exitStatuss5Int32VyF in Channel.swift.o
"_libssh2_channel_open_ex", referenced from:
_$s5Shout7ChannelC16createForCommand8cSessionACs13OpaquePointerV_tKFZ in Channel.swift.o
"_libssh2_channel_process_startup", referenced from:
_$s5Shout7ChannelC4exec7commandySS_tKF in Channel.swift.o
"_libssh2_channel_read_ex", referenced from:
_$s5Shout7ChannelC8readDataAA18ReadWriteProcessorO0E6ResultOyF in Channel.swift.o
"_libssh2_channel_request_pty_ex", referenced from:
_$s5Shout7ChannelC10requestPty4typeySS_tKF in Channel.swift.o
"_libssh2_channel_send_eof", referenced from:
_$s5Shout7ChannelC7sendEOFyyKF in Channel.swift.o
"_libssh2_channel_wait_closed", referenced from:
_$s5Shout7ChannelC10waitClosedyyKF in Channel.swift.o
"_libssh2_channel_wait_eof", referenced from:
_$s5Shout7ChannelC7waitEOFyyKF in Channel.swift.o
"_libssh2_channel_write_ex", referenced from:
_$s5Shout7ChannelC5write4data6length2toAA18ReadWriteProcessorO0H6ResultO10Foundation4DataV_Sis5Int32VtFs0J0OySiAA8SSHErrorVGSWXEfU_ in Channel.swift.o
"_libssh2_init", referenced from:
_globalinit_33_E47B0AB8180088EC3B1503AA6C6E936F_func0 in Session.swift.o
"_libssh2_scp_send64", referenced from:
_$s5Shout7ChannelC12createForSCP8cSession8fileSize10remotePath11permissionsACs13OpaquePointerV_s5Int64VSSAA15FilePermissionsVtKFZ in Channel.swift.o
"_libssh2_session_free", referenced from:
_$s5Shout7SessionCfd in Session.swift.o
"_libssh2_session_get_blocking", referenced from:
_$s5Shout7SessionC8blockings5Int32Vvg in Session.swift.o
"_libssh2_session_handshake", referenced from:
_$s5Shout7SessionC9handshake4overy6SocketAFC_tKF in Session.swift.o
"_libssh2_session_init_ex", referenced from:
_$s5Shout7SessionCACyKcfc in Session.swift.o
"_libssh2_session_last_errno", referenced from:
_$s5Shout8SSHErrorV15mostRecentError7session13backupMessageACs13OpaquePointerV_SStFZ in SSHError.swift.o
"_libssh2_session_last_error", referenced from:
_$s5Shout8SSHErrorV4kind7session13backupMessageA2C4KindO_s13OpaquePointerVSStc33_36A87DA783DEB00A06E7AF49F9616525LlfC in SSHError.swift.o
- .systemLibrary(name: "CSSH", pkgConfig: "libssh2"),
+ .systemLibrary(name: "CSSH", pkgConfig: "libssh2", providers: [.brew(["libssh2","openssl"])])
The above change fixes it. No need to run export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"
- .systemLibrary(name: "CSSH", pkgConfig: "libssh2"), + .systemLibrary(name: "CSSH", pkgConfig: "libssh2", providers: [.brew(["libssh2","openssl"])])
The above change fixes it. No need to run
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"
Would this work on macOS, because I'm having issues with using this SPM on macOS?
- .systemLibrary(name: "CSSH", pkgConfig: "libssh2"), + .systemLibrary(name: "CSSH", pkgConfig: "libssh2", providers: [.brew(["libssh2","openssl"])])
The above change fixes it. No need to run
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"
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 platforms: [ .macOS(.v10_10) ],
- .systemLibrary(name: "CSSH", pkgConfig: "libssh2"), + .systemLibrary(name: "CSSH", pkgConfig: "libssh2", providers: [.brew(["libssh2","openssl"])])
The above change fixes it. No need to run
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"
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
platforms: [
.macOS(.v10_10)
],
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 ?
- .systemLibrary(name: "CSSH", pkgConfig: "libssh2"), + .systemLibrary(name: "CSSH", pkgConfig: "libssh2", providers: [.brew(["libssh2","openssl"])])
The above change fixes it. No need to run
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"
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 platforms: [ .macOS(.v10_10) ],
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 ? please do a 'swift package clean' and try again
I'm currently trying to use Shout in my Swift project (which isn't itself a package) and I come across the same issue.
When importing shout through XCode's SPM window as a remote package, I can't get it to compile. However, when I install it locally with Ice it builds just fine.
When exporting PKG_CONFIG_PATH
I can get it to build, but if I don't it crashes just like mentionned above. However, @pelopina6 fix in the Shout Package.swift
removes the need to export PKG_CONFIG_PATH
altogether, so that's neat.
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 libssh2.h
.
I tried @cloudnull unsafe flags here but I do come across the issue of cannot be used as a dependency of this target because it uses unsafe build flags.
for which no workaround exists.
I tried symlinking libssh2 headers into /usr/local/include
but it doesn't change a thing. I've added /usr/local/include
to every Search Path options I could find on XCode but it still doesn't find it. I also tried adding the linker/c flags described by pkg-config libssh2 --cflags --libs
directly into XCode config, but I think they don't get used for building Swift Packages.
Is there no way to use Shout in another Swift package project ?
For any who need to use this in an xcodeproject that isn't a swift package, symlinking the headers to /usr/local/include/
worked for me:
sudo ln -s /usr/local/opt/openssl@1.1/lib/pkgconfig/libcrypto.pc /usr/local/include/libcrypto.pc
sudo ln -s /usr/local/opt/openssl@1.1/lib/pkgconfig/libssl.pc /usr/local/include/libssl.pc
sudo ln -s /usr/local/opt/openssl@1.1/lib/pkgconfig/openssl.pc /usr/local/include/openssl.p
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 Referenced from: /Users/robertdodson/Library/Developer/Xcode/DerivedData/FrogBlog-brutfckxlbgszsdaoglqjojqarnc/Build/Products/Debug/FrogBlog.app/Contents/MacOS/FrogBlog Reason: no suitable image found. Did find: /usr/local/opt/libssh2/lib/libssh2.1.dylib: code signature in (/usr/local/opt/libssh2/lib/libssh2.1.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
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 ..../Shout/Agent.swift:8:8: Could not build Objective-C module 'CSSH'
I have updated brew and upgraded both libssh2 and openssl@1.1.
I have also tried creating the symlinks as suggested by JacobHearst, and have tried running
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"
but to no avail
I’m having the same issue. I can’t build my project with Xcode. All I get is this error: SourcePackages/checkouts/Shout/Sources/CSSH/shim.h:4:10: 'libssh2.h' file not found
I did a fresh homebrew install, then I installed openssl@1.1 and libssh2. They are now availabe in these places:
/opt/homebrew/opt/libssh2
/opt/homebrew/opt/openssl@1.1
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):
/opt/homebrew/opt/openssl@1.1/include/**
/opt/homebrew/opt/libssh2/include/**
I also added these flags to the "Other C Flags" section:
PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@1.1/lib/pkgconfig:/opt/homebrew/opt/libssh2/lib/pkgconfig"
CPPFLAGS="-I/usr/local/opt/openssl@1.1/include -I/opt/homebrew/opt/libssh2/include"
LDFLAGS="-L/usr/local/opt/openssl@1.1/lib -L/opt/homebrew/opt/libssh2/lib"
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 libssh2.h
included in the build. People have mentioned previously having success adding it to a packaged application, but is there any way to successfully build an iOS/Mac native application through Xcode with this library as a dependency?
/usr/local/opt/openssl@1.1/include
and /usr/local/opt/libssh2/include
are included in my header search paths to no avail. Any tips?
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 $ cd libssh2 // Before running libssh2.sh I edited it to not use libz. I changed all references to --with-libz to --without-libz. I don't // need libz and I don't want to install it and figure out how to link it to my project also. // I also changed the LIBSSH2 from 1.9.0 to 1.10.0 at the top of libssh2.sh
// now build the build-xcframeworks/libssh2 project: $ bash libssh2.sh // this will download and build libssh2. It will also download libcrypto and libssl.
// 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 // folder you just built. libssh2.xcframework is in the output folder and libcrypto.xcframework is in the 3.2.2 folder.
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.