openssl / ctls trouble with vapor 2 - ssl

How can I fix these OpenSSL / TLS issues I'm getting with Vapor 2? They are preventing me from compiling my project on the command line and in Xcode.
During SPM build:
note: you may be able to install ctls using your system-packager:
brew install ctls
note: you may be able to install ctls using your system-packager:
brew install openssl
Upon failure of SPM build:
Linking ./.build/debug/Run
ld: library not found for -lcrypto for architecture x86_64
<unknown>:0: error: link command failed with exit code 1 (use -v to see invocation)
<unknown>:0: error: build had 1 command failures
error: exit(1): /Library/Developer/Toolchains/swift-3.1-DEVELOPMENT-SNAPSHOT-2017-03-07-a.xctoolchain/usr/bin/swift-build-tool -f /Users/tanner/Desktop/PackageConfig/.build/debug.yaml
Also in SPM:
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "shim.h"
^
/Users/tanner/Desktop/PackageConfigTwo/.build/checkouts/ctls.git-9210868160426949823/shim.h:4:10: error: 'openssl/conf.h' file not found
#include <openssl/conf.h>
^
/Users/tanner/Desktop/PackageConfigTwo/.build/checkouts/crypto.git-7980259129511365902/Sources/Crypto/Cipher/Cipher+Method.swift:1:8: error: could not build Objective-C module 'CTLS'
import CTLS
^
In Xcode:
/Users/tanner/PackageConfig/.build/checkouts/ctls.git-9210868160426949823/shim.h:4:10: 'openssl/conf.h' file not found
/Users/tanner/PackageConfig/.build/checkouts/crypto.git-7980259129511365902/Sources/Crypto/Cipher/Cipher+Method.swift:1:8: Could not build Objective-C module 'CTLS'
ld: library not found for -lssl

This error means OpenSSL is either not installed or not being properly linked. There are three solutions to this problem.
Option 1: Use Vapor Toolbox (Recommended)
Install the latest version of the Vapor toolbox.
If you have already installed the toolbox, try uninstalling it first:
which vapor
rm -rf /path/to/vapor
1.1 Install (macOS)
Add Vapor's Homebrew Tap
brew tap vapor/homebrew-tap
Update Homebrew and install the toolbox.
brew update
brew install vapor
1.2 Install (Ubuntu)
Add Vapor's APT repo.
Quick Script
eval "$(curl -sL https://apt.vapor.sh)"
Manual
wget -q https://repo.vapor.codes/apt/keyring.gpg -O- | sudo apt-key add -
echo "deb https://repo.vapor.codes/apt $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/vapor.list
Install
sudo apt-get update
sudo apt-get install vapor
1.3 Done
You should now have access to the vapor program and all required dependencies should be installed.
vapor build
vapor xcode
swift build and related commands should now also work normally.
swift build
swift package generate-xcodeproj
Option 2: Install Vapor's CTLS Package
2.1 Install (macOS)
Add Vapor's Homebrew Tap
brew tap vapor/homebrew-tap
Update Homebrew and install CTLS
brew update
brew install ctls
Restart your terminal, re-generate your Xcode project (if using Xcode), and try again.
2.2 Install (Ubuntu)
Add Vapor's APT repo.
Quick Script
eval "$(curl -sL https://apt.vapor.sh)"
Manual
wget -q https://repo.vapor.codes/apt/keyring.gpg -O- | sudo apt-key add -
echo "deb https://repo.vapor.codes/apt $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/vapor.list
Update APT and install CTLS.
sudo apt-get update
sudo apt-get install ctls
2.3 Done
swift build and other commands should now work normally.
Option 3: Manually Install and Link OpenSSL or Equivalent
3.1 Install (macOS)
Install OpenSSL (or any other similar SSL library)
brew install openssl
brew install libressl
3.2 Install (Ubuntu)
Install OpenSSL (or any other similar SSL library)
sudo apt-get install libssl-dev
3.3 Finding Linker Flags
You can use pkg-config (available on brew and apt) to find linker flags or most packages.
pkg-config <package-name> --cflags
pkg-config <package-name> --libs
However, OpenSSL installed through Homebrew cannot be linked and thus does not work with pkg-config. These flags should work:
include: /usr/local/opt/openssl/include
libs: /usr/local/opt/openssl/lib
Note, some libraries will be installed into /usr/include and /usr/lib which does not require explicit linker flags. OpenSSL through APT is installed this way.
3.4 Using Linker Flags
Linker flags can be added during swift build
swift build -Xswiftc -I/path/to/include -Xlinker -L/path/to/lib
They can also be added during Xcode project generation.
swift package -Xswiftc -I/path/to/include -Xlinker -L/path/to/lib generate-xcodeproj

