FDH2 / UxPlay

AirPlay Unix mirroring server
GNU General Public License v3.0
1.35k stars 72 forks source link

collect2: error: ld returned 1 exit status #72

Closed uke75 closed 2 years ago

uke75 commented 2 years ago

Hello,

I have been trying to compile UxPlay but keep getting following error:

[ 18%] Built target playfair [ 30%] Built target llhttp [ 84%] Built target airplay [ 93%] Built target renderers [ 96%] Linking CXX executable uxplay /usr/bin/ld: /usr/local/lib/libcrypto.a(c_zlib.o): in functionzlib_stateful_expand_block': c_zlib.c:(.text+0x3b): undefined reference to inflate' /usr/bin/ld: /usr/local/lib/libcrypto.a(c_zlib.o): in functionzlib_stateful_compress_block': c_zlib.c:(.text+0xa4): undefined reference to deflate' /usr/bin/ld: /usr/local/lib/libcrypto.a(c_zlib.o): in functionzlib_stateful_finish': c_zlib.c:(.text+0xd9): undefined reference to inflateEnd' /usr/bin/ld: c_zlib.c:(.text+0xe2): undefined reference todeflateEnd' /usr/bin/ld: /usr/local/lib/libcrypto.a(c_zlib.o): in function zlib_stateful_init': c_zlib.c:(.text+0x1a8): undefined reference toinflateInit_' /usr/bin/ld: czlib.c:(.text+0x21a): undefined reference to `deflateInit' /usr/bin/ld: /usr/local/lib/libcrypto.a(c_zlib.o): in function bio_zlib_ctrl': c_zlib.c:(.text+0x3dc): undefined reference todeflate' /usr/bin/ld: c_zlib.c:(.text+0x5a4): undefined reference to zError' /usr/bin/ld: /usr/local/lib/libcrypto.a(c_zlib.o): in functionbio_zlib_write': c_zlib.c:(.text+0x6b0): undefined reference to deflate' /usr/bin/ld: c_zlib.c:(.text+0x76c): undefined reference tozError' /usr/bin/ld: czlib.c:(.text+0x7df): undefined reference to `deflateInit' /usr/bin/ld: /usr/local/lib/libcrypto.a(c_zlib.o): in function bio_zlib_read': c_zlib.c:(.text+0x8c8): undefined reference toinflate' /usr/bin/ld: c_zlib.c:(.text+0x944): undefined reference to zError' /usr/bin/ld: c_zlib.c:(.text+0x9c5): undefined reference toinflateInit_' /usr/bin/ld: /usr/local/lib/libcrypto.a(c_zlib.o): in function bio_zlib_free': c_zlib.c:(.text+0xa35): undefined reference toinflateEnd' /usr/bin/ld: c_zlib.c:(.text+0xa60): undefined reference to deflateEnd' collect2: error: ld returned 1 exit status make[2]: *** [CMakeFiles/uxplay.dir/build.make:98: uxplay] Error 1 make[1]: *** [CMakeFiles/Makefile2:190: CMakeFiles/uxplay.dir/all] Error 2 make: *** [Makefile:130: all] Error 2

System is up to date:

DISTRIB_ID=Ubuntu DISTRIB_RELEASE=20.04 DISTRIB_CODENAME=focal DISTRIB_DESCRIPTION="Ubuntu 20.04.4 LTS"

What could be issue here?

Thanks

fduncanh commented 2 years ago

Compiled and works fine on Ubuntu 20.04.4 LTS on x86_64 5.13.0-27-generic #29~20.04.1-Ubuntu SMP Fri Jan 14 00:32:30 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

I dont understand why you are seeing references to libcrypto.a and zlib. (the static .a version of libcrypto is only used in macOS builds).

Something is messed up with your OpenSSL installation maybe. Is it a "standard " x86_64 system or something else like Raspberry Pi etc. Maybe your zlib is messed up ?? c_zlib.o ??

Start again from scratch, download a fresh copy of UxPlay, start with a clean build directory, go though the installation instructions and post the output you get when you run cmake (i.e. before make)

is g++ installed (sudo apt-get install g++)?

fduncanh commented 2 years ago

I see /usr/local/lib/libcrypto.a This tells me that you have a second installation of openSSL in /usr/local. Why?

it's confusing cmake. For macOS builds, openSSL gets installed there, because mac uses the libressll variant.

get rid of it and use the openssl and libssl-dev provided by Ubuntu 20.04

fduncanh commented 2 years ago

If having an "extra" OpenSSL in /usr/local is not a mistake

sudo apt-get install libssl-dev export OPENSSL_ROOT_DIR=/usr/lib/x86_64-linux-gnu/

before running cmake in the UxPlay build process. (this assumes your Ubuntu-20.04 system is an x86_64 system)

uke75 commented 2 years ago

Got it compiled now with exporting correct ssl dir /usr/lib/x86_64-linux-gnu/

Yeah, it is Ubuntu-20.04 x86-64 system. Though, can't remember which app "/usr/local/lib/libcrypto.a" was installed with. System has been running from 2018, or so, and there has been installed/uninstalled (also manually) a lot of different software.

fduncanh commented 2 years ago

@uke75 its not from ubuntu. something else you installed "by jhand" put it there in /usr/local/....