cross-rs / cross-toolchains

Additional Dockerfiles and crosstool-ng config files to build additional toolchains.
Apache License 2.0
88 stars 16 forks source link

Replace ranlib to x86_64-apple-darwin-ranlib when build target x86_64-apple-darwin #29

Closed cavivie closed 1 year ago

cavivie commented 1 year ago

When I build rust openssl, I get a ranlib error:

  ranlib: /alrd/target/x86_64-apple-darwin/release/build/openssl-sys-539748b120404349/out/openssl-build/install/lib/libcrypto.a.new: malformed archive
  make: *** [Makefile:326: install_dev] Error 1
  thread 'main' panicked at '

  Error installing OpenSSL:
      Command: "make" "install_dev"
      Exit status: exit status: 2

      ', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-src-111.25.1+1.1.1t/src/lib.rs:509:13
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I check the ranlib:

$ which ranlib
/usr/bin/ranlib

$ ranlib
Usage: ranlib [options] archive
 Generate an index to speed access to archives
 The options are:
  @<file>                      Read options from <file>
  --plugin <name>              Load the specified plugin
  -D                           Use zero for symbol map timestamp (default)
  -U                           Use an actual symbol map timestamp
  -t                           Update the archive's symbol map timestamp
  -h --help                    Print this help message
  -v --version                 Print version information
ranlib: supported targets: elf64-x86-64 elf32-i386 elf32-iamcu elf32-x86-64 pei-i386 pei-x86-64 elf64-l1om elf64-k1om elf64-little elf64-big elf32-little elf32-big pe-x86-64 pe-bigobj-x86-64 pe-i386 srec symbolsrec verilog tekhex binary ihex plugin

Should add the below code replace it in darwin-entry.sh:

declare -x RANLIB_${envvar_suffix}="${tools_prefix}"-ranlib

After replace, it works well for me.

cavivie commented 1 year ago

This should be a project-dependent build environment, which I can solve by adding compilation options myself.