These are chat archives for rust-lang/rust

24th
Apr 2017
d2a4u
@d2a4u
Apr 24 2017 22:13

hi, I'm cross compiling openssl for raspberry pi but ran into this error:

error: linking with `gcc-sysroot` failed: exit code: 1
note: /root/tools/pi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lssl
          /root/tools/pi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lcrypto

I have a feeling I need to link ssl and crypto up somehow to the compiled openssl but I'm not entirely sure how. Can someone point me to the correct direction please? Thank you so much

Denis Lisov
@tanriol
Apr 24 2017 22:40
Do you actually have libssl.so and libcrypto.so in your sysroot?
d2a4u
@d2a4u
Apr 24 2017 22:45
@tanriol I have those under /opt/openssl/lib where I download and compile from source, also tried to copy those files to /usr/local/lib
Denis Lisov
@tanriol
Apr 24 2017 22:46
Ok, so you've already cross-compiled openssl for your target?
What about OPENSSL_DIR=/opt/openssl cargo build?
d2a4u
@d2a4u
Apr 24 2017 22:47
yep, I just don't know how to point cargo build --target command to use what I have cross-compiled
Denis Lisov
@tanriol
Apr 24 2017 22:48
@d2a4u By the way, building software as root is usually not a good idea.
Yuval Kohavi
@yuval-k
Apr 24 2017 22:48
@d2a4u - when i'm in your situation i cheat - i use the resin.io raspberry pi docker image, do apt-get for the lib-whatever-dev and then grab the .a files and link statically (all from my laptop, no pi needed)
Denis Lisov
@tanriol
Apr 24 2017 22:50
@uvgroovy Well, my cheat was to fetch the files from a pi and put them into sysroot...
d2a4u
@d2a4u
Apr 24 2017 22:50
@tanriol I got OPENSSL_DIR=/opt/openssl cargo build as well, no luck. I'm using a docker container to build atm so kind of cheating and just use root for the time being :p
Yuval Kohavi
@yuval-k
Apr 24 2017 22:52
@d2a4u what about adding CARGO_BUILD_RUSTFLAGS="-C link_args=-L/path/to/libs" cargo build --target ...
d2a4u
@d2a4u
Apr 24 2017 23:06
hmm, something is broken, I now can't even pass Updating registry 'https://github.com/rust-lang/crates.io-index' step :( will need to figure out why. @tanriol how do you put lib's files into sysroot? and where is sysroot?
Denis Lisov
@tanriol
Apr 24 2017 23:08
@d2a4u Manually copied. Includes in arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/libc/usr/include/openssl/, libraries (.a, .so and symlink) in arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/libc/usr/lib/arm-linux-gnueabihf/
d2a4u
@d2a4u
Apr 24 2017 23:09
cool, thanks @tanriol . I will give that a go