Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build library with vendored zmq v0.9 for x86_64-linux-android #1167

Closed
berendsliedrecht opened this issue Dec 5, 2022 · 4 comments
Closed
Labels

Comments

@berendsliedrecht
Copy link

berendsliedrecht commented Dec 5, 2022

I am trying to build a library with zmq v0.9 installed. it uses the vendored feature to build the library, but I am running into issues with the build step of zmq-sys.

I am on a Linux 6.0.11 host and using the latest cross version.

These two parts of the stacktrace caught my eye:

  1. Android: Neither the NDK or a standalone toolchain was found.
  2. CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.

Reproduce:

git clone https://github.com/hyperledger/indy-vdr.git
cd indy-vdr
cross build --release --package=indy-vdr --target=x86_64-linux-android

also, I can not upgrade to zmq v0.10 (which does not have this issue, as some features do not work anymore which are required.)

Can supply more information if required.

Stacktrace

error: failed to run custom build command for `zmq-sys v0.11.0`

Caused by:
  process didn't exit successfully: `/indy-vdr/target/release/build/zmq-sys-a063d12abe243d3b/build-script-main` (exit status: 101)
  --- stdout
  cargo:rerun-if-changed=build/main.rs
  cargo:rerun-if-env-changed=PROFILE
  CMAKE_TOOLCHAIN_FILE_x86_64-linux-android = None
  CMAKE_TOOLCHAIN_FILE_x86_64_linux_android = None
  TARGET_CMAKE_TOOLCHAIN_FILE = None
  CMAKE_TOOLCHAIN_FILE = None
  CMAKE_GENERATOR_x86_64-linux-android = None
  CMAKE_GENERATOR_x86_64_linux_android = None
  TARGET_CMAKE_GENERATOR = None
  CMAKE_GENERATOR = None
  CMAKE_PREFIX_PATH_x86_64-linux-android = None
  CMAKE_PREFIX_PATH_x86_64_linux_android = None
  TARGET_CMAKE_PREFIX_PATH = None
  CMAKE_PREFIX_PATH = None
  CMAKE_x86_64-linux-android = None
  CMAKE_x86_64_linux_android = None
  TARGET_CMAKE = None
  CMAKE = None
  running: "cmake" "/tmp/.cargo/registry/src/github.com-1ecc6299db9ec823/zeromq-src-0.1.10+4.3.2/vendor" "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_C_STANDARD=99" "-DZMQ_BUILD_TESTS=OFF" "-DENABLE_DRAFTS=OFF" "-DENABLE_CURVE=ON" "-DCMAKE_BUILD_TYPE=Release" "-DWITH_PERF_TOOL=OFF" "-DBUILD_SHARED=OFF" "-DBUILD_STATIC=ON" "-DWITH_LIBSODIUM=OFF" "-DCMAKE_SYSTEM_NAME=Android" "-DCMAKE_SYSTEM_PROCESSOR=x86_64" "-DCMAKE_INSTALL_PREFIX=/indy-vdr/target/x86_64-linux-android/release/build/zmq-sys-97e6da94ca174955/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_C_COMPILER=/android-ndk/bin/x86_64-linux-android-gcc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_COMPILER=/android-ndk/bin/x86_64-linux-android-g++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_ASM_COMPILER=/android-ndk/bin/x86_64-linux-android-gcc"
  -- Configuring incomplete, errors occurred!

  --- stderr
  CMake Error at /usr/local/share/cmake-3.23/Modules/Platform/Android-Determine.cmake:209 (message):
    Android: Neither the NDK or a standalone toolchain was found.
  Call Stack (most recent call first):
    /usr/local/share/cmake-3.23/Modules/CMakeDetermineSystem.cmake:160 (include)
    CMakeLists.txt:2 (project)


  CMake Warning (dev) in /usr/local/share/cmake-3.23/Modules/Platform/Android-Determine.cmake:
    Policy CMP0011 is not set: Included scripts do automatic cmake_policy PUSH
    and POP.  Run "cmake --help-policy CMP0011" for policy details.  Use the
    cmake_policy command to set the policy and suppress this warning.

    The included script

      /usr/local/share/cmake-3.23/Modules/Platform/Android-Determine.cmake

    affects policy settings.  CMake is implying the NO_POLICY_SCOPE option for
    compatibility, so the effects are applied to the including context.
  Call Stack (most recent call first):
    /usr/local/share/cmake-3.23/Modules/CMakeDetermineSystem.cmake:160 (include)
    CMakeLists.txt:2 (project)
  This warning is for project developers.  Use -Wno-dev to suppress it.

  CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
  thread 'main' panicked at '
  command did not execute successfully, got: exit status: 1

  build script failed, must exit now', /tmp/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.49/src/lib.rs:1104:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
@Emilgardis
Copy link
Member

what image are you using? v0.2.4 or main?

@Alexhuszagh
Copy link
Contributor

Alexhuszagh commented Dec 5, 2022

This should be fixed as of #1112 (which was merged very recently). Are you possibly using an old image? Can you try running docker pull ghcr.io/cross-rs/x86_64-linux-android:main, in case if you're using an older main image? We now provide the CMAKE_TOOLCHAIN_FILE_x86_64_linux_android environment variable, so the CMake toolchain should be found. It builds on my end using the latest main.

This looks like a duplicate of #1110.

Just to confirm, I replicated the exact steps in your original post:

git clone https://github.com/hyperledger/indy-vdr.git
cd indy-vdr
cross build --release --package=indy-vdr --target=x86_64-linux-android

Look at Cargo.lock, I can confirmzmq-sys v0.11.0 is being used:

[[package]]
name = "zmq-sys"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d33a2c51dde24d5b451a2ed4b488266df221a5eaee2ee519933dc46b9a9b3648"
dependencies = [
 "libc",
 "metadeps",
 "zeromq-src",
]

@berendsliedrecht
Copy link
Author

it is working now with main as the image tag. I think it defaulted to latest or something else, as I never specified the image. I added it to the Cross.toml and now it works, thanks.

Is it possible in the Cross.toml to supply just the tag of the image and not the whole image? Might be a bit less error-prone as it will just take the github image associated with the target, but with a specific tag.

@Emilgardis
Copy link
Member

Hmm, I've been thinking about allowing that, definitely possible to do. I'll close this and open a new issue for that feature.

Glad it works now for you :) v0.3.0 will be out soon™️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants