0

I'm completely new to Haskell. I'm trying to get https://github.com/wireapp/mls-server project to build. When I run make build, I get undefined reference errors:

Linking .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/mls-server-test/mls-server-test ...
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(Internal.o)(.text+0x69d): error: undefined reference to 'EVP_CIPHER_CTX_init'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(Internal.o)(.text+0x7e5): error: undefined reference to 'EVP_CIPHER_CTX_init'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(Internal.o)(.text+0x89d): error: undefined reference to 'EVP_CIPHER_CTX_init'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(Internal.o)(.text+0x9e5): error: undefined reference to 'EVP_CIPHER_CTX_init'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(Internal.o):HsOpenSSLzm0zi11zi4zi14zm1RUGvOiXKv4J8uIsPTtnnt_OpenSSLziEVPziInternal_digestLazzily3_info: error: undefined reference to 'EVP_MD_CTX_create'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(Internal.o):HsOpenSSLzm0zi11zi4zi14zm1RUGvOiXKv4J8uIsPTtnnt_OpenSSLziEVPziInternal_digestLazzily3_info: error: undefined reference to 'EVP_MD_CTX_init'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(Internal.o):HsOpenSSLzm0zi11zi4zi14zm1RUGvOiXKv4J8uIsPTtnnt_OpenSSLziEVPziInternal_digestLazzily3_info: error: undefined reference to 'EVP_MD_CTX_destroy'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(Internal.o):HsOpenSSLzm0zi11zi4zi14zm1RUGvOiXKv4J8uIsPTtnnt_OpenSSLziEVPziInternal_digestLazzily3_info: error: undefined reference to 'EVP_MD_CTX_init'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(Internal.o):HsOpenSSLzm0zi11zi4zi14zm1RUGvOiXKv4J8uIsPTtnnt_OpenSSLziEVPziInternal_digestLazzily3_info: error: undefined reference to 'EVP_MD_CTX_destroy'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(Store.o):HsOpenSSLzm0zi11zi4zi14zm1RUGvOiXKv4J8uIsPTtnnt_OpenSSLziX509ziStore_getStoreCtxChain1_info: error: undefined reference to 'X509_STORE_CTX_get_chain'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(Stack.o)(.text+0x33): error: undefined reference to 'sk_new_null'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(Stack.o)(.text+0xcc): error: undefined reference to 'sk_push'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(Stack.o)(.text+0x1a2): error: undefined reference to 'sk_free'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(Stack.o)(.text+0x242): error: undefined reference to 'sk_free'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(Stack.o)(.text+0x3a2): error: undefined reference to 'sk_free'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(Stack.o)(.text+0x41a): error: undefined reference to 'sk_free'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(Stack.o)(.text+0xa6b): error: undefined reference to 'sk_value'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(Stack.o)(.text+0xb73): error: undefined reference to 'sk_value'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(Stack.o):HsOpenSSLzm0zi11zi4zi14zm1RUGvOiXKv4J8uIsPTtnnt_OpenSSLziStack_zdwmapStack_info: error: undefined reference to 'sk_num'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(X509.o)(.text+0x1dcf): error: undefined reference to 'X509_set_notBefore'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(X509.o)(.text+0x20cf): error: undefined reference to 'X509_set_notAfter'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(Revocation.o)(.text+0x225f): error: undefined reference to 'X509_CRL_set_lastUpdate'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(Revocation.o)(.text+0x255f): error: undefined reference to 'X509_CRL_set_nextUpdate'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(HsOpenSSL.o):function HsOpenSSL_init: error: undefined reference to 'SSL_load_error_strings'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(HsOpenSSL.o):function HsOpenSSL_init: error: undefined reference to 'OPENSSL_add_all_algorithms_noconf'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(HsOpenSSL.o):function HsOpenSSL_HMAC_CTX_new: error: undefined reference to 'HMAC_CTX_init'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(HsOpenSSL.o):function HsOpenSSL_HMAC_CTX_free: error: undefined reference to 'HMAC_CTX_cleanup'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(HsOpenSSL.o):function HsOpenSSL_setupMutex: error: undefined reference to 'CRYPTO_num_locks'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(HsOpenSSL.o):function HsOpenSSL_setupMutex: error: undefined reference to 'CRYPTO_num_locks'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(HsOpenSSL.o):function HsOpenSSL_setupMutex: error: undefined reference to 'CRYPTO_set_locking_callback'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(HsOpenSSL.o):function HsOpenSSL_setupMutex: error: undefined reference to 'CRYPTO_set_id_callback'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(HsOpenSSL.o):function HsOpenSSL_setupMutex: error: undefined reference to 'CRYPTO_set_dynlock_create_callback'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(HsOpenSSL.o):function HsOpenSSL_setupMutex: error: undefined reference to 'CRYPTO_set_dynlock_lock_callback'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(HsOpenSSL.o):function HsOpenSSL_init: error: undefined reference to 'SSL_library_init'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(HsOpenSSL.o):function HsOpenSSL_X509_ref: error: undefined reference to 'CRYPTO_add_lock'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(HsOpenSSL.o):function HsOpenSSL_X509_CRL_ref: error: undefined reference to 'CRYPTO_add_lock'
/home/euphoria/.stack/snapshots/x86_64-linux/lts-12.4/8.4.3/lib/x86_64-linux-ghc-8.4.3/HsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt/libHSHsOpenSSL-0.11.4.14-1RUGvOiXKv4J8uIsPTtnnt.a(HsOpenSSL.o):function HsOpenSSL_setupMutex: error: undefined reference to 'CRYPTO_set_dynlock_destroy_callback'
collect2: error: ld returned 1 exit status
`gcc' failed in phase `Linker'. (Exit code: 1)
Progress 1/2

