udacity / ios-short-s3-auth

This repository contains the authentication (auth) microservice from Udacity's server-side Swift curriculum.
http://docs.l1auth.apiary.io/#
MIT License
3 stars 2 forks source link

Not able to run swift build in docker. It runs on my Mac but not on docker. #1

Open ghost opened 6 years ago

ghost commented 6 years ago

This is what I am getting when I tried swift build in the docker container-

`root@5265c00ca732:/app# swift build Fetching https://github.com/IBM-Swift/Kitura.git Fetching https://github.com/IBM-Swift/Kitura-CredentialsHTTP.git Fetching https://github.com/IBM-Swift/Kitura-Credentials.git Fetching https://github.com/IBM-Swift/HeliumLogger.git Fetching https://github.com/PerfectlySoft/Perfect-Crypto.git Fetching https://github.com/IBM-Swift/Kitura-net.git Fetching https://github.com/IBM-Swift/SwiftyJSON.git Fetching https://github.com/IBM-Swift/Kitura-TemplateEngine.git Fetching https://github.com/IBM-Swift/LoggerAPI.git Fetching https://github.com/IBM-Swift/CCurl.git Fetching https://github.com/IBM-Swift/BlueSocket.git Fetching https://github.com/IBM-Swift/BlueSSLService.git Fetching https://github.com/IBM-Swift/CEpoll.git Fetching https://github.com/IBM-Swift/BlueSignals.git Fetching https://github.com/IBM-Swift/OpenSSL.git Fetching https://github.com/IBM-Swift/Kitura-Session.git Fetching https://github.com/IBM-Swift/BlueCryptor.git Fetching https://github.com/PerfectlySoft/PerfectLib.git Fetching https://github.com/PerfectlySoft/Perfect-COpenSSL-Linux.git Fetching https://github.com/PerfectlySoft/Perfect-Thread.git Fetching https://github.com/PerfectlySoft/Perfect-LinuxBridge.git Cloning https://github.com/PerfectlySoft/Perfect-Thread.git Resolving https://github.com/PerfectlySoft/Perfect-Thread.git at 2.0.12 Cloning https://github.com/IBM-Swift/Kitura-net.git Resolving https://github.com/IBM-Swift/Kitura-net.git at 1.7.16 Cloning https://github.com/IBM-Swift/Kitura-Session.git Resolving https://github.com/IBM-Swift/Kitura-Session.git at 1.7.0 Cloning https://github.com/PerfectlySoft/Perfect-Crypto.git Resolving https://github.com/PerfectlySoft/Perfect-Crypto.git at 1.1.1 Cloning https://github.com/IBM-Swift/HeliumLogger.git Resolving https://github.com/IBM-Swift/HeliumLogger.git at 1.7.1 Cloning https://github.com/IBM-Swift/BlueCryptor.git Resolving https://github.com/IBM-Swift/BlueCryptor.git at 0.8.18 Cloning https://github.com/IBM-Swift/CCurl.git Resolving https://github.com/IBM-Swift/CCurl.git at 0.4.1 Cloning https://github.com/IBM-Swift/OpenSSL.git Resolving https://github.com/IBM-Swift/OpenSSL.git at 0.3.7 Cloning https://github.com/IBM-Swift/SwiftyJSON.git Resolving https://github.com/IBM-Swift/SwiftyJSON.git at 17.0.0 Cloning https://github.com/IBM-Swift/CEpoll.git Resolving https://github.com/IBM-Swift/CEpoll.git at 0.1.1 Cloning https://github.com/IBM-Swift/Kitura-TemplateEngine.git Resolving https://github.com/IBM-Swift/Kitura-TemplateEngine.git at 1.7.2 Cloning https://github.com/PerfectlySoft/PerfectLib.git Resolving https://github.com/PerfectlySoft/PerfectLib.git at 2.0.11 Cloning https://github.com/IBM-Swift/Kitura.git Resolving https://github.com/IBM-Swift/Kitura.git at 1.7.9 Cloning https://github.com/PerfectlySoft/Perfect-COpenSSL-Linux.git Resolving https://github.com/PerfectlySoft/Perfect-COpenSSL-Linux.git at 2.0.4 Cloning https://github.com/IBM-Swift/BlueSocket.git Resolving https://github.com/IBM-Swift/BlueSocket.git at 0.12.71 Cloning https://github.com/IBM-Swift/Kitura-Credentials.git Resolving https://github.com/IBM-Swift/Kitura-Credentials.git at 1.7.2 Cloning https://github.com/IBM-Swift/Kitura-CredentialsHTTP.git Resolving https://github.com/IBM-Swift/Kitura-CredentialsHTTP.git at 1.8.0 Cloning https://github.com/IBM-Swift/LoggerAPI.git Resolving https://github.com/IBM-Swift/LoggerAPI.git at 1.7.1 Cloning https://github.com/IBM-Swift/BlueSSLService.git Resolving https://github.com/IBM-Swift/BlueSSLService.git at 0.12.58 Cloning https://github.com/PerfectlySoft/Perfect-LinuxBridge.git Resolving https://github.com/PerfectlySoft/Perfect-LinuxBridge.git at 2.0.2 Cloning https://github.com/IBM-Swift/BlueSignals.git Resolving https://github.com/IBM-Swift/BlueSignals.git at 0.9.50 Compile COpenSSL openssl.c Compile LinuxBridge LinuxBridge.c Compile CHTTPParser http_parser.c Compile CHTTPParser utils.c Compile Swift Module 'SwiftyJSON' (2 sources) Compile Swift Module 'Socket' (3 sources) Compile Swift Module 'Signals' (1 sources) Compile Swift Module 'LoggerAPI' (1 sources) Compile Swift Module 'KituraTemplateEngine' (1 sources) Compile Swift Module 'Cryptor' (10 sources) Compile Swift Module 'PerfectThread' (3 sources) Compile Swift Module 'PerfectLib' (10 sources) Compile Swift Module 'HeliumLogger' (2 sources) Compile Swift Module 'SSLService' (1 sources) Compile Swift Module 'PerfectCrypto' (7 sources) Compile Swift Module 'KituraNet' (36 sources) Compile Swift Module 'Kitura' (44 sources) Compile Swift Module 'KituraSession' (8 sources) Compile Swift Module 'Credentials' (6 sources) Compile Swift Module 'CredentialsHTTP' (4 sources) Compile Swift Module 'auth' (2 sources) Linking ./.build/x86_64-unknown-linux/debug/auth /usr/bin/ld.gold: error: cannot find -lCOpenSSL /usr/bin/ld.gold: error: cannot find -lCOpenSSL /usr/bin/ld.gold: error: cannot find -lCOpenSSL /usr/bin/ld.gold: error: cannot find -lCOpenSSL /usr/bin/ld.gold: error: cannot find -lCOpenSSL /usr/bin/ld.gold: error: cannot find -lCOpenSSL /usr/bin/ld.gold: error: cannot find -lCOpenSSL /usr/bin/ld.gold: error: cannot find -lCOpenSSL clang: error: linker command failed with exit code 1 (use -v to see invocation)

:0: error: link command failed with exit code 1 (use -v to see invocation) error: terminated(1): /usr/bin/swift-build-tool -f /app/.build/debug.yaml main`
jarrodparkes commented 6 years ago

