nannou-org / nannou

A Creative Coding Framework for Rust.
https://nannou.cc/
6.03k stars 305 forks source link

[linux] nannou-new new fail compiling without libcurl-devel #174

Open WnP opened 6 years ago

WnP commented 6 years ago

build command for curl-sys v0.4.5 required libcurl-devel install on the system otherwise it could ends up with some openssl version issue.

Logs:

error: failed to run custom build command for `curl-sys v0.4.5`
process didn't exit successfully: `/tmp/cargo-installsZaFk6/release/build/curl-sys-728ef4db7749783f/build-script-build` (exit code: 101)
--- stdout
Couldn't find libcurl from pkgconfig ("`\"pkg-config\" \"--libs\" \"--cflags\" \"libcurl\"` did not exit successfully: exit code: 1\n--- stderr\nPackage libcurl was not found in the pkg-config s
earch path.\nPerhaps you should add the directory containing `libcurl.pc\'\nto the PKG_CONFIG_PATH environment variable\nNo package \'libcurl\' found\n"), compiling it from source...

<…truncated output…>

--- stderr
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
configure: WARNING: OpenSSL headers and library versions do not match.
/home/scl/.cargo/registry/src/github.com-1ecc6299db9ec823/curl-sys-0.4.5/curl/lib/vtls/openssl.c:124:22: error: static declaration of 'OpenSSL_version_num' follows non-static declaration
 static unsigned long OpenSSL_version_num(void)
                      ^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/openssl/bio.h:69:0,
                 from /usr/include/openssl/evp.h:67,
                 from /usr/include/openssl/hmac.h:67,
                 from /usr/include/openssl/ssl.h:149,
                 from /home/scl/.cargo/registry/src/github.com-1ecc6299db9ec823/curl-sys-0.4.5/curl/lib/urldata.h:86,
                 from /home/scl/.cargo/registry/src/github.com-1ecc6299db9ec823/curl-sys-0.4.5/curl/lib/vtls/openssl.c:41:
/usr/include/openssl/crypto.h:340:15: note: previous declaration of 'OpenSSL_version_num' was here
 unsigned long OpenSSL_version_num(void);
               ^~~~~~~~~~~~~~~~~~~
make[2]: *** [Makefile:2023: vtls/libcurl_la-openssl.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:734: all] Error 2
make: *** [Makefile:897: all-recursive] Error 1
thread 'main' panicked at '
command did not execute successfully, got: exit code: 2

build script failed, must exit now', /home/scl/.cargo/registry/src/github.com-1ecc6299db9ec823/curl-sys-0.4.5/build.rs:224:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: failed to compile `nannou-new v0.1.0`, intermediate artifacts can be found at `/tmp/cargo-installsZaFk6`

Caused by:
  build failed

Installing libcurl development package using your package manager fix the issue

apiraino commented 6 years ago

I'm a bit puzzled as I cannot reproduce this (Ubuntu 18.04) and I don't have the libcurl*-dev package installed. I have, though, this file under the cargo cache:

$ ls -la /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/curl-sys-0.4.5/curl/libcurl.pc.in
-rw-rw-r-- 1 me me 1503 nov 10  2016 /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/curl-sys-0.4.5/curl/libcurl.pc.in

not sure if it's related.

@WnP Can you still reproduce this? If yes, can you post your configuration?

WnP commented 6 years ago

@apiraino

I cannot reproduce this (Ubuntu 18.04)

Sorry I'm not an Ubuntu user.

Can you still reproduce this?

Yes, the following dockerfile will helps you to reproduce this issue:

FROM voidlinux/voidlinux

# `openssl-sys` crate requires `openssl-devel` or `libressl-devel`
# `libssh2-sys` crate requires `zlib-devel`
RUN xbps-install -Sy \
    rust cargo \
    cmake make gcc pkg-config \
    libressl-devel zlib-devel \
    && cargo install nannou-new

Note comments about other *-devel required packages.

Building an image from this dockerfile will fail, but if you add libcurl-devel it will successfully build.

WnP commented 6 years ago

FYI this issue looks related to alexcrichton/curl-rust#210

WnP commented 6 years ago

so it should be fixed in curl-sys 0.4.6 released 19 days ago

@mitchmindtree could we update curl-sys to use this fixed version in order to close this issue?

apiraino commented 6 years ago

@WnP I see.

I tried building an image from your Dockerfile and cargo install nannou-new downloads curl-sys==0.4.8 (the latest as I write). Still, without the libcurl-devel src the build breaks like you pointed out. Tried again with Alpine Linux, same result.

I'm not sure that pinning a more recent curl-sys would help fixing the issue, the problem is that some distros explicitely require libcurl-devel (or equivalent package).

Am I testing wrong?

WnP commented 6 years ago

@apiraino that's true, it doesn't compile even with curl-sys==0.4.8.

Here is a more simpler test case:

directory structure:

.
├── Dockerfile
└── test_curl_sys
    ├── Cargo.toml
    └── src
        └── main.rs

Where:

COPY test_curl_sys /test_curl_sys RUN xbps-install -Sy \ rust cargo libressl-devel \ cmake make gcc pkg-config \ && cd test_curl_sys \ && cargo run

- `Cargo.toml`:

[package] name = "test_curl_sys" version = "0.1.0" authors = ["me me@here.io"]

[dependencies] curl-sys = "0.4.8"

- `main.rs`:

fn main() { println!("Hello curl-sys"); }



I guess the issue is related to the fact that void linux use `libressl` which is an `openssl` fork, which could explain the version mismatch issue.
apiraino commented 6 years ago

So, how about we add a little notice on the README (#184), warning that some distros (voidlinux, alpine, others?) need the curl dev pkg since curl-sys (a dependency of nannou-new) might require it. Makes sense?

I would like the README to be helpful in this scenario without scaring away from nannou not-too-techy linux users

WnP commented 6 years ago

@apiraino IMHO it's not mandatory to enumerate every distros, just pointing libreSSL users should be enough because even ubuntu (or whatever distro) users can setup libreSSL in place of openSSL.

By the way enumerating few ones with the link you've just shared sounds like a good idea.

tpltnt commented 4 years ago

Is this still an issue? The related issue #184 is closed and the superseeding issue #188 is merged.