0

I've been trying to compile an open-source C++ project Typesense, which has this list of dependencies:

  • Snappy
  • zlib
  • OpenSSL (>=1.0.2)
  • curl
  • ICU
  • brpc
  • braft

Host and target OS is Debian Linux. Compilation is handled via cmake->make sequence of commands. I was able to install some of dependencies through a package manager (I believe they reside in /usr/lib then), the last two I had to compile on my own, I put them in /usr/local/lib.

All the dependencies were successfully compiled, and the target project compiled too.

When it comes to linking stage, I get numerous errors like

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libcurl.a(libcurl_la-easy.o): in function `global_init':
(.text+0x94): undefined reference to `libssh2_init'

...

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libcurl.a(libcurl_la-http2.o): in function `on_header':
(.text+0x6c): undefined reference to `nghttp2_session_get_stream_user_data'

...

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libcurl.a(libcurl_la-socks_gssapi.o): in function `check_gss_err.part.0':
(.text+0x57): undefined reference to `gss_release_buffer'
/usr/bin/ld: (.text+0x77): undefined reference to `gss_display_status'
/usr/bin/ld: (.text+0x9b): undefined reference to `gss_release_buffer'
/usr/bin/ld: (.text+0xcf): undefined reference to `gss_release_buffer'
/usr/bin/ld: (.text+0xef): undefined reference to `gss_display_status'
/usr/bin/ld: (.text+0x112): undefined reference to `gss_release_buffer'
/usr/bin/ld: (.text+0x17e): undefined reference to `gss_release_buffer'

...

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libcurl.a(libcurl_la-curl_rtmp.o): in function `rtmp_connect':
(.text+0xd4): undefined reference to `RTMP_Connect1'

...

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libcurl.a(libcurl_la-openldap.o): in function `ldap_connecting':
(.text+0x111): undefined reference to `ldap_result'

There is at least a hundred of such errors. I'm not at all proficient with Linux and complex building of projects. How do I possibly fix linking errors for libraries that I just downloaded through a package manager?

3
  • Did you update your LD_PATH environment variable?
    – DavidPostill
    Commented Aug 9, 2020 at 11:44
  • @DavidPostill when it's empty, it throws the same errors, when I added paths to the libraries compiled by myself, it still threw the same errors. I'm just not sure what to add in LD_LIBRARY_PATH. Isn't /usr/lib already considered by ld by default? Commented Aug 9, 2020 at 12:00
  • You need to have the appropriate path in the ld -L option at build time.
    – DavidPostill
    Commented Aug 9, 2020 at 12:04

0

You must log in to answer this question.

Browse other questions tagged .