gkdr / lurch

XEP-0384: OMEMO Encryption for libpurple.
GNU General Public License v3.0
289 stars 32 forks source link

Compiling on macOS #8

Open Mattel88 opened 7 years ago

Mattel88 commented 7 years ago

Seems like I can't get it to work. Here is my Terminal code:

Last login: Sat Feb  4 12:31:01 on ttys000
Chibi:~ Chibi$ git clone https://github.com/gkdr/lurch/
Cloning into 'lurch'...
remote: Counting objects: 109, done.
remote: Compressing objects: 100% (58/58), done.
remote: Total 109 (delta 48), reused 101 (delta 40), pack-reused 0
Receiving objects: 100% (109/109), 56.07 KiB | 0 bytes/s, done.
Resolving deltas: 100% (48/48), done.
Chibi:~ Chibi$ cd lurch
Chibi:lurch Chibi$ clear

Chibi:lurch Chibi$ git submodule update --init
Submodule 'lib/axc' (https://github.com/gkdr/axc) registered for path 'lib/axc'
Submodule 'lib/libomemo' (https://github.com/gkdr/libomemo) registered for path 'lib/libomemo'
Cloning into '/Users/Chibi/lurch/lib/axc'...
Cloning into '/Users/Chibi/lurch/lib/libomemo'...
Submodule path 'lib/axc': checked out '29d6fc2a21bd2716c9e718d0c631f3a51244544c'
Submodule path 'lib/libomemo': checked out '226517319fae4daa82102a84ba75713e6b2045c7'
Chibi:lurch Chibi$ clear

Chibi:lurch Chibi$ make
cd ./lib/axc/lib/libaxolotl-c/ && mkdir -p build && cd build && cmake -DCMAKE_BUILD_TYPE=Debug .. && make
-- The C compiler identification is AppleClang 8.0.0.8000042
-- The CXX compiler identification is AppleClang 8.0.0.8000042
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for memset_s
-- Looking for memset_s - found
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/Chibi/lurch/lib/axc/lib/libaxolotl-c/build
Scanning dependencies of target protobuf-c
[  1%] Building C object src/protobuf-c/CMakeFiles/protobuf-c.dir/protobuf-c.c.o
[  1%] Built target protobuf-c
Scanning dependencies of target curve25519
[  2%] Building C object src/curve25519/CMakeFiles/curve25519.dir/curve25519-donna.c.o
[  4%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_0.c.o
[  5%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_1.c.o
[  7%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_add.c.o
[  8%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_cmov.c.o
[ 10%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_copy.c.o
[ 11%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_frombytes.c.o
[ 13%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_invert.c.o
[ 14%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_isnegative.c.o
[ 16%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_isnonzero.c.o
[ 17%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_mul.c.o
[ 19%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_neg.c.o
[ 20%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_pow22523.c.o
[ 22%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_sq.c.o
[ 23%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_sq2.c.o
[ 25%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_sub.c.o
[ 26%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_tobytes.c.o
[ 27%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_add.c.o
[ 29%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_double_scalarmult.c.o
[ 30%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_frombytes.c.o
[ 32%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_madd.c.o
[ 33%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_msub.c.o
[ 35%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_p1p1_to_p2.c.o
[ 36%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_p1p1_to_p3.c.o
[ 38%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_p2_0.c.o
[ 39%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_p2_dbl.c.o
[ 41%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_p3_0.c.o
[ 42%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_p3_dbl.c.o
[ 44%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_p3_to_cached.c.o
[ 45%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_p3_to_p2.c.o
[ 47%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_p3_tobytes.c.o
[ 48%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_precomp_0.c.o
[ 50%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_scalarmult_base.c.o
[ 51%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_sub.c.o
[ 52%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_tobytes.c.o
[ 54%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/open.c.o
[ 55%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/sc_muladd.c.o
[ 57%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/sc_reduce.c.o
[ 58%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/sign.c.o
[ 60%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/additions/compare.c.o
[ 61%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/additions/curve_sigs.c.o
[ 63%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/additions/sign_modified.c.o
[ 64%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/additions/zeroize.c.o
[ 66%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/nacl_sha512/blocks.c.o
[ 67%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/nacl_sha512/hash.c.o
[ 67%] Built target curve25519
Scanning dependencies of target axolotl-c
[ 69%] Building C object src/CMakeFiles/axolotl-c.dir/LocalStorageProtocol.pb-c.c.o
[ 70%] Building C object src/CMakeFiles/axolotl-c.dir/WhisperTextProtocol.pb-c.c.o
[ 72%] Building C object src/CMakeFiles/axolotl-c.dir/FingerprintProtocol.pb-c.c.o
[ 73%] Building C object src/CMakeFiles/axolotl-c.dir/vpool.c.o
[ 75%] Building C object src/CMakeFiles/axolotl-c.dir/axolotl.c.o
[ 76%] Building C object src/CMakeFiles/axolotl-c.dir/curve.c.o
[ 77%] Building C object src/CMakeFiles/axolotl-c.dir/hkdf.c.o
[ 79%] Building C object src/CMakeFiles/axolotl-c.dir/ratchet.c.o
[ 80%] Building C object src/CMakeFiles/axolotl-c.dir/protocol.c.o
[ 82%] Building C object src/CMakeFiles/axolotl-c.dir/session_state.c.o
/Users/Chibi/lurch/lib/axc/lib/libaxolotl-c/src/session_state.c:296:18: warning: comparison of constant 2305843009213693951 with expression of type 'unsigned int' is always false [-Wtautological-constant-out-of-range-compare]
        if(count > SIZE_MAX / sizeof(Textsecure__SessionStructure__Chain *)) {
           ~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/Chibi/lurch/lib/axc/lib/libaxolotl-c/src/session_state.c:493:14: warning: comparison of constant 2305843009213693951 with expression of type 'unsigned int' is always false [-Wtautological-constant-out-of-range-compare]
    if(count > SIZE_MAX / sizeof(Textsecure__SessionStructure__Chain__MessageKey *)) {
       ~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
[ 83%] Building C object src/CMakeFiles/axolotl-c.dir/session_record.c.o
/Users/Chibi/lurch/lib/axc/lib/libaxolotl-c/src/session_record.c:87:18: warning: comparison of constant 2305843009213693951 with expression of type 'unsigned int' is always false [-Wtautological-constant-out-of-range-compare]
        if(count > SIZE_MAX / sizeof(Textsecure__SessionStructure *)) {
           ~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
[ 85%] Building C object src/CMakeFiles/axolotl-c.dir/session_pre_key.c.o
[ 86%] Building C object src/CMakeFiles/axolotl-c.dir/session_builder.c.o
[ 88%] Building C object src/CMakeFiles/axolotl-c.dir/session_cipher.c.o
[ 89%] Building C object src/CMakeFiles/axolotl-c.dir/key_helper.c.o
[ 91%] Building C object src/CMakeFiles/axolotl-c.dir/sender_key.c.o
[ 92%] Building C object src/CMakeFiles/axolotl-c.dir/sender_key_state.c.o
/Users/Chibi/lurch/lib/axc/lib/libaxolotl-c/src/sender_key_state.c:213:18: warning: comparison of constant 2305843009213693951 with expression of type 'unsigned int' is always false [-Wtautological-constant-out-of-range-compare]
        if(count > SIZE_MAX / sizeof(Textsecure__SenderKeyStateStructure__SenderMessageKey *)) {
           ~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
[ 94%] Building C object src/CMakeFiles/axolotl-c.dir/sender_key_record.c.o
/Users/Chibi/lurch/lib/axc/lib/libaxolotl-c/src/sender_key_record.c:56:18: warning: comparison of constant 2305843009213693951 with expression of type 'unsigned int' is always false [-Wtautological-constant-out-of-range-compare]
        if(count > SIZE_MAX / sizeof(Textsecure__SenderKeyStateStructure *)) {
           ~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
[ 95%] Building C object src/CMakeFiles/axolotl-c.dir/group_session_builder.c.o
[ 97%] Building C object src/CMakeFiles/axolotl-c.dir/group_cipher.c.o
[ 98%] Building C object src/CMakeFiles/axolotl-c.dir/fingerprint.c.o
[100%] Linking C static library libaxolotl-c.a
[100%] Built target axolotl-c
cd ./lib/axc && make axc-pic
mkdir -p build
gcc -fPIC -I./lib/libaxolotl-c/src -std=c11 -Wall -Wextra -Wpedantic -Wstrict-overflow -fno-strict-aliasing -funsigned-char -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -D_POSIX_SOURCE -D_GNU_SOURCE -fno-builtin-memset -c src/axc.c -o build/axc.o
src/axc.c:610:28: warning: missing field 'tv_nsec' initializer
      [-Wmissing-field-initializers]
  struct timespec time = {0};
                           ^
src/axc.c:616:7: warning: variable 'db_needs_init' is used uninitialized
      whenever 'if' condition is true [-Wsometimes-uninitialized]
  if (ret_val){
      ^~~~~~~
src/axc.c:790:7: note: uninitialized use occurs here
  if (db_needs_init) {
      ^~~~~~~~~~~~~
src/axc.c:616:3: note: remove the 'if' if its condition is always false
  if (ret_val){
  ^~~~~~~~~~~~~
src/axc.c:624:3: note: variable 'db_needs_init' is declared here
  int db_needs_init = 0;
  ^
2 warnings generated.
gcc -fPIC -I./lib/libaxolotl-c/src -std=c11 -Wall -Wextra -Wpedantic -Wstrict-overflow -fno-strict-aliasing -funsigned-char -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -D_POSIX_SOURCE -D_GNU_SOURCE -fno-builtin-memset -c src/axc_crypto.c -o build/axc_crypto.o
src/axc_crypto.c:5:10: fatal error: 'openssl/err.h' file not found
#include <openssl/err.h> // err_*
         ^
1 error generated.
make[1]: *** [axc_crypto.o] Error 1
make: *** [axc] Error 2
Chibi:lurch Chibi$ 

Any help to get it working would be much appreciated.

gkdr commented 7 years ago

Since it cannot find the OpenSSL header(s), I would assume that you do not have them installed. I am currently working on replacing OpenSSL with gcrypt (see #2), so you might just want to wait a bit as it could resolve by itself (I expect to be done today).

Mattel88 commented 7 years ago

Nice! Looking forward to it! :)

Mattel88 commented 7 years ago

Still an issue:

Chibi:lurch Chibi$ make
cd ./lib/axc/lib/libaxolotl-c/ && mkdir -p build && cd build && cmake -DCMAKE_BUILD_TYPE=Debug .. && make
-- The C compiler identification is AppleClang 8.0.0.8000042
-- The CXX compiler identification is AppleClang 8.0.0.8000042
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for memset_s
-- Looking for memset_s - found
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/Chibi/lurch/lib/axc/lib/libaxolotl-c/build
Scanning dependencies of target protobuf-c
[  1%] Building C object src/protobuf-c/CMakeFiles/protobuf-c.dir/protobuf-c.c.o
[  1%] Built target protobuf-c
Scanning dependencies of target curve25519
[  2%] Building C object src/curve25519/CMakeFiles/curve25519.dir/curve25519-donna.c.o
[  4%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_0.c.o
[  5%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_1.c.o
[  7%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_add.c.o
[  8%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_cmov.c.o
[ 10%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_copy.c.o
[ 11%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_frombytes.c.o
[ 13%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_invert.c.o
[ 14%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_isnegative.c.o
[ 16%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_isnonzero.c.o
[ 17%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_mul.c.o
[ 19%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_neg.c.o
[ 20%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_pow22523.c.o
[ 22%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_sq.c.o
[ 23%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_sq2.c.o
[ 25%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_sub.c.o
[ 26%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/fe_tobytes.c.o
[ 27%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_add.c.o
[ 29%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_double_scalarmult.c.o
[ 30%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_frombytes.c.o
[ 32%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_madd.c.o
[ 33%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_msub.c.o
[ 35%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_p1p1_to_p2.c.o
[ 36%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_p1p1_to_p3.c.o
[ 38%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_p2_0.c.o
[ 39%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_p2_dbl.c.o
[ 41%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_p3_0.c.o
[ 42%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_p3_dbl.c.o
[ 44%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_p3_to_cached.c.o
[ 45%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_p3_to_p2.c.o
[ 47%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_p3_tobytes.c.o
[ 48%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_precomp_0.c.o
[ 50%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_scalarmult_base.c.o
[ 51%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_sub.c.o
[ 52%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/ge_tobytes.c.o
[ 54%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/open.c.o
[ 55%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/sc_muladd.c.o
[ 57%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/sc_reduce.c.o
[ 58%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/sign.c.o
[ 60%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/additions/compare.c.o
[ 61%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/additions/curve_sigs.c.o
[ 63%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/additions/sign_modified.c.o
[ 64%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/additions/zeroize.c.o
[ 66%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/nacl_sha512/blocks.c.o
[ 67%] Building C object src/curve25519/CMakeFiles/curve25519.dir/ed25519/nacl_sha512/hash.c.o
[ 67%] Built target curve25519
Scanning dependencies of target axolotl-c
[ 69%] Building C object src/CMakeFiles/axolotl-c.dir/LocalStorageProtocol.pb-c.c.o
[ 70%] Building C object src/CMakeFiles/axolotl-c.dir/WhisperTextProtocol.pb-c.c.o
[ 72%] Building C object src/CMakeFiles/axolotl-c.dir/FingerprintProtocol.pb-c.c.o
[ 73%] Building C object src/CMakeFiles/axolotl-c.dir/vpool.c.o
[ 75%] Building C object src/CMakeFiles/axolotl-c.dir/axolotl.c.o
[ 76%] Building C object src/CMakeFiles/axolotl-c.dir/curve.c.o
[ 77%] Building C object src/CMakeFiles/axolotl-c.dir/hkdf.c.o
[ 79%] Building C object src/CMakeFiles/axolotl-c.dir/ratchet.c.o
[ 80%] Building C object src/CMakeFiles/axolotl-c.dir/protocol.c.o
[ 82%] Building C object src/CMakeFiles/axolotl-c.dir/session_state.c.o
/Users/Chibi/lurch/lib/axc/lib/libaxolotl-c/src/session_state.c:296:18: warning: comparison of constant 2305843009213693951 with expression of type 'unsigned int' is always false [-Wtautological-constant-out-of-range-compare]
        if(count > SIZE_MAX / sizeof(Textsecure__SessionStructure__Chain *)) {
           ~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/Chibi/lurch/lib/axc/lib/libaxolotl-c/src/session_state.c:493:14: warning: comparison of constant 2305843009213693951 with expression of type 'unsigned int' is always false [-Wtautological-constant-out-of-range-compare]
    if(count > SIZE_MAX / sizeof(Textsecure__SessionStructure__Chain__MessageKey *)) {
       ~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
[ 83%] Building C object src/CMakeFiles/axolotl-c.dir/session_record.c.o
/Users/Chibi/lurch/lib/axc/lib/libaxolotl-c/src/session_record.c:87:18: warning: comparison of constant 2305843009213693951 with expression of type 'unsigned int' is always false [-Wtautological-constant-out-of-range-compare]
        if(count > SIZE_MAX / sizeof(Textsecure__SessionStructure *)) {
           ~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
[ 85%] Building C object src/CMakeFiles/axolotl-c.dir/session_pre_key.c.o
[ 86%] Building C object src/CMakeFiles/axolotl-c.dir/session_builder.c.o
[ 88%] Building C object src/CMakeFiles/axolotl-c.dir/session_cipher.c.o
[ 89%] Building C object src/CMakeFiles/axolotl-c.dir/key_helper.c.o
[ 91%] Building C object src/CMakeFiles/axolotl-c.dir/sender_key.c.o
[ 92%] Building C object src/CMakeFiles/axolotl-c.dir/sender_key_state.c.o
/Users/Chibi/lurch/lib/axc/lib/libaxolotl-c/src/sender_key_state.c:213:18: warning: comparison of constant 2305843009213693951 with expression of type 'unsigned int' is always false [-Wtautological-constant-out-of-range-compare]
        if(count > SIZE_MAX / sizeof(Textsecure__SenderKeyStateStructure__SenderMessageKey *)) {
           ~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
[ 94%] Building C object src/CMakeFiles/axolotl-c.dir/sender_key_record.c.o
/Users/Chibi/lurch/lib/axc/lib/libaxolotl-c/src/sender_key_record.c:56:18: warning: comparison of constant 2305843009213693951 with expression of type 'unsigned int' is always false [-Wtautological-constant-out-of-range-compare]
        if(count > SIZE_MAX / sizeof(Textsecure__SenderKeyStateStructure *)) {
           ~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
[ 95%] Building C object src/CMakeFiles/axolotl-c.dir/group_session_builder.c.o
[ 97%] Building C object src/CMakeFiles/axolotl-c.dir/group_cipher.c.o
[ 98%] Building C object src/CMakeFiles/axolotl-c.dir/fingerprint.c.o
[100%] Linking C static library libaxolotl-c.a
[100%] Built target axolotl-c
cd ./lib/axc && make axc-pic
mkdir -p build
gcc -fPIC -I./lib/libaxolotl-c/src  -I/usr/local/opt/libgcrypt/include -I/usr/local/opt/libgpg-error/include -std=c11 -Wall -Wextra -Wpedantic -Wstrict-overflow -fno-strict-aliasing -funsigned-char -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -D_POSIX_SOURCE -D_GNU_SOURCE -fno-builtin-memset -c src/axc.c -o build/axc.o
src/axc.c:610:28: warning: missing field 'tv_nsec' initializer
      [-Wmissing-field-initializers]
  struct timespec time = {0};
                           ^
src/axc.c:616:7: warning: variable 'db_needs_init' is used uninitialized
      whenever 'if' condition is true [-Wsometimes-uninitialized]
  if (ret_val){
      ^~~~~~~
src/axc.c:790:7: note: uninitialized use occurs here
  if (db_needs_init) {
      ^~~~~~~~~~~~~
src/axc.c:616:3: note: remove the 'if' if its condition is always false
  if (ret_val){
  ^~~~~~~~~~~~~
src/axc.c:624:3: note: variable 'db_needs_init' is declared here
  int db_needs_init = 0;
  ^
2 warnings generated.
gcc -fPIC -I./lib/libaxolotl-c/src  -I/usr/local/opt/libgcrypt/include -I/usr/local/opt/libgpg-error/include -std=c11 -Wall -Wextra -Wpedantic -Wstrict-overflow -fno-strict-aliasing -funsigned-char -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -D_POSIX_SOURCE -D_GNU_SOURCE -fno-builtin-memset -c src/axc_crypto.c -o build/axc_crypto.o
src/axc_crypto.c:24:17: warning: unused variable 'ctx_p' [-Wunused-variable]
  axc_context * ctx_p = (axc_context *) user_data_p;
                ^
src/axc_crypto.c:76:17: warning: unused variable 'axc_ctx_p' [-Wunused-variable]
  axc_context * axc_ctx_p = (axc_context *) user_data_p;
                ^
2 warnings generated.
gcc -fPIC -I./lib/libaxolotl-c/src  -I/usr/local/opt/libgcrypt/include -I/usr/local/opt/libgpg-error/include -std=c11 -Wall -Wextra -Wpedantic -Wstrict-overflow -fno-strict-aliasing -funsigned-char -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -D_POSIX_SOURCE -D_GNU_SOURCE -fno-builtin-memset -c src/axc_store.c -o build/axc_store.o
src/axc_store.c:159:9: warning: duplicate 'const' declaration specifier
      [-Wduplicate-decl-specifier]
  const const char stmt[] =  "BEGIN TRANSACTION;"
        ^
1 warning generated.
cd ./lib/libomemo && make libomemo-conversations-pic
mkdir -p build
gcc -c src/libomemo.c -std=c11 -Wall -Wextra -Wpedantic -Wstrict-overflow -fno-strict-aliasing -funsigned-char -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -fno-builtin-memset -D_THREAD_SAFE -D_REENTRANT -I/usr/local/Cellar/glib/2.50.2/include/glib-2.0 -I/usr/local/Cellar/glib/2.50.2/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre/8.39/include -I/usr/local/Cellar/libmxml/2.9/include -I/usr/local/opt/libgcrypt/include -I/usr/local/opt/libgpg-error/include -DOMEMO_XMLNS='"eu.siacs.conversations.axolotl"' -DOMEMO_NS_SEPARATOR='"."' -DOMEMO_NS_NOVERSION -fPIC -o build/libomemo.o
src/libomemo.c:528:17: warning: implicit declaration of function 'strsep' is
      invalid in C99 [-Wimplicit-function-declaration]
    device_id = strsep(&bundle_node_name_cpy, ":");
                ^
src/libomemo.c:528:15: warning: incompatible integer to pointer conversion
      assigning to 'char *' from 'int' [-Wint-conversion]
    device_id = strsep(&bundle_node_name_cpy, ":");
              ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
gcc -c src/libomemo_crypto.c -std=c11 -Wall -Wextra -Wpedantic -Wstrict-overflow -fno-strict-aliasing -funsigned-char -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -fno-builtin-memset -D_THREAD_SAFE -D_REENTRANT -I/usr/local/Cellar/glib/2.50.2/include/glib-2.0 -I/usr/local/Cellar/glib/2.50.2/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre/8.39/include -I/usr/local/Cellar/libmxml/2.9/include -I/usr/local/opt/libgcrypt/include -I/usr/local/opt/libgpg-error/include -fPIC -o build/libomemo_crypto.o
src/libomemo_crypto.c:68:5: warning: variable 'cipher_hd' is used uninitialized
      whenever switch default is taken [-Wsometimes-uninitialized]
    default:
    ^~~~~~~
src/libomemo_crypto.c:124:21: note: uninitialized use occurs here
  gcry_cipher_close(cipher_hd);
                    ^~~~~~~~~
src/libomemo_crypto.c:54:29: note: initialize the variable 'cipher_hd' to
      silence this warning
  gcry_cipher_hd_t cipher_hd;
                            ^
                             = NULL
src/libomemo_crypto.c:157:5: warning: variable 'cipher_hd' is used uninitialized
      whenever switch default is taken [-Wsometimes-uninitialized]
    default:
    ^~~~~~~
src/libomemo_crypto.c:206:21: note: uninitialized use occurs here
  gcry_cipher_close(cipher_hd);
                    ^~~~~~~~~
src/libomemo_crypto.c:144:29: note: initialize the variable 'cipher_hd' to
      silence this warning
  gcry_cipher_hd_t cipher_hd;
                            ^
                             = NULL
2 warnings generated.
gcc -c src/libomemo_storage.c -std=c11 -Wall -Wextra -Wpedantic -Wstrict-overflow -fno-strict-aliasing -funsigned-char -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -fno-builtin-memset -D_THREAD_SAFE -D_REENTRANT -I/usr/local/Cellar/glib/2.50.2/include/glib-2.0 -I/usr/local/Cellar/glib/2.50.2/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre/8.39/include -I/usr/local/Cellar/libmxml/2.9/include -I/usr/local/opt/libgcrypt/include -I/usr/local/opt/libgpg-error/include -fPIC -o build/libomemo_storage.o
mkdir -p build
gcc -std=c11 -Wall -Wstrict-overflow -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -I/usr/local/Cellar/pidgin/2.11.0/include/libpurple -I/usr/local/Cellar/glib/2.50.2/include/glib-2.0 -I/usr/local/Cellar/glib/2.50.2/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre/8.39/include  -I/usr/include/libxml2 -I./headers/jabber -I./lib/libomemo/src -I./lib/axc/src -I./lib/axc/lib/libaxolotl-c/src -fPIC -c ./src/lurch.c -o ./build/lurch.o
In file included from ./src/lurch.c:22:
In file included from ./headers/jabber/pep.h:28:
./headers/jabber/message.h:80:66: warning: duplicate 'const' declaration
      specifier [-Wduplicate-decl-specifier]
gboolean jabber_custom_smileys_isenabled(JabberStream *js, const const g...
                                                                 ^
./src/lurch.c:129:13: warning: 'sem_init' is deprecated
      [-Wdeprecated-declarations]
  ret_val = sem_init(mutex_p, 0, 1);
            ^
/usr/include/sys/semaphore.h:55:5: note: 'sem_init' has been explicitly marked
      deprecated here
int sem_init(sem_t *, int, unsigned int) __deprecated;
    ^
./src/lurch.c:148:12: warning: 'sem_destroy' is deprecated
      [-Wdeprecated-declarations]
    (void) sem_destroy(mutex_p);
           ^
/usr/include/sys/semaphore.h:53:5: note: 'sem_destroy' has been explicitly
      marked deprecated here
int sem_destroy(sem_t *) __deprecated;
    ^
./src/lurch.c:170:12: warning: 'sem_destroy' is deprecated
      [-Wdeprecated-declarations]
    (void) sem_destroy(qmsg_p->mutex_p);
           ^
/usr/include/sys/semaphore.h:53:5: note: 'sem_destroy' has been explicitly
      marked deprecated here
int sem_destroy(sem_t *) __deprecated;
    ^
./src/lurch.c:1067:7: warning: variable 'temp' is used uninitialized whenever
      'if' condition is true [-Wsometimes-uninitialized]
  if (ret_val) {
      ^~~~~~~
./src/lurch.c:1119:8: note: uninitialized use occurs here
  free(temp);
       ^~~~
./src/lurch.c:1067:3: note: remove the 'if' if its condition is always false
  if (ret_val) {
  ^~~~~~~~~~~~~~
./src/lurch.c:1059:14: note: initialize the variable 'temp' to silence this
      warning
  char * temp;
             ^
              = NULL
./src/lurch.c:2662:13: warning: 'sem_init' is deprecated
      [-Wdeprecated-declarations]
  ret_val = sem_init(&db_mutex, 0, 1);
            ^
/usr/include/sys/semaphore.h:55:5: note: 'sem_init' has been explicitly marked
      deprecated here
int sem_init(sem_t *, int, unsigned int) __deprecated;
    ^
./src/lurch.c:2668:13: warning: 'sem_init' is deprecated
      [-Wdeprecated-declarations]
  ret_val = sem_init(&chat_users_ht_mutex, 0, 1);
            ^
/usr/include/sys/semaphore.h:55:5: note: 'sem_init' has been explicitly marked
      deprecated here
int sem_init(sem_t *, int, unsigned int) __deprecated;
    ^
./src/lurch.c:2714:5: warning: 'sem_destroy' is deprecated
      [-Wdeprecated-declarations]
    sem_destroy(&db_mutex);
    ^
/usr/include/sys/semaphore.h:53:5: note: 'sem_destroy' has been explicitly
      marked deprecated here
int sem_destroy(sem_t *) __deprecated;
    ^
./src/lurch.c:2715:5: warning: 'sem_destroy' is deprecated
      [-Wdeprecated-declarations]
    sem_destroy(&chat_users_ht_mutex);
    ^
/usr/include/sys/semaphore.h:53:5: note: 'sem_destroy' has been explicitly
      marked deprecated here
int sem_destroy(sem_t *) __deprecated;
    ^
./src/lurch.c:2724:3: warning: 'sem_destroy' is deprecated
      [-Wdeprecated-declarations]
  sem_destroy(&db_mutex);
  ^
/usr/include/sys/semaphore.h:53:5: note: 'sem_destroy' has been explicitly
      marked deprecated here
int sem_destroy(sem_t *) __deprecated;
    ^
./src/lurch.c:2725:3: warning: 'sem_destroy' is deprecated
      [-Wdeprecated-declarations]
  sem_destroy(&chat_users_ht_mutex);
  ^
/usr/include/sys/semaphore.h:53:5: note: 'sem_destroy' has been explicitly
      marked deprecated here
int sem_destroy(sem_t *) __deprecated;
    ^
11 warnings generated.
gcc -fPIC -shared -std=c11 -Wall -Wstrict-overflow -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -I/usr/local/Cellar/pidgin/2.11.0/include/libpurple -I/usr/local/Cellar/glib/2.50.2/include/glib-2.0 -I/usr/local/Cellar/glib/2.50.2/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre/8.39/include  -I/usr/include/libxml2 -I./headers/jabber -I./lib/libomemo/src -I./lib/axc/src -I./lib/axc/lib/libaxolotl-c/src ./build/lurch.o ./lib/libomemo/build/libomemo.o ./lib/libomemo/build/libomemo_storage.o ./lib/libomemo/build/libomemo_crypto.o ./lib/axc/build/axc.o ./lib/axc/build/axc_store.o ./lib/axc/build/axc_crypto.o -o ./build/lurch.so -pthread -ldl -lm -L/usr/local/Cellar/pidgin/2.11.0/lib -L/usr/local/Cellar/glib/2.50.2/lib -L/usr/local/opt/gettext/lib -L/usr/local/Cellar/libmxml/2.9/lib -lpurple -lglib-2.0 -lintl -lsqlite3 -lmxml -lpthread -lxml2 -lz -lpthread -licucore -lm -L/usr/local/Cellar/pidgin/2.11.0/lib/purple-2 -L/usr/local/opt/libgcrypt/lib -lgcrypt -L/usr/local/opt/libgpg-error/lib -lgpg-error -ljabber -Wl,--whole-archive ./lib/axc/lib/libaxolotl-c/build/src/libaxolotl-c.a -Wl,--no-whole-archive
clang: warning: argument unused during compilation: '-pthread'
ld: unknown option: --whole-archive
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [lurch] Error 1
Chibi:lurch Chibi$ make install
make: *** No rule to make target `build/lurch.so', needed by `install'.  Stop.
Chibi:lurch Chibi$ 
gkdr commented 7 years ago

The linker used on macos does not seem to know the option I used to link libaxolotl into it. There is at least one other compatibility issues (see #9) - I'll reply to this thread again when I think everything has been resolved.

Mattel88 commented 7 years ago

Looking forward to it! :)

gkdr commented 7 years ago

Unfortunately I don't have a mac to test this, and my friend who helped did not have time to look at it again. I resolved the issues I was talking about, so if you'd like, you can try it again, I can't guarantee it's working yet though!

simt2 commented 7 years ago

Running just make works flawlessly for me on OSX El Captitan!

Mattel88 commented 7 years ago

How to install the dependencies on macOS easily?

gkdr commented 7 years ago

I believe homebrew has them all.

gkdr commented 7 years ago

@Mattel88 Any luck?

thedhawk commented 7 years ago

I'm have no experience in compiling on OS X, but had some trouble with a missing glib.h even after I installed the dependencies.

Those steps solved my problem:

  1. I installed the missing dependencies with homebrew: brew install glib brew install libmxml

  2. Following this advice I added the path to those libraries, so pkg-config can find them: echo "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib" >> ~/.bashrc && source ~/.bashrc

  3. After that I used make and make install-home as in the original instruction.

Hope this helps someone.

splurched commented 7 years ago

How to install the dependencies on macOS easily?

https://github.com/shtrom/Lurch4Adium

😀