ssl - openssl / ctls trouble with vapor 2 -


how can fix these openssl / tls issues i'm getting vapor 2? preventing me compiling project on command line , in xcode.

during spm build:

note: may able install ctls using system-packager:      brew install ctls  note: may able install ctls using system-packager:      brew install openssl 

upon failure of spm build:

linking ./.build/debug/run ld: library not found -lcrypto architecture x86_64 <unknown>:0: error: link command failed exit code 1 (use -v 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 <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: 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: not build objective-c module 'ctls'  ld: library not found -lssl 

xcode failing ctls issues

this error means openssl either not installed or not being linked. there 3 solutions problem.

option 1: use vapor toolbox (recommended)

install latest version of vapor toolbox.

if have installed toolbox, try uninstalling first:

which vapor rm -rf /path/to/vapor 

1.1 install (macos)

add vapor's homebrew tap

brew tap vapor/homebrew-tap 

update homebrew , install 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 have access vapor program , required dependencies should installed.

vapor build vapor xcode 

swift build , related commands should 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 , install ctls

brew update brew install ctls 

restart terminal, re-generate xcode project (if using xcode), , 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 , install ctls.

sudo apt-get update sudo apt-get install ctls 

2.3 done

swift build , other commands should work normally.

option 3: manually install , link openssl or equivalent

3.1 install (macos)

install openssl (or other similar ssl library)

brew install openssl brew install libressl 

3.2 install (ubuntu)

install openssl (or other similar ssl library)

sudo apt-get install libssl-dev 

3.3 finding linker flags

you can use pkg-config (available on brew , apt) find linker flags or packages.

pkg-config <package-name> --cflags pkg-config <package-name> --libs 

however, openssl installed through homebrew cannot linked , not work pkg-config. these flags should work:

include: /usr/local/opt/openssl/include libs: /usr/local/opt/openssl/lib 

note, libraries installed /usr/include , /usr/lib not require explicit linker flags. openssl through apt installed way.

3.4 using linker flags

linker flags can added during swift build

swift build -xswiftc -i/path/to/include -xlinker -l/path/to/lib 

they can added during xcode project generation.

swift package -xswiftc -i/path/to/include -xlinker -l/path/to/lib generate-xcodeproj 

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -