frugghi / issh2 Goto Github PK
View Code? Open in Web Editor NEWA bash script to compile Libssh2 (and OpenSSL) for iOS, macOS, watchOS and tvOS.
License: Other
A bash script to compile Libssh2 (and OpenSSL) for iOS, macOS, watchOS and tvOS.
License: Other
Is anyone else having issues on XCode 8?
We have tried to build a script in macOS 10.14.4 and xcode 10.2.1
`MAC29:iSSH2-master mtp$ ./iSSH2.sh
Initializing...
Libssh2 version: 1.8.2 (Automatically detected)
OpenSSL version: 1.1.1b (Automatically detected)
SDK version: 12.2 (Automatically detected)
Architectures: armv7 armv7s arm64 x86_64
OS min version: 8.0
openssl-1.1.1b.tar.gz already exists
MD5: 4532712e7bcc9414f5bce995e4e13930
Extracting openssl-1.1.1b.tar.gz
Building OpenSSL 1.1.1b, please wait...
libssl.a and libcrypto.a for armv7 already exist.
libssl.a and libcrypto.a for armv7s already exist.
libssl.a and libcrypto.a for arm64 already exist.
libssl.a and libcrypto.a for x86_64 already exist.
Building libssl.a fat library...
Building libcrypto.a fat library...
Copying headers...
Building done.
libssh2-1.8.2.tar.gz already exists
MD5: 616efd99af3d9ef731a26bed6cee9593
Extracting libssh2-1.8.2.tar.gz
Building Libssh2 1.8.2:
Build failed, cleaning up temporary files...
MAC29:iSSH2-master mtp$ `
Whenever I run iSSH2.sh
, OpenSSL builds just fine but I keep getting errors when building Libssh2.
Initializing...
Libssh2 version: 1.8.0 (Automatically detected)
OpenSSL version: 1.1.0g (Automatically detected)
SDK version: 11.2 (Automatically detected)
Architectures: armv7 armv7s arm64 x86_64
OS min version: 8.0
Downloading openssl-1.1.0g.tar.gz
######################################################################## 100.0%
MD5: ba5f1b8b835b88cadbce9b35ed9531a6
Extracting openssl-1.1.0g.tar.gz
Building OpenSSL 1.1.0g, please wait...
- iPhoneOS armv7 done!
- iPhoneOS armv7s done!
- iPhoneOS arm64 done!
- iPhoneSimulator x86_64 done!
Building libssl.a fat library...
Building libcrypto.a fat library...
Copying headers...
Building done.
Downloading libssh2-1.8.0.tar.gz
######################################################################## 100.0%
MD5: 3d1147cae66e2959ea5441b183de1b1c
Extracting libssh2-1.8.0.tar.gz
Building Libssh2 1.8.0:
Build failed, cleaning up temporary files...
However, it appears that the libssha2.a
file is actually compiled successfully, as the next pass of iSSH2.sh
shows the following output:
...
Copying headers...
Building done.
libssh2-1.8.0.tar.gz already exists
MD5: 3d1147cae66e2959ea5441b183de1b1c
Extracting libssh2-1.8.0.tar.gz
Building Libssh2 1.8.0:
libssh2.a for armv7 already exists.
Build failed, cleaning up temporary files...
The next run yields:
...
Copying headers...
Building done.
libssh2-1.8.0.tar.gz already exists
MD5: 3d1147cae66e2959ea5441b183de1b1c
Extracting libssh2-1.8.0.tar.gz
Building Libssh2 1.8.0:
libssh2.a for armv7 already exists.
libssh2.a for armv7s already exists.
Build failed, cleaning up temporary files...
This goes on until all of the libraries seemingly compile correctly:
Copying headers...
Building done.
libssh2-1.8.0.tar.gz already exists
MD5: 3d1147cae66e2959ea5441b183de1b1c
Extracting libssh2-1.8.0.tar.gz
Building Libssh2 1.8.0:
libssh2.a for armv7 already exists.
libssh2.a for armv7s already exists.
libssh2.a for arm64 already exists.
libssh2.a for x86_64 already exists.
Building libssh2.a fat library...
Copying headers...
Building done.
Cleaning up temporary files...
This is the end of the compile log of a failure:
make[2]: Nothing to be done for `install-exec-am'.
/usr/local/bin/gmkdir -p '/var/folders/bk/d1v9y42n50q1m_bqwrjm5cjm0000gq/T/iSSH2/libssh2-1.8.0/iPhoneSimulator11.2-x86_64/lib/pkgconfig'
/usr/local/bin/gmkdir -p '/var/folders/bk/d1v9y42n50q1m_bqwrjm5cjm0000gq/T/iSSH2/libssh2-1.8.0/iPhoneSimulator11.2-x86_64/include'
/usr/local/bin/ginstall -c -m 644 include/libssh2.h include/libssh2_publickey.h include/libssh2_sftp.h '/var/folders/bk/d1v9y42n50q1m_bqwrjm5cjm0000gq/T/iSSH2/libssh2-1.8.0/iPhoneSimulator11.2-x86_64/include'
/usr/local/bin/ginstall -c -m 644 libssh2.pc '/var/folders/bk/d1v9y42n50q1m_bqwrjm5cjm0000gq/T/iSSH2/libssh2-1.8.0/iPhoneSimulator11.2-x86_64/lib/pkgconfig'
ginstall: 'include/libssh2.h' and '/var/folders/bk/d1v9y42n50q1m_bqwrjm5cjm0000gq/T/iSSH2/libssh2-1.8.0/iPhoneSimulator11.2-x86_64/include/libssh2.h' are the same file
ginstall: 'include/libssh2_publickey.h' and '/var/folders/bk/d1v9y42n50q1m_bqwrjm5cjm0000gq/T/iSSH2/libssh2-1.8.0/iPhoneSimulator11.2-x86_64/include/libssh2_publickey.h' are the same file
ginstall: 'include/libssh2_sftp.h' and '/var/folders/bk/d1v9y42n50q1m_bqwrjm5cjm0000gq/T/iSSH2/libssh2-1.8.0/iPhoneSimulator11.2-x86_64/include/libssh2_sftp.h' are the same file
make[2]: *** [install-includeHEADERS] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [install-am] Error 2
make: *** [install-recursive] Error 1
I haven't actually tried using the compiled libraries yet.
I'm trying to test my app in the simulator, but I'm using a newer M1 laptop (arm64). Because Sim build is only executed if the arch is i386 or x86_64 when trying to link my app (sim) it complains about missing architecture of all the libraries.
The problem is that the platformName
function in iSSH-commons is assuming iPhoneSimulator
for non-arm archs. This was true before Apple introduced the M1 platform.
I get an error while compiling for iphoneos.
I saw an similar issue #5.
Maybe its something similar.
Thanks.
./iSSH2.sh --platform=iphoneos --xcodeproj=../ssh/ --min-version=13.2
Initializing...
Libssh2 version: 1.9.0 (Automatically detected)
OpenSSL version: 1.1.1h (Automatically detected)
SDK version: 14.0 (Automatically detected)
Xcode version: 12.0.1 (Automatically detected)
Architectures: arm64 arm64e x86_64
Platform: iphoneos
Platform min version: 13.2
Downloading openssl-1.1.1h.tar.gz
################################################################################################################# 100,0%
MD5: 53840c70434793127a3574433494e8d3
Extracting openssl-1.1.1h.tar.gz
Building OpenSSL 1.1.1h, please wait...
- iPhoneOS arm64 done!
- iPhoneOS arm64e done!
- iPhoneSimulator x86_64 done!
Building libssl.a fat library...
Building libcrypto.a fat library...
Copying headers...
Building done.
Downloading libssh2-1.9.0.tar.gz
################################################################################################################# 100,0%################################################################################################################# 100,0%
MD5: 1beefafe8963982adc84b408b2959927
Extracting libssh2-1.9.0.tar.gz
Building Libssh2 1.9.0:
Build failed, cleaning up temporary files...
./iSSH2-libssh2.sh: line 26: /iSSH2-commons: No such file or directory
mkdir: : No such file or directory
I know this is an early call, but at the moment this script fails on macOS 14 beta (Sonoma) with Xcode 15 beta:
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
LibSSH2 1.11.0 has been released with a lot of changes. See the release page:
https://github.com/libssh2/libssh2/releases/tag/libssh2-1.11.0
If you have applied this patch the script will automatically detect OpenSSL 1.1.1u (also released yesterday) and LibSSH2 1.11.0. It builds OK, but I did not test it yet in production. If anyone has experiences with the update: please share them here.
Any ideas ? Using Xcode Version 8
Building libssl.a fat library...
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't open input file: /var/folders/_1/z61z4f1d3xn4xq7wzd2w5w_w0000gp/T//iSSH2/openssl-1.1.0/iPhoneOS10.0-armv7/libssl.a (No such file or directory)
Build failed, cleaning up temporary files...
There's no dylib file in libssh2, how can I fix it?
Hi,
I'm trying to compile for Catalyst, and the way I try doing that is through making an .xcframework. So I tried the following:
sh iSSH2.sh --platform=macosx --archs="x86_64" # i386 no longer supported on 10.15
sh iSSH2.sh --platform=iphoneos --min-version=13.0
xcodebuild -create-xcframework \
-library libssh2_macosx/lib/libssh2.a -headers libssh2_macosx/include \
-library libssh2_iphoneos/lib/libssh2.a -headers libssh2_iphoneos/include \
-output libssh2.xcframework
But that gave me:
"error: binaries with multiple platforms are not supported 'libssh2_iphoneos/lib/libssh2.a'"
So I compiled x86_64 and arm64+arm64e separately
sh iSSH2.sh --platform=macosx --archs="x86_64"
sh iSSH2.sh --platform=iphoneos --min-version=13.0 --archs="arm64 arm64e"
mv libssh2_iphoneos libssh2_iphoneos_arm64_arm64e
sh iSSH2.sh --platform=iphoneos --min-version=13.0 --archs="x86_64"
mv libssh2_iphoneos libssh2_iphoneos_x86_64
xcodebuild -create-xcframework \
-library libssh2_macosx/lib/libssh2.a -headers libssh2_macosx/include \
-library libssh2_iphoneos_x86_64/lib/libssh2.a -headers libssh2_iphoneos_x86_64/include \
-library libssh2_iphoneos_arm64_arm64e/lib/libssh2.a -headers libssh2_iphoneos_arm64_arm64e/include \
-output libssh2.xcframework
but that gave me a new error:
"error: unable to find any architecture information in the binary at 'libssh2_iphoneos_arm64_arm64e/lib/libssh2.a'"
Even splitting arm64 and arm64e into binaries for just them, or only include arm64 or arm64e themselves, gave me the same error. Why won't it find architecture information?
Not including arm64 and arm64e at all, however, gave me success:
"xcframework successfully written out to: libssh2.xcframework"
But obviously, I'd like a framework with arm64 and arm64e support. :-)
Any input on how to proceed from here? Would be really good to be able to build this for Mac Catalyst
I have issues compiling libssh for arm64, while armv7 is ok.
global.c:48:9: error: implicit declaration of function 'ENGINE_load_builtin_engines' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
libssh2_crypto_init();
^
../src/openssl.h:231:3: note: expanded from macro 'libssh2_crypto_init'
configuration:
Libssh2 version: 1.8.0 (Automatically detected)
OpenSSL version: 1.1.1 (Automatically detected)
SDK version: 11.4 (Automatically detected)
All right with OpenSSL 1.1.0i.
Any ideas ?
I tried to run the below command ./iSSH2.sh --platform=iphoneos --min-version=8.0 --openssl=3.0.1 to build specifically for OpenSSL 3.0.1 version as ./iSSH2.sh --platform=iphoneos --min-version=8.0 builds for OpenSSL version: 1.1.1m which is not required.
But it gives me the error like as shown below. Any resolution for this error? @Frugghi @Jan-E
When I ran the script I am getting the following error
`Initializing...
Libssh2 version: 1.9.0 (Automatically detected)
OpenSSL version: 1.1.1r (Automatically detected)
SDK version: 16.0 (Automatically detected)
Xcode version: 14.0.1 (Automatically detected)
Architectures: arm64 arm64e armv7 armv7s i386 x86_64
Platform: iphoneos
Platform min version: 8.0
openssl-1.1.1r.tar.gz already exists
MD5: bb8a5c2eff5c060e1701541ab2a02b88
Extracting openssl-1.1.1r.tar.gz
Building OpenSSL 1.1.1r, please wait...
Build failed, cleaning up temporary files...`
here is the command I am running
./iSSH2.sh --platform=iphoneos --min-version=8.0
I am running this on macosx monterey
Any help would be greatly appreciated. Thanks
There will be a new LibSSH2 release shortly with a fix for the Terrapin MITM attack. The fix is already merged in the sources of LibSSH2:
libssh2/libssh2#1249
https://terrapin-attack.com
I wonder if I do something wrong ...
MacBook-Pro:iSSH2 $ pwd
/Users/cl/Documents/Development/GitHub/iSSH2
MacBook-Pro:iSSH2 $ ./iSSH2.sh
Initializing...
Libssh2 version: 1.7.0 (Automatically detected)
OpenSSL version: 1.0.2g (Automatically detected)
SDK version: 9.3 (Automatically detected)
Architectures: armv7 armv7s arm64 i386 x86_64
OS min version: 8.0
openssl-1.0.2g.tar.gz already exists
MD5: f3c710c045cdee5fd114feb69feba7aa
Extracting openssl-1.0.2g.tar.gz
Building OpenSSL 1.0.2g, please wait...
Building libssl.a fat library...
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't open input file: /var/folders/2q/v9d6rfmx6wdf6n9bhb5gqtr00000gn/T//iSSH2/openssl-1.0.2g/iPhoneOS9.3-armv7/libssl.a (No such file or directory)
Build failed, cleaning up temporary files...
MacBook-Pro:iSSH2 $
Any ideas ? Using Xcode Version 7.3 (7D175)
Libssh2 version fetched 1.9.0 instead of 1.10.0
echo git ls-remote --tags https://github.com/libssh2/libssh2.git | egrep "libssh2-[0-9]+(\.[0-9])*[a-zA-Z]?$" | cut -f 2 -d - | sort -t . -r | head -n 1
1.9.0
MacOS 10.14.6
Xcode 10.3 (10G8)
Command used: ./iSSH2.sh --platform=macosx --min-version=10.14
The script automatically downloads openssl-1.1.1c and libssh2 1.9.0
Openssl compiles just fine but libssh2 fails with this error:
Extracting libssh2-1.9.0.tar.gz
Building Libssh2 1.9.0:
Build failed, cleaning up temporary files...
build-libssh2.log contains this:
Configure: WARNING: unrecognized options: --with-openssl
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether make supports nested variables... yes
checking for sed... /usr/bin/sed
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for i386-apple-darwin-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking libssh2 version... 1.9.0
checking build system type... x86_64-apple-darwin18.7.0
checking host system type... i386-apple-darwin
Configure: autobuild project... libssh2
Configure: autobuild revision... 1.9.0
Configure: autobuild hostname... AlexsMacMini
Configure: autobuild timestamp... 20190909-112840
checking whether make supports the include directive... yes (GNU style)
checking for i386-apple-darwin-gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
checking whether the C compiler works... no
Configure: error: in `/var/folders/zr/ph6s5xdx0858lcm33599_l980000gn/T/iSSH2/libssh2-1.9.0/MacOSX_10.14-i386/src':
Configure: error: C compiler cannot create executables
See `config.log' for more detai
In config.log it seems to fail here:
clang: error: unsupported option '-V -Wno-atomic-implicit-seq-cst'
clang: error: no input files
clang: error: unknown argument '-qversion', did you mean '--version'?
clang: error: no input files
Here is the complete file:
config.log
Is this script compatible to compile libssh 0.9.6 for ios / macOS?
Hey I made a libssh binding on dart to be able to use libssh on windows and linux with flutter, now I want to use it on ios and macOS too, but I don't know how to compile libssh for ios
https://pub.dev/packages/libssh_binding
https://www.libssh.org/
Hi,
./iSSH2.sh --platform=macosx --archs=arm64 --min-version=10.16
gives me a simple
Build failed, cleaning up temporary files...
Has anyone been able to modify the script to get a ARM build for macOS?
OpenSSL should build for ARM (openssl/openssl@61168b5) not so sure about libssh2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.