Can't execute commands in Swift on Ubuntu 14.04 - swift

I have just installed Swift 3.0.1 on Ubuntu 14.04 via Vapor tutorial.
curl -sL swift.vapor.sh/ubuntu | bash
Here I received information about that clang version >=3.4 is required.
So I manualy have installed clang 3.5 and linked this to clang.
Next I run swift command and try to run any swift command like:
print("Hello")
let w = "hello"
But swift ends with segmentation fault.
Welcome to Swift version 3.0.1 (swift-3.0.1-RELEASE). Type :help for assistance.
1> print("Hello")
Segmentation fault
Things I have tried
different swift versions
different clang versions
chmod -R o+r on swift folder
Anyone can help?

Okay. This server was made on OpenVZ virtualization.
Now I have a new one on the KVM and I have made all the same steps and it works...
So solution for my problem was to change virtualization to KVM. Maybe it was a problem of host or OpenVZ itself. No clue.

Related

Why is Swift REPL throwing error in terminal after installation on on Debian

I have installed Swift on Debian 9.9 using the instructions here:
https://tecadmin.net/install-swift-debian-9-stretch/
I also installed libicu-dev, as per swift.org instructions for Ubuntu.
swift --version returns the correct version:
$ swift --version
Swift version 5.1.1 (swift-5.1.1-RELEASE)
Target: x86_64-unknown-linux-gnu
However, the REPL is giving me an error:
1> 1 + 2
error: Couldn't lookup symbols:
swift_beginAccess
swift_beginAccess
Searching the net brings up the error occurring in Swift Playgrounds, but I'm none the wiser as to why this is happening on the Debian terminal.

How to run swift and libDispatch on ARM (Raspberry Pi)

The aim is to run swift and libDispatch on a Raspberry Pi 3. I’m using Ubuntu Core 16.04
Where I’m at: I’ve tried to get SR-397 (https://bugs.swift.org/browse/SR-397) to compile - it is a minimal Swift libDispatch example.
The projects for this SR are here: https://github.com/sheffler/gcd4 and here: https://github.com/sheffler/CDispatch
When I try to compile the gcd4 project, I get this error: “error: Empty manifest file is not supported anymore. Use swift package init to autogenerate.”
I assumed the error message was due to the empty Package.swift file, so then I copied the Sheffler CDispatch project to https://github.com/tree700/CDispatch and added a Package.swift file. I still get the same error and haven't been able to get past it.
By way of background, I’m using a precompiled download of Swift 3.1.1 from https://github.com/uraimo/buildSwiftOnARM, and have installed Ubuntu libdispatch0 and libdispatch-dev packages and dependencies on my system. The swift compiler and Swift Package Manager are working fine,
I’d love to get this going, I use Dispatch on OS X, and it makes concurrency a breeze. Thanks
The answer was simple... the extra information required is in the associated blog. To obtain and install Swift 3.1.1 go to https://www.uraimo.com/2017/09/06/A-small-update-on-Swift-for-raspberry-pi-zero-1-2-3/
Which says to do this...
sudo apt-get install git cmake ninja-build clang-3.8 python uuid-dev libicu-dev icu-devtools libbsd-dev libedit-dev libxml2-dev libsqlite3-dev swig libpython-dev libncurses5-dev pkg-config libblocksruntime-dev libcurl4-openssl-dev autoconf libtool systemtap-sdt-dev
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.8 100
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.8 100
After that, there is the the usual process of decompressing the compressed project file and adding the usr/bin directory into one's path (or run swift, swift etc from inside usr/bin)
Note: I also had to install the package libpthread-workqueue-dev. If running on Raspbian, requires an upgrade to Stretch .
———
By the way, I posted the SO question when using a Raspberry 3. In fact, I was on an early Pi model B when I got this working. The Pi 3 will soon have Swift also. Here is a simple Swift program to test libdispatch:-
import Foundation
import Dispatch
let queue = DispatchQueue(label: "queueName")
let workItem = DispatchWorkItem(qos: .userInitiated, flags: .assignCurrentContext) {
print("Hello")
}
queue.async(execute: workItem)
DispatchQueue.main.async {
print("Hello2")
}
dispatchMain()

Swift Build no such command

python-swiftclient 3.0.0
Ubuntu 16.04.1 LTS
I type in swift build and it returns the list of swift commands and says at the end no such command. Could not find anyone describing this specific command line response.
That's because you use either python-swiftclient either your PATH is wrong.
If swift --version returns:
python-swiftclient 3.0.0
Then you aren't currently calling swift build system. Check this link and update your swift release here.
Else check that you call the right swift executable by doing:
which swift
The output is the executable you are actually calling.
Environmental variable failure
just
source ~/.bashrc
Seems that the entire swift environment is needed, so visit the swift download page, and choose your system (mine is ubuntu 18.04):
$ wget https://download.swift.org/swift-5.5.2-release/ubuntu1804/swift-5.5.2-RELEASE/swift-5.5.2-RELEASE-ubuntu18.04.tar.gz
$ tar -xf swift-5.5.2-RELEASE-ubuntu18.04.tar.gz
$ PATH=~/swift-5.5.2-RELEASE-ubuntu18.04/usr/bin:$PATH
This solution worked perfect for me.

GLIBC_2.7 not found

I am getting the following error when trying to run several executables:
/lib/libc.so.6: version `GLIBC_2.7' not found (required by .tools/bridge/bridge)
I have recently upgraded from CentOS 5.3 to 5.7 (I am required to run these tools on CentOS 5, so I can't upgrade to 6).
I recompiled the whole code but this error still appears.
Has anyone encountered this type of error?
Thanks,
Claudiu
The error means that you built .tools/bridge/bridge on a system with glibc-2.7 (or later), and are trying to run it on a system that has glibc-2.6 or earlier.
Linux (and most UNIXes) does not support "build on later, run on earlier"; only the reverse scenario is supported.
See also this answer.
The 'glibc' is not the latest version, and you can try to update glibc package.
yum install glibc
or
yum install glibc-2.7

sudo port install cmake trouble (for MGTwitterEngine)

I am following This Tutorial on installing MGTwitterEngine on my MAC osx 10.6.2.
I am stuck on this step:
sudo port install cmake
it gives me the following error:
dlopen(/opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib, 10): no suitable image found. Did find:
/opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib: no matching architecture in universal wrapper
while executing
"load /opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib"
("package ifneeded Pextlib 1.0" script)
invoked from within
"package require Pextlib 1.0"
(file "/opt/local/bin/port" line 40)
Rex-MacBook-Pro:~ Rex$
Thus, I cannot use TERMINAL to install YAJL to get my app to build. Help needed.
P.S.
In terminal preferences, Shells Open With is either /usr/bin/login or /bin/bash
YAJL is supposedly installed at /Users/Rex
I am using OSX 10.6.2
Solution was that my OS is snow leopard and the version of Xcode i was using was not. Re-installing the proper xcode update solved it.