I am trying to install Vapor on my raspberrypi but getting strange errors - swift

I am running Raspbian and have so far installed Swift 5.1.5 and cloned Vapor Branch 18.0.0 beta 27. I can't seem to get version 5.2 of Swift installed on my system somehow.
Nonetheless, the next step is to build Vapor, but it gives me the following error:
sudo swift build -c release
Updating https://github.com/jpsim/Yams.git
Updating https://github.com/apple/swift-nio.git
Updating https://github.com/vapor/console-kit.git
Updating https://github.com/apple/swift-log.git
Updating https://github.com/tanner0101/mustache.git
https://github.com/apple/swift-nio.git # master: error: terminated(128): git -C /home/pi/Downloads/toolbox/.build/repositories/swift-nio-b68c973e rev-parse --verify 'master^{commit}' output:
fatal: Needed a single revision
Not sure where to go from there, can't find any relevant info online.

Vapor 4 and the new toolbox all require Swift 5.2 - you'll need to get the installed before anything else.
Next that's an old version of the toolbox, you can find the latest release at https://github.com/vapor/toolbox/releases
Finally, the chances are you don't need the toolbox. It's used for creating new projects. If you just want to build or run existing ones, just use the swift commands

Related

How to generate C API for onnxruntime on Linux

I am trying to build onnxruntime from source on Linux. According to this instruction I have successfully built python wheels and shared libs. But I have not seen headers for C API.
There is a build option --build_csharp which seems to enable C#/C packages. I tried to add this option but got following errors.
CMake Warning at CMakeLists.txt:137 (message):
Language Csharp is not found in the system
I installed dotnet-sdk-3.1 but still got this error. Can I ask how to properly generate onnxruntime C API on Linux? Thanks!
Please try the following steps:
- Steps to build ONNX from source code:
1. git clone --recursive https://github.com/Microsoft/onnxruntime
2. Get the commit ID of the version you want to build (In case you want older version)
3. git checkout "your commitID"
4. Install the required version of Cmake on your system
6. Run: <path>\build.sh --config Release --build_shared_lib --parallel
7. A build folder will be created in the onnxruntime.
5. Get the onnxruntime.dll from the dir: \onnxruntime\build\Windows\Release\Release
6. Get the required headers (onnxruntime_c_api.h, onnxruntime_cxx_api.h, onnxruntime_cxx_inline.h)
from the dir: \onnxruntime\include\onnxruntime\core\session and put it in the unit location.

vapor build command not working with Swift 3.0

I am currently following the small and brief introduction to Swift Vapor by following their "Hello World" tutorial on their website. However I keep getting an error from swift-package when I try to build the project where it shows the following.
$ vapor build
No .build folder, fetch may take a while...
Fetching Dependencies [Failed]
Error: swift-package: error: unknown command: --enable-prefetching
I cannot seem to find out how to resolve this online. Anybody have any idea?
you have not mentioned your environment, so i'm giving solution for macOS.
I had the same issue, my swift version is 3.0.2 and vapor toolbox version is 1.0.9,
I tried the following thing to make it work
get into your project directory
create xcode project with command
swift package generate-xcodeproj
open xcode project
Select your scheme as App like this
and then build and run app
hope this helps!!
Make sure that you're using the correct command line tools for the Swift Version that you're using.
You can check from Xcode > Preferences > Locations > Command Line Tools
For me, using swift 3.0.2, vapor build command doesn't work neither.
However using swift 3.1.0, vapor build command works well.
My Vapor toolbox version is v1.1.0
I had the same problem, and I had Swift 3.1 installed. I deleted old version completely and installed new one and now it's building fine.
Try
rm -rf /usr/local/bin/vapor
brew tap vapor/homebrew-tap

than
brew install vapor
or
brew link vapor
if you have installed a new version previously.

Installing Tensorflow from source

