These are chat archives for rust-lang/rust

10th
Dec 2018
Tim Robinson
@1tgr
Dec 10 2018 09:28
That's right @David-OConnor, having impl<A> ... for Box<A> prevents you from having any impl<A> ... for Box<A> where ...
Jan Hlavatý
@hlavaatch
Dec 10 2018 10:57
Why are rustfmt abd clippy still called rustfmt-preview and clippy-preview in cargo component add, it does not match the website docs
same for rls i think
werent these released as part of rust 2018?
Akos Vandra
@axos88
Dec 10 2018 12:25
Hey guys, is there any active discussion about forgoing the orphan rule for binary crates? I would be interested if there are any caveats I'm not considering, but seems to be safe to do that, and would make life a bit easier in case a library does not provide an implementation of say Debug for a struct.
David O'Connor
@David-OConnor
Dec 10 2018 12:59
@1tgr thanks again!
Michal 'vorner' Vaner
@vorner
Dec 10 2018 13:02
@axos88 I think the problems are: what if you want to copy-paste the code into a lib/make a lib out of part of the code? And, what if you update the crate you depend on? Implementing another trait is not considered a breaking change now.
(anyway, the easiest way forward is probably to fork the repo, stick the #[derive(Debug)] on that struct, open a PR and hope the author releases a new version by tomorrow… and depend on your own git branch for the time being)
Found a relevant Issue here
quarkstone
@quarkstone
Dec 10 2018 21:41

Hey everyone. Can someone provide to pointers on how to get projects with openssl-sys dependency to compile on android?

For instance, I'm trying to compile actix-web with ssl support here, but keep ending up with the following error:

cargo build: i686-linux-android..
make[2]: Entering directory '/home/fedora/android-rs'
make[2]: Leaving directory '/home/fedora/android-rs'

   Compiling native-tls v0.2.2                                                                                                                                                                 
   Compiling openssl-probe v0.1.2                                                                                                                                                              
   Compiling actix-web v0.7.13                                                                                                                                                                 
   Compiling openssl-sys v0.9.39                                                                                                                                                               
error: failed to run custom build command for `openssl-sys v0.9.39`                                                                                                                            
process didn't exit successfully: `/home/fedora/android-rs/target/debug/build/openssl-sys-0f399f3f9d2c27a6/build-script-main` (exit code: 101)
--- stdout
cargo:rerun-if-env-changed=I686_LINUX_ANDROID_OPENSSL_LIB_DIR
cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
cargo:rerun-if-env-changed=I686_LINUX_ANDROID_OPENSSL_INCLUDE_DIR
cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
cargo:rerun-if-env-changed=I686_LINUX_ANDROID_OPENSSL_DIR
cargo:rerun-if-env-changed=OPENSSL_DIR
run pkg_config fail: "Cross compilation detected. Use PKG_CONFIG_ALLOW_CROSS=1 to override"

--- stderr
thread 'main' panicked at '

Could not find directory of OpenSSL installation, and this `-sys` crate cannot
proceed without this knowledge. If OpenSSL is installed and this crate had
trouble finding it,  you can set the `OPENSSL_DIR` environment variable for the
compilation process.

Make sure you also have the development packages of openssl installed.
For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.

If you're in a situation where you think the directory *should* be found
automatically, please open a bug at https://github.com/sfackler/rust-openssl
and include information about your system as well as this message.

    $HOST = x86_64-unknown-linux-gnu
    $TARGET = i686-linux-android
    openssl-sys = 0.9.39
Currently I have a fedora based CI that keeps failing with the above error. And both opensl-devel and openssl-static are installed for both x64-86 and i686 arch.
quarkstone
@quarkstone
Dec 10 2018 23:30
Adding on to the above, enabling PKG_CONFIG_ALLOW_CROSS=1 ends up with the following as well:
   Compiling openssl-sys v0.9.39                                                                                                                                                               
error: failed to run custom build command for `openssl-sys v0.9.39`                                                                                                                            
process didn't exit successfully: `/home/fedora/android-rs/target/debug/build/openssl-sys-0f399f3f9d2c27a6/build-script-main` (exit code: 101)
--- stdout
cargo:rerun-if-env-changed=I686_LINUX_ANDROID_OPENSSL_LIB_DIR
cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
cargo:rerun-if-env-changed=I686_LINUX_ANDROID_OPENSSL_INCLUDE_DIR
cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
cargo:rerun-if-env-changed=I686_LINUX_ANDROID_OPENSSL_DIR
cargo:rerun-if-env-changed=OPENSSL_DIR
cargo:rustc-link-lib=ssl
cargo:rustc-link-lib=crypto
OPT_LEVEL = Some("0")
TARGET = Some("i686-linux-android")
HOST = Some("x86_64-unknown-linux-gnu")
CC_i686-linux-android = None
CC_i686_linux_android = None
TARGET_CC = None
CC = Some("clang")
CFLAGS_i686-linux-android = None
CFLAGS_i686_linux_android = None
TARGET_CFLAGS = None
CFLAGS = None
DEBUG = Some("true")
running: "clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=i686-linux-android" "-Wall" "-Wextra" "-E" "/home/fedora/android-rs/target/i686-linux-android/debug/build/openssl-sys-8db4c422259d300a/out/expando.c"
cargo:warning=/home/fedora/android-rs/target/i686-linux-android/debug/build/openssl-sys-8db4c422259d300a/out/expando.c:1:10: fatal error: 'openssl/opensslv.h' file not found
cargo:warning=#include <openssl/opensslv.h>
cargo:warning=         ^~~~~~~~~~~~~~~~~~~~
cargo:warning=1 error generated.
exit code: 1

--- stderr
thread 'main' panicked at '
Header expansion error:
Error { kind: ToolExecError, message: "Command \"clang\" \"-O0\" \"-ffunction-sections\" \"-fdata-sections\" \"-fPIC\" \"-g\" \"-fno-omit-frame-pointer\" \"--target=i686-linux-android\" \"-Wall\" \"-Wextra\" \"-E\" \"/home/fedora/android-rs/target/i686-linux-android/debug/build/openssl-sys-8db4c422259d300a/out/expando.c\" with args \"clang\" did not execute successfully (status code exit code: 1)." }

Failed to find OpenSSL development headers.

You can try fixing this setting the `OPENSSL_DIR` environment variable
pointing to your OpenSSL installation or installing OpenSSL headers package
specific to your distribution:

    # On Ubuntu
    sudo apt-get install libssl-dev
    # On Arch Linux
    sudo pacman -S openssl
    # On Fedora
    sudo dnf install openssl-devel

See rust-openssl README for more information:

    https://github.com/sfackler/rust-openssl#linux
', /home/fedora/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.39/build/main.rs:432:13
note: Run with `RUST_BACKTRACE=1` for a backtrace.
Akos Vandra
@axos88
Dec 10 2018 23:41
@quarkstone this is how I compile for raspberry pi, maybe it's helpful to you too
PATH=$PATH:/Volumes/ct-ng/arm-unknown-linux-gnueabihf/bin/ 
SYSROOT=/Volumes/ct-ng/arm-unknown-linux-gnueabihf/arm-unknown-linux-gnueabihf/sysroot; 
PKG_CONFIG_ALLOW_CROSS=1 
RUST_BACKTRACE=0 
OPENSSL_LIB_DIR=$SYSROOT/lib 
OPENSSL_INCLUDE_DIR=$SYSROOT/usr/include
PKG_CONFIG_LIBDIR=${SYSROOT}/usr/lib/pkgconfig:${SYSROOT}/usr/share/pkgconfig
PKG_CONFIG_SYSROOT_DIR=${SYSROOT} 
cargo build  --target arm-unknown-linux-gnueabihf
quarkstone
@quarkstone
Dec 10 2018 23:45
@axos88, thanks! I'm currently setting the PATH as you do, and calling cargo. I basically didn't set up OPENSLL_ or PKGCONFIG. Perhaps, that's the problem.
I expected pkg-config to pick things up as normal, since it's there in the PATH anyway.
May be that was the incorrect expectation.
But quick question though -- Is there a reason you're manually setting up OPENSLL* vars? Shouldn't pkg-config take care of it?