Code Monkey home page Code Monkey logo

Comments (7)

jarrodldavis avatar jarrodldavis commented on June 12, 2024

Okay so I've tried on a fresh El Capitan install with Xcode 8 Beta 6 and the necessary Homebrew dependencies (libsodium and openssl) and I'm getting the same errors.

from hap.

Bouke avatar Bouke commented on June 12, 2024

Swift Package Manager probably cannot find openssl installed by brew. You probably need to force-link openssl with brew:

$ pkg-config --cflags openssl

$ brew link openssl          
Warning: openssl is keg-only and must be linked with --force
Note that doing so can interfere with building software.
$ brew link --force openssl
Linking /usr/local/Cellar/openssl/1.0.2h_1... 1601 symlinks created
$ pkg-config --cflags openssl
-I/usr/local/Cellar/openssl/1.0.2h_1/include

Also verify that libsodium is known to pkg-config:

$ brew install libsodium 
==> Downloading https://homebrew.bintray.com/bottles/libsodium-1.0.10.el_capitan
Already downloaded: /Users/bouke/Library/Caches/Homebrew/libsodium-1.0.10.el_capitan.bottle.tar.gz
==> Pouring libsodium-1.0.10.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/libsodium/1.0.10: 67 files, 1.1M
$ pkg-config --cflags libsodium 
-I/usr/local/Cellar/libsodium/1.0.10/include

I intend to include the xcodeproj as well, which comes with already defined search paths for the libraries.

Note that there's an issue with encryption (CryptoSwift) that results in pairings not being able to establish (say ~75% of the time). So if pairing does not succeeds on the first try, try a few times more.

Note 2 this project is in its infancy and is in flux. Feel free to lend a hand.

from hap.

jarrodldavis avatar jarrodldavis commented on June 12, 2024

Attempting to force link OpenSSL results in this:

Jarrods-MacBook-Pro:HAP jarrodldavis$ brew link --force openssl
Warning: Refusing to link: openssl
Linking keg-only openssl means you may end up linking against the insecure,
deprecated system OpenSSL while using the headers from Homebrew's openssl.
Instead, pass the full include/library paths to your compiler e.g.:
  -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib

And I've tried swift build -Xcc -I/usr/local/opt/openssl/include -Xcc -L/usr/local/opt/openssl/lib to no avail.

from hap.

Bouke avatar Bouke commented on June 12, 2024

As of Homebrew/brew#597 it's no longer possible to force link openssl. The compiler flags look allright, but are not picked up here as well. We should probably report this issue upstream. Apart from downgrading homebrew or symlinking openssl yourself, I don't know of any workaround for the moment.

from hap.

jarrodldavis avatar jarrodldavis commented on June 12, 2024

Well I replaced your OpenSSL package with the one provided by IBM, fixed some operator errors in Sources/CryptoSwift/Operators.swift, and used swift build -Xcc -I/usr/local/opt/openssl/include.

It gets all the way to hap-server and then this happens:

Compile Swift Module 'hap_server' (1 sources)
Linking ./.build/debug/hap-server
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): /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /Users/jarrodldavis/dev/misc/HAP/.build/debug.yaml

from hap.

Bouke avatar Bouke commented on June 12, 2024

The issue with using their module is that they don't import crypto.h, so the crypto module isn't available. What I found as a workaround is symlinking the libraries to something on pkg-config's path:

ln -s /usr/local/opt/openssl/lib/pkgconfig/*.pc /usr/local/lib/pkgconfig

from hap.

jarrodldavis avatar jarrodldavis commented on June 12, 2024

Okay, that works!

from hap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.