#tanner0101 your suggestions here https://github.com/vapor/vapor/issues/937 have not resolved the issue for me. I get the CTLS is missing error not only on High Sierra but also on Ubuntu inside a Docker container.
The project is manually executable but MySQL does not work. I think that this https://github.com/vapor/vapor/issues/954 and this https://github.com/uchicago-cloud/mpcs51033-2017-spring-forum/issues/54 are not just deployment on Heroku issues.

Related

Installing janus-gateway error on CentOS7

I want to install janus-gateway on CentOS7.
I read the following document and tried installation.
https://github.com/meetecho/janus-gateway/blob/master/README.md
git clone https://github.com/meetecho/janus-gateway.git
cd janus-gateway
sh autogen.sh
./configure --prefix=/opt/janus
However, configuring janus-gateway will cause an error. The error is as follows.
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for pkg-config... /bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for JANUS... no
configure: error: Package requirements (
glib-2.0 >= 2.34
libconfig
nice
jansson >= 2.5
libssl >= 1.0.1
libcrypto
) were not met:
No package 'nice' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables JANUS_CFLAGS
and JANUS_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
I installed libnice(libnice-0.1.3-4.el7.x86_64) in the following way.
yum install libnice
How can I solve it?
Thank you.
try this and rebuild
echo "export PKG_CONFIG_PATH=/usr/lib/pkgconfig" >> ~/.bashrc
source ~/.bashrc
Disclaimer: I am using Ubuntu 18.04 when testing this.
If you are using Ubuntu system and trying to install Janus and running this code
./configure --prefix=/opt/janus
And then getting this error: No package 'nice' found
Make sure you have been installation of the nice from aptitude.
sudo install aptitude
aptitude install libmicrohttpd-dev libjansson-dev \
libssl-dev libsrtp-dev libsofia-sip-ua-dev libglib2.0-dev \
libopus-dev libogg-dev libcurl4-openssl-dev liblua5.3-dev \
libconfig-dev pkg-config gengetopt libtool automake
For some reason installation of nice using the answer from Frank, Ahmet or Zallfire doesn't work in Ubuntu. It has to be installed using aptitude.
You should download libnice source code to install.
https://gitlab.freedesktop.org/libnice/libnice
You need the development libnice.
yum install libnice-devel

Getting error java.lang.UnsatisfiedLinkError: no jzmq in java.library.path in IntelliJ ide with windows 10

I have a java project which have zeromq implementation. i have installed zeromq windows version in my windows 10 OS.
When running the application i am getting above error.
I have downloaded zeromq (windows) installer from http://zeromq.org/area:download and installed it in C:\ZeroMQ4.0.4 folder.
Any idea what further action i have to take?
As i am not able to successfully work it in windows i have installed it in a ubuntu 16 vm under my windows 10 machine
Steps i have done are
Installed java in ubuntu
apt-get install -y libtool pkg-config build-essential autoconf automake uuid-dev libzmq3-dev checkinstall
Download Required Package
wget https://github.com/zeromq/zeromq4-x/releases/download/v4.0.8/zeromq-4.0.8.tar.gz
wget https://github.com/zeromq/jzmq/archive/v2.2.2.zip
tar -xzf zeromq-4.0.8.tar.gz
unzip v2.2.2.zip
Install ZMQ
cd zeromq-4.0.8
./configure
make
checkinstall it will creat deb package to be removed easily if required
ldconfig
install jzmaq
cd jzmq-2.2.2/
./autogen.sh
./configure
make
make install
*** In case error show up --- autogen.sh: error: could not find libtool. libtool is required to run autogen.sh. run the mentioned command.
ln -s /usr/bin/libtoolize /usr/bin/libtool
Set java_home path in ubuntu
Still i am getting same error when debugging it from my windows 10 machine with Intellij IDE