I've been trying to install Tensorflow and get it working over the past few days. Whilst I have managed to install TF and get it working as tested by opening Python in the terminal and typing,
import tensorflow as tf
I have not been successful attempting to retrain Inception v3. I managed to install it from source once by following the instructions laid out here however I am no longer able to do so. When I get to the section 'Create the pip package and install' and go to run bazel build -c opt //tensorflow/tools/pip_package:build_pip_package in the root of my Tensorflow directiory I get the following error.
kieran#kieranUbuntu:~/tensorflow$ bazel build -c opt //tensorflow/tools/pip_package:build_pip_package
ERROR: /home/kieran/tensorflow/tensorflow/core/BUILD:1068:1: no such target '//tensorflow/tools/git:gen/spec.json': target 'gen/spec.json' not declared in package 'tensorflow/tools/git' defined by /home/kieran/tensorflow/tensorflow/tools/git/BUILD and referenced by '//tensorflow/core:version_info_gen'.
ERROR: /home/kieran/tensorflow/tensorflow/core/BUILD:1068:1: no such target '//tensorflow/tools/git:gen/head': target 'gen/head' not declared in package 'tensorflow/tools/git' defined by /home/kieran/tensorflow/tensorflow/tools/git/BUILD and referenced by '//tensorflow/core:version_info_gen'.
ERROR: /home/kieran/tensorflow/tensorflow/core/BUILD:1068:1: no such target '//tensorflow/tools/git:gen/branch_ref': target 'gen/branch_ref' not declared in package 'tensorflow/tools/git' defined by /home/kieran/tensorflow/tensorflow/tools/git/BUILD and referenced by '//tensorflow/core:version_info_gen'.
ERROR: Analysis of target '//tensorflow/tools/pip_package:build_pip_package' failed; build aborted.
INFO: Elapsed time: 3.063s
This is the same error I ran into when I managed to install it and then attempted retaining the classifier following this tutorial. At the section, bazel build tensorflow/examples/image_retraining:retrain.
I just can't figure out what is going wrong and I have been trying for so long.
I'm using this pip version, # Ubuntu/Linux 64-bit, CPU only, Python 2.7
I think you should search before ask, This link can probably solve your issue.
The issue lied in the incorrect use of ./configure. Whilst it was ran I currently have two versions of python on my computer, both of which are stored in different locations, when running ./configure I pointed it to the wrong python version. After rectifying the issue everything worked correctly.

Error Setting up PerfectlySoft Swift on OS X

When trying to build the most simple starter pack for PerfectlySoft Swift Server https://github.com/PerfectlySoft/Perfect, which simply involves the following steps per their website:
git clone https://github.com/PerfectlySoft/PerfectTemplate.git
cd PerfectTemplate
swift build
.build/debug/PerfectTemplate
I get the following error multiple times during the step "Linking COpenSSL" which causes the build to error out "error: exit(1)":
#escaping attribute only applies to function types
I'm building this with Xcode command line tools V:8.0 (8S201h). What do I need to be doing differently to get this to work?
Please, use DEVELOPMENT Snapshot instead a release version of Swift:
Swift Snapshot

How to install Swift package via package manager?

I am currently following the document from swift.org to play around with the new Swift Package Manager.
I cloned the demo project from Github and run the following command from terminal.
git clone https://github.com/apple/example-package-dealer.git
cd example-package-dealer
swift build
.build/debug/Dealer
While I run swift build, error arise.
<unknown>:0: error: no such file or directory: 'build'
Any idea?
I stuck for an hour. Sadly, it's just an epic fail that downloading the wrong swift package. If you want to use swift build, MAKE SURE you download the development version.
You did not add the newly installed swift to your PATH. The instructions for doing that are here.
On OS X:
export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:"${PATH}"
On Linux:
export PATH=/path/to/Swift/usr/bin:"${PATH}"
Then to test it works:
swift build --version
I think it is a problem with the latest snapshot:
Ubuntu 14.04 Swift 2.2 Snapshot of January 11 contains swift-build in usr/bin
Ubuntu 14.04 Swift 2.2 Snapshot of January 25 doesn't contain swift-build in usr/bin
Besides, the January 25 release also seems to miss other files (libFoundation.so and libXCTest.so in usr/lib/swift/linux for instances).
Either there has been a structure change....or, simply, the latest snapshot had a problem ;)
While they fix the snapshot, simply take the older (January 11th) snapshot, and you should be fine.
I was facing the same issue and in my case, I recently updated my Xcode to 8.2.1 and swift 3.0 comes with it.
I was getting this log.
Ranvijay-Mac-mini:PerfectTemplate ranaranvijaysingh$ swift build
error: unable to invoke subcommand: /Library/Developer/CommandLineTools/usr/bin/swift-build (No such file or directory)
The path it was taking was incorrect. It was suppose to be:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
To change the path, run this command.
export PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:$PATH
And DONE.
Run : swift build again on your project and if you get this error.
xcrun: error: unable to lookup item 'PlatformPath' from command line tools installation
xcrun: error: unable to lookup item 'PlatformPath' in SDK '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk'
error: Invalid platform path
then you need to change the SDK path as well.
In my case, I had two .sdk at path
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
MacOSX.sdk MacOSX10.12.sdk
To know what is your SDK path, run this command.
xcrun --sdk macosx --show-sdk-path
My case i got this.
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
To change it run this command.
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
and NOW DONE.
Try running swift build now.