zee icon indicating copy to clipboard operation
zee copied to clipboard

`cargo install zee`: undefined reference to `SSL_CTX_ctrl`

Open rjzak opened this issue 2 years ago • 3 comments

error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-m64" "/tmp/cargo-installxiM7vN/release/deps/zee-f2e61e3fdd4991a8.zee.0628f3a9-cgu.0.rcgu.o" "-Wl,--as-needed" "-L" "/tmp/cargo-installxiM7vN/release/deps" "-L" "/tmp/cargo-installxiM7vN/release/build/libgit2-sys-3c1e7454ac05026a/out/build" "-L" "/tmp/cargo-installxiM7vN/release/build/libssh2-sys-5a563fd6ecd04cf4/out/build" "-L" "/usr/local/lib" "-L" "/tmp/cargo-installxiM7vN/release/build/tree-sitter-26aeed191a67ad45/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/tmp/cargo-installxiM7vN/release/build/zee-grammar-7ffc92868ecda7c9/out" "-L" "/home/rjzak/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/tmp/rustc5unC6b/libzee_grammar-6f2589916f0a8c03.rlib" "/tmp/rustc5unC6b/libtree_sitter-b2dcb091f8d90c9c.rlib" "/tmp/rustc5unC6b/liblibgit2_sys-79a44698b4064eb5.rlib" "/tmp/rustc5unC6b/liblibssh2_sys-fdd638e92b8b694e.rlib" "-Wl,--start-group" "-Wl,--end-group" "/home/rjzak/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-1f103368fa522bc0.rlib" "-Wl,-Bdynamic" "-lstdc++" "-lssl" "-lcrypto" "-lz" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/home/rjzak/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/tmp/cargo-installxiM7vN/release/deps/zee-f2e61e3fdd4991a8" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro,-znow" "-Wl,-O1" "-nodefaultlibs"
  = note: /usr/bin/ld: /tmp/rustc5unC6b/liblibgit2_sys-79a44698b4064eb5.rlib(openssl.o): in function `git_openssl_stream_global_init':
          openssl.c:(.text.git_openssl_stream_global_init+0x54): undefined reference to `SSL_CTX_ctrl'
          collect2: error: ld returned 1 exit status
          
  = help: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

This is on Ubuntu 20.04 x86_64 with "libssl-dev" and "libgit2-dev" installed, using Rust nightly 1.61.0-nightly (65c8266 2022-03-09)

rjzak avatar Mar 30 '22 19:03 rjzak

Thank you for checking out zee!

I am not immediately sure what to say as for what is worth the github actions run on Ubuntu 20.04 x86_46 ..albeit on Rust stable. Can you build it on stable?

mcobzarenco avatar Mar 30 '22 23:03 mcobzarenco

Tried on Rust 1.59.0, same issue: openssl.c:(.text.git_openssl_stream_global_init+0x54): undefined reference to 'SSL_CTX_ctrl'.

error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-m64" "/tmp/cargo-installJ2xVae/release/deps/zee-cf50f8e82b72f3ef.zee.d883a875-cgu.0.rcgu.o" "-Wl,--as-needed" "-L" "/tmp/cargo-installJ2xVae/release/deps" "-L" "/tmp/cargo-installJ2xVae/release/build/libgit2-sys-727af57840f14bff/out/build" "-L" "/tmp/cargo-installJ2xVae/release/build/libssh2-sys-231e83dc1532af2d/out/build" "-L" "/usr/local/lib" "-L" "/tmp/cargo-installJ2xVae/release/build/tree-sitter-29a0dc66c1bccaf2/out" "-L" "/tmp/cargo-installJ2xVae/release/build/zee-grammar-80ab56900d91e445/out" "-L" "/tmp/cargo-installJ2xVae/release/build/zee-grammar-80ab56900d91e445/out" "-L" "/tmp/cargo-installJ2xVae/release/build/zee-grammar-80ab56900d91e445/out" "-L" "/tmp/cargo-installJ2xVae/release/build/zee-grammar-80ab56900d91e445/out" "-L" "/tmp/cargo-installJ2xVae/release/build/zee-grammar-80ab56900d91e445/out" "-L" "/tmp/cargo-installJ2xVae/release/build/zee-grammar-80ab56900d91e445/out" "-L" "/tmp/cargo-installJ2xVae/release/build/zee-grammar-80ab56900d91e445/out" "-L" "/tmp/cargo-installJ2xVae/release/build/zee-grammar-80ab56900d91e445/out" "-L" "/tmp/cargo-installJ2xVae/release/build/zee-grammar-80ab56900d91e445/out" "-L" "/tmp/cargo-installJ2xVae/release/build/zee-grammar-80ab56900d91e445/out" "-L" "/tmp/cargo-installJ2xVae/release/build/zee-grammar-80ab56900d91e445/out" "-L" "/tmp/cargo-installJ2xVae/release/build/zee-grammar-80ab56900d91e445/out" "-L" "/tmp/cargo-installJ2xVae/release/build/zee-grammar-80ab56900d91e445/out" "-L" "/tmp/cargo-installJ2xVae/release/build/zee-grammar-80ab56900d91e445/out" "-L" "/tmp/cargo-installJ2xVae/release/build/zee-grammar-80ab56900d91e445/out" "-L" "/tmp/cargo-installJ2xVae/release/build/zee-grammar-80ab56900d91e445/out" "-L" "/tmp/cargo-installJ2xVae/release/build/zee-grammar-80ab56900d91e445/out" "-L" "/home/rjzak/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/tmp/rustc00iZab/libzee_grammar-87405eb9dd19640c.rlib" "/tmp/rustc00iZab/libtree_sitter-f9758ed6609a8056.rlib" "/tmp/rustc00iZab/liblibgit2_sys-e2eee62aa41baf79.rlib" "/tmp/rustc00iZab/liblibssh2_sys-478b4c2932c661a6.rlib" "-Wl,--start-group" "-Wl,--end-group" "/home/rjzak/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-1d9f7e5920635d15.rlib" "-Wl,-Bdynamic" "-lstdc++" "-lssl" "-lcrypto" "-lz" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/home/rjzak/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/tmp/cargo-installJ2xVae/release/deps/zee-cf50f8e82b72f3ef" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro,-znow" "-Wl,-O1" "-nodefaultlibs"
  = note: /usr/bin/ld: /tmp/rustc00iZab/liblibgit2_sys-e2eee62aa41baf79.rlib(openssl.o): in function `git_openssl_stream_global_init':
          openssl.c:(.text.git_openssl_stream_global_init+0x54): undefined reference to `SSL_CTX_ctrl'
          collect2: error: ld returned 1 exit status
          
  = help: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

rjzak avatar Mar 30 '22 23:03 rjzak

For what it is worth I tested this in docker without issue:

FROM ubuntu:20.04

WORKDIR /root

RUN apt-get update \
 && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y curl git build-essential pkg-config libssl-dev libgit2-dev \
 && curl https://sh.rustup.rs -sSf | \
    sh -s -- --default-toolchain 1.62.0 -y

ENV PATH=/root/.cargo/bin:$PATH
RUN git clone https://github.com/zee-editor/zee.git
WORKDIR "/root/zee/zee"
RUN cargo install --path .

iainh avatar Jul 14 '22 00:07 iainh