How to fix: fatal error: openssl/opensslv.h: No such file or directory in RedHat 7

I have RedHat Enterprise Linux Server 7, and I downloaded the linux kernel version 4.12.10 which I am trying to compile but when I execute the following command:
make modules
I get the following error:
scripts/sign-file.c:25:30: fatal error: openssl/opensslv.h: No such file or directory
Does anyone have an idea to fix this please ?
To fix this problem, you have to install OpenSSL development package, which is available in standard repositories of all modern Linux distributions.
To install OpenSSL development package on Debian, Ubuntu or their derivatives:
$ sudo apt-get install libssl-dev
To install OpenSSL development package on Fedora, CentOS or RHEL:
$ sudo yum install openssl-devel
Edit :
As #isapir has pointed out, for Fedora version>=22 use the DNF package manager :
dnf install openssl-devel
For Alpine Linux:
apk add openssl-dev
On CYGwin, you can install this as a typical package in the first screen. Look for
libssl-devel
for resolving this issue install:
# yum install openssl openssl-devel
and then try again to do make bzImage.

Phalcon install give error on ubuntu [duplicate]

I'm just finished installing Ubuntu 13.10.
I want try Phalcon, and when I build the source (phalcon.so), I have this error :
from /home/fabrice/Downloads/cphalcon/build/32bits/phalcon.c:204:
/usr/include/php5/ext/pcre/php_pcre.h:29:18: fatal error: pcre.h: No such file or directory
#include "pcre.h"
^
compilation terminated.
make: *** [phalcon.lo] Erreur 1
My installation of lamp is :
sudo apt-get install -y apache2 php5 mysql-server libapache2-mod-php5
php5-mysql php5-curl php5-imagick php5-mcrypt php5-memcache
php5-sqlite php5-xdebug php-apc php5-intl php-mongo php5-dev gcc
Can anybody help me ?
The latest version of Phalcon uses PCRE libraries.
You can install them like so:
sudo apt-get install libpcre3-dev
and then try and install Phalcon again
For CentOS you will need to use
sudo yum install pcre-devel
Credits: #xgretsch
For Mac you can use
brew install pcre
Credits #Brandon Romano
For Mac without brew
Go to https://www.pcre.org/ and download latest pcre:,
tar -xzvf pcre-8.42.tar.gz
cd pcre-8.42
./configure --prefix=/usr/local/pcre-8.42
make
make install
ln -s /usr/local/pcre-8.42 /usr/sbin/pcre
ln -s /usr/local/pcre-8.42/include/pcre.h /usr/include/pcre.h
Credits #user1377324
For mac osx maverick you can use
brew install pcre
if it gives you error, you can use
sudo ln -s /opt/local/include/pcre.h /usr/include/
sudo pecl install apc
I have installed pcre via homebrew in Big Sur, so linked as:
sudo ln -s /opt/homebrew/include/pcre2.h /usr/local/include/
To include pcre.h file, search the package archives for the pcre.h file.
To do this I use a command called apt-file (
apt-get install apt-file
and
apt-file update
if you don’t have it installed).
Then search for the pcre package:
apt-file search -x "/pcre.h$"
The -x informs the command that I want to use a regular expression as the pattern. apt-file provided me with three hits:
kannel-dev: /usr/include/kannel/gwlib/pcre.h
libajax6-dev: /usr/include/ajax/pcre.h
libpcre3-dev: /usr/include/pcre.h
The last one is the one I want:
apt-get install libpcre3-dev
This will solve the problem with pcre.h file compilation problem. Hope it will help others, who may come to find an answer to this thread.
For MacOS monterey amd64 (darwin), it is necessary to create a symlink.
First, locate where the pcre.h was installed by Brew:
$ brew list pcre | grep 'pcre\.h$'
/opt/homebrew/Cellar/pcre/8.45/include/pcre.h
Then, gets the directory that GCC is looking for header (.h) files:
$ cpp -v
...
#include <...> search starts here:
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
/Library/Developer/CommandLineTools/usr/include # <---- we are going to use this one
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
Finally, create a symlink to the pcre.h file, so that GCC will find it in its search path:
ln -s /opt/homebrew/Cellar/pcre/8.45/include/pcre.h \
/Library/Developer/CommandLineTools/usr/include/pcre.h
To test if it worked, we can use the following C code:
#include <stdio.h>
#include <pcre.h>
int main() {
printf("lala popo");
return 0;
}
And run:
gcc test.c -o test
πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰
Using macOS Monterey 12.6 on an M1 Pro MacBook Pro, here are the steps necessary to install outh extension for PHP 8.1 using brew:
brew install pcre
brew install pcre2
sudo ln -s /opt/homebrew/include/pcre.h /usr/local/include/
sudo ln -s /opt/homebrew/include/pcre2.h /usr/local/include/
sudo pecl install oauth