--  While building package mls-server-0.1.0 using:
      /home/euphoria/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.3 --builddir=.stack-work/dist/x86_64-linux/Cabal-2.2.0.1 build lib:mls-server exe:mls-server exe:mls-server-schema test:mls-server-test --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1
Makefile:8: recipe for target 'build' failed
make: *** [build] Error 1

I have tried downgrading openssl to 1.0.1g. I've tried updating it as well. Despite everything, I keep getting these errors. Not sure what's going wrong.

fraiser
  • 929
  • 12
  • 28
  • The bindings are likely for a different version of openssl. Have you looked at the version they indicated? EDIT: Ok it says `OpenSSL version < 1.1.0`, perhaps the downgrade didn't take? Are you confident the include and linker paths were set correctly? – Thomas M. DuBuisson Dec 21 '18 at 04:26
  • 2
    How do I set the include and linker paths? I downloaded the openssl 1.0.1g package, and did the standard `./config`, `make` and `make install`. – fraiser Dec 21 '18 at 06:25
  • That will usually install libraries in `/usr/local/$LIB` and include files in `/usr/local/include`. If you still have a packaged openssl installed it will probably be under `/usr/lib` and `/usr/include`. You should remove the old version of openssl if you haven't yet. If the linker still has issues you can do the explicit thing and add `/usr/local/lib` to `/etc/ld.so.conf` and run `sudo ldconfig`. – Thomas M. DuBuisson Dec 21 '18 at 06:34

1 Answers1

0

This should help you in resolving the issue. If you would want to take your existing openssl's backup, make sure you do it before by using this command sudo mv /usr/bin/openssl /usr/bin/openssl.backup

Installing openssl-1.1.1g resolved those linker issues for me. Maybe bindings were expecting this version.

  $ sudo rm -rf /usr/bin/openssl /usr/share/man/man1/openssl.1ssl.gz
  $ wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz
  $ tar -zxf openssl-1.1.1g.tar.gz && cd openssl-1.1.1g
  $ ./config
  $ sudo apt install make gcc
  $ make
  $ make test
  $ sudo make install
  $ sudo ln -s /usr/local/bin/openssl /usr/bin/openssl
  $ sudo ldconfig
  $ cd ..
  $ rm -rf openssl-1.1.1g*

If all the above steps worked successfully for you, you should be able to check the the version details using $ openssl version -a

OpenSSL 1.1.1g 21 Apr 2020 built on: Wed Aug 5 07:16:04 2020 UTC platform: linux-x86_64 options: bn(64,64) rc4(16x,int) des(int) idea(int) blowfish(ptr) compiler: gcc -fPIC -pthread -m64 -Wa,--noexecstack -Wall -O3 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAESNI_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DNDEBUG OPENSSLDIR: "/usr/local/ssl" ENGINESDIR: "/usr/local/lib/engines-1.1" Seeding source: os-specific