are you sure the docker container you are running have openssl installed?

make sure you have done a fresh clone/pull of the repo, and then try the following:

# build the image (includes openssl)
$ docker build -t s3-auth:1.0.0 .

# run container (using the image you just built)
$ docker run --rm -it -v $(pwd):/app -p 8082:8082 s3-auth:1.0.0 /bin/bash

# from container, see if openssl is installed
/app $ openssl
OpenSSL >

# exit openssl
OpenSSL > exit

# remove the existing build directory (if exists), and rebuild the project
/app $ rm -rf .build/
/app $ swift build
illabo commented 6 years ago

Having the very same problem. Openssl is definitely installed in container but still getting this output:

Compile Swift Module 'auth' (2 sources)
Linking ./.build/x86_64-unknown-linux/debug/auth
/usr/bin/ld.gold: error: cannot find -lCOpenSSL
/usr/bin/ld.gold: error: cannot find -lCOpenSSL
/usr/bin/ld.gold: error: cannot find -lCOpenSSL
/usr/bin/ld.gold: error: cannot find -lCOpenSSL
/usr/bin/ld.gold: error: cannot find -lCOpenSSL
/usr/bin/ld.gold: error: cannot find -lCOpenSSL
/usr/bin/ld.gold: error: cannot find -lCOpenSSL
/usr/bin/ld.gold: error: cannot find -lCOpenSSL
clang: error: linker command failed with exit code 1 (use -v to see invocation)
<unknown>:0: error: link command failed with exit code 1 (use -v to see invocation)
error: terminated(1): /usr/bin/swift-build-tool -f /app/.build/debug.yaml main

Tried rming .build dir and rebuilding image like you suggested but still no luck. Could you hint please what I'm doing wrong?

dvor commented 6 years ago

For some reason auth and hello use different ubuntu image compared to monolith.

@illabo simply edit Dockerfile, replace FROM ibmcom/kitura-ubuntu:latest with FROM ibmcom/swift-ubuntu:3.1 and repeat whole process from the very beginning. See my PR https://github.com/udacity/ios-short-s3-auth/pull/2.

illabo commented 6 years ago

@dvor That's a cure! Saw that difference too, but assumed different base image selected intentionally.

rchatham commented 6 years ago

@dvor thank you! Had the same problem.