installing Mod_Mono and Xsp4 on CentOS 6.3

I've gotten Mono 3.0.1 installed, but I'm running into tons of dependency issues trying to install Mod_Mono and Xsp4, Has anyone gotten this to work? If so what were some of the steps you had to take? Is there a central location for this?
Thank you so much for taking the time to read my question and happy coding!
Enviroment:
Centos 6.3 basic install
Apache/2.2.15
Installation steps:
#Install required software
yum -y install httpd httpd-devel make glib2-devel libpng-devel libjpeg-devel
giflib-devel libtiff-devel libX11-devel gcc* fontconfig-devel bison gettext bzip2
libtool automake autoconf wget unzip
directory we will be installing mono in
mkdir -p /opt/mono
cd /tmp
Download & extract source
wget http://download.mono-project.com/sources/mono/mono-2.10.2.tar.bz2
wget http://download.mono-project.com/sources/xsp/xsp-2.10.2.tar.bz2
wget http://download.mono-project.com/sources/mod_mono/mod_mono-2.10.tar.bz2
wget http://download.mono-project.com/sources/libgdiplus/libgdiplus-2.10.tar.bz2
tar -xjf mono-2.10.2.tar.bz2
tar -xjf xsp-2.10.2.tar.bz2
tar -xjf mod_mono-2.10.tar.bz2
tar -xjf libgdiplus-2.10.tar.bz2
compile and install libgdiplus
cd libgdiplus-2.10
./configure --prefix=/opt/mono
make ; make install
compile and install mono
cd ../mono-2.10.2
./configure --prefix=/opt/mono --with-libgdiplus=/opt/mono
make ; make install
Set enviroment vars(make sure to also modify ~/.bash_profile)
export PATH=$PATH:/opt/mono/bin
export PKG_CONFIG_PATH=/opt/mono/lib/pkgconfig
compile and install xsp
cd ../xsp-2.10.2
./configure --prefix=/opt/mono
make ; make install
compile and install mod_mono
cd ../mod_mono-2.10
./configure --prefix=/opt/mono --with-mono-prefix=/opt/mono
make ; make install
mv /etc/httpd/conf/mod_mono.conf /etc/httpd/conf.d/
Currently working with mono and xsp4:
[root]# cat /etc/redhat-release
CentOS release 6.7 (Final)
[root]# mono --version
Mono JIT compiler version 4.5.0
[root]# xsp4 --version
xsp4.exe 2.10.2.0
Chazt3n solution is ok, except I had to do some changes to make it work:
I changed the mono version from 4.0 to 4.5 in file: /opt/mono/bin/mod-mono-server4
I ran this command: cp /opt/mono/lib/mono/4.0/xsp4.exe /opt/mono/lib/mono/4.5/
Works well now, thanks.