erickt / rust-zmq

Rust zeromq bindings.
Apache License 2.0
886 stars 189 forks source link

Target armv7-unknown-linux-musleabihf #365

Open haverins opened 1 year ago

haverins commented 1 year ago

I'm on x86 Ubuntu 22. Has anyone had any luck targeting armv7-unknown-linux-musleabihf? First I tried using armv7l-linux-musleabihf-cross compiler from https://musl.cc/ and the result was:

  = note: /usr/bin/armv7l-linux-musleabihf-cross/bin/../lib/gcc/armv7l-linux-musleabihf/11.2.1/../../../../armv7l-linux-musleabihf/bin/ld: /app/target-cpr/armv7-unknown-linux-musleabihf/release/deps/libzmq_sys-6cce5ab0b2c3f5d2.rlib(bc885500b04ef003-clock.o): undefined reference to symbol '__gettimeofday_time64'
          /usr/bin/armv7l-linux-musleabihf-cross/bin/../lib/gcc/armv7l-linux-musleabihf/11.2.1/../../../../armv7l-linux-musleabihf/bin/ld: /usr/bin/armv7l-linux-musleabihf-cross/bin/../armv7l-linux-musleabihf/lib/libc.so: error adding symbols: DSO missing from command line
          collect2: error: ld returned 1 exit status

  = note: 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)

Then I tried clang and got different error:

  cargo:warning=In file included from /home/xxxx/.cargo/registry/src/github.com-1ecc6299db9ec823/zeromq-src-0.2.4+4.3.4/vendor/src/dealer.cpp:30:
  cargo:warning=In file included from /home/xxxx/.cargo/registry/src/github.com-1ecc6299db9ec823/zeromq-src-0.2.4+4.3.4/vendor/src/precompiled.hpp:57:
  cargo:warning=In file included from /home/xxxx/.cargo/registry/src/github.com-1ecc6299db9ec823/zeromq-src-0.2.4+4.3.4/vendor/src/../include/zmq.h:56:
  cargo:warning=In file included from /usr/bin/../lib/gcc-cross/arm-linux-gnueabi/11/../../../../arm-linux-gnueabi/include/errno.h:25:
  cargo:warning=In file included from /usr/bin/../lib/gcc-cross/arm-linux-gnueabi/11/../../../../arm-linux-gnueabi/include/features.h:510:
  cargo:warning=/usr/bin/../lib/gcc-cross/arm-linux-gnueabi/11/../../../../arm-linux-gnueabi/include/gnu/stubs.h:10:11: fatal error: 'gnu/stubs-hard.h' file not found
  cargo:warning=# include <gnu/stubs-hard.h>
  cargo:warning=          ^~~~~~~~~~~~~~~~~~
  cargo:warning=1 error generated.
  exit status: 1
  cargo:warning=1 error generated.
  exit status: 1
  cargo:warning=1 error generated.
  cargo:warning=1 error generated.
  cargo:warning=1 error generated.
  exit status: 1
  exit status: 1
  exit status: 1
  cargo:warning=1 error generated.
  exit status: 1
  cargo:warning=1 error generated.
  exit status: 1

  --- stderr

  error occurred: Command "clang++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=armv7-unknown-linux-musleabihf" "-I" "/home/xxxx/.cargo/registry/src/github.com-1ecc6299db9ec823/zeromq-src-0.2.4+4.3.4/vendor/include" "-I" "/home/xxxx/.cargo/registry/src/github.com-1ecc6299db9ec823/zeromq-src-0.2.4+4.3.4/vendor/src" "-I" "/home/xxxx/.cargo/registry/src/github.com-1ecc6299db9ec823/zeromq-src-0.2.4+4.3.4/vendor/src" "-I" "/home/xxxx/.cargo/registry/src/github.com-1ecc6299db9ec823/zeromq-src-0.2.4+4.3.4/vendor/external/sha1" "-I" "/home/xxxx/repos/test-rs/target/armv7-unknown-linux-musleabihf/release/build/zmq-sys-4bf90f25f8670187/out" "-Wall" "-Wextra" "-DZMQ_BUILD_TESTS=OFF" "-DZMQ_USE_CV_IMPL_STL11=1" "-DZMQ_STATIC=1" "-DZMQ_USE_BUILTIN_SHA1=1" "-DZMQ_HAVE_WS=1" "-DZMQ_IOTHREAD_POLLER_USE_EPOLL=1" "-DZMQ_POLL_BASED_ON_POLL=1" "-DZMQ_HAVE_IPC=1" "-DHAVE_STRNLEN=1" "-DZMQ_HAVE_UIO=1" "-DZMQ_HAVE_STRLCPY=1" "-o" "/home/xxxx/repos/test-rs/target/armv7-unknown-linux-musleabihf/release/build/zmq-sys-4bf90f25f8670187/out/lib/dc73241d0cc501d3-address.o" "-c" "/home/xxxx/.cargo/registry/src/github.com-1ecc6299db9ec823/zeromq-src-0.2.4+4.3.4/vendor/src/address.cpp" with args "clang++" did not execute successfully (status code exit status: 1).
 ^~~~~~~~~~~~~~~~~~
joaofrf commented 1 week ago

You're probably missing packages on your machine I usually target different architectures using cross It worked fine when I ran: cross build --target armv7-unknown-linux-musleabihf --release