freetype-sys icon indicating copy to clipboard operation
freetype-sys copied to clipboard

Cross compiling from Linux to macOS fails

Open Swire42 opened this issue 3 years ago • 0 comments

I'm trying to cross-compile my crate, which depends on freetype-sys, from Linux to macOS. When I run cargo build --target x86_64-apple-darwin, the compilation of freetype-sys fails very much like https://github.com/gfx-rs/wgpu/issues/2956.

Am I doing something wrong here, or is the problem with freetype-sys?

Full error message:

error: failed to run custom build command for `freetype-sys v0.13.1`

Caused by:
  process didn't exit successfully: `/data/swire/Prog/Apps/Cards/target/debug/build/freetype-sys-b224166380e3333c/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=FREETYPE2_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_x86_64-apple-darwin
  cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_x86_64_apple_darwin
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS
  cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-apple-darwin
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_apple_darwin
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-apple-darwin
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_apple_darwin
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  CMAKE_TOOLCHAIN_FILE_x86_64-apple-darwin = None
  CMAKE_TOOLCHAIN_FILE_x86_64_apple_darwin = None
  TARGET_CMAKE_TOOLCHAIN_FILE = None
  CMAKE_TOOLCHAIN_FILE = None
  CMAKE_GENERATOR_x86_64-apple-darwin = None
  CMAKE_GENERATOR_x86_64_apple_darwin = None
  TARGET_CMAKE_GENERATOR = None
  CMAKE_GENERATOR = None
  CMAKE_PREFIX_PATH_x86_64-apple-darwin = None
  CMAKE_PREFIX_PATH_x86_64_apple_darwin = None
  TARGET_CMAKE_PREFIX_PATH = None
  CMAKE_PREFIX_PATH = None
  CMAKE_x86_64-apple-darwin = None
  CMAKE_x86_64_apple_darwin = None
  TARGET_CMAKE = None
  CMAKE = None
  running: "cmake" "/home/swire/.cargo/registry/src/github.com-1ecc6299db9ec823/freetype-sys-0.13.1/freetype2" "-DWITH_BZip2=OFF" "-DWITH_HarfBuzz=OFF" "-DWITH_PNG=OFF" "-DWITH_ZLIB=OFF" "-DCMAKE_INSTALL_PREFIX=/data/swire/Prog/Apps/Cards/target/x86_64-apple-darwin/debug/build/freetype-sys-f0a0d91373846782/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -arch x86_64" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -arch x86_64" "-DCMAKE_CXX_COMPILER=/usr/bin/c++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -arch x86_64" "-DCMAKE_ASM_COMPILER=/usr/bin/cc" "-DCMAKE_BUILD_TYPE=Release"
  -- The C compiler identification is GNU 12.2.0
  -- The CXX compiler identification is GNU 12.2.0
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - failed
  -- Check for working C compiler: /usr/bin/cc
  -- Check for working C compiler: /usr/bin/cc - broken
  -- Configuring incomplete, errors occurred!
  See also "/data/swire/Prog/Apps/Cards/target/x86_64-apple-darwin/debug/build/freetype-sys-f0a0d91373846782/out/build/CMakeFiles/CMakeOutput.log".
  See also "/data/swire/Prog/Apps/Cards/target/x86_64-apple-darwin/debug/build/freetype-sys-f0a0d91373846782/out/build/CMakeFiles/CMakeError.log".

  --- stderr
  CMake Deprecation Warning at CMakeLists.txt:78 (cmake_minimum_required):
    Compatibility with CMake < 2.8.12 will be removed from a future version of
    CMake.

    Update the VERSION argument <min> value or use a ...<max> suffix to tell
    CMake that the project does not need compatibility with older versions.


  CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:69 (message):
    The C compiler

      "/usr/bin/cc"

    is not able to compile a simple test program.

    It fails with the following output:

      Change Dir: /data/swire/Prog/Apps/Cards/target/x86_64-apple-darwin/debug/build/freetype-sys-f0a0d91373846782/out/build/CMakeFiles/CMakeTmp

      Run Build Command(s):/usr/bin/make -f Makefile cmTC_54e32/fast && /usr/bin/make  -f CMakeFiles/cmTC_54e32.dir/build.make CMakeFiles/cmTC_54e32.dir/build
      make[1]: Entering directory '/data/swire/Prog/Apps/Cards/target/x86_64-apple-darwin/debug/build/freetype-sys-f0a0d91373846782/out/build/CMakeFiles/CMakeTmp'
      Building C object CMakeFiles/cmTC_54e32.dir/testCCompiler.c.o
      /usr/bin/cc   -ffunction-sections -fdata-sections -fPIC -m64 -arch x86_64  -o CMakeFiles/cmTC_54e32.dir/testCCompiler.c.o -c /data/swire/Prog/Apps/Cards/target/x86_64-apple-darwin/debug/build/freetype-sys-f0a0d91373846782/out/build/CMakeFiles/CMakeTmp/testCCompiler.c
      cc: error: unrecognized command-line option ‘-arch’
      make[1]: *** [CMakeFiles/cmTC_54e32.dir/build.make:78: CMakeFiles/cmTC_54e32.dir/testCCompiler.c.o] Error 1
      make[1]: Leaving directory '/data/swire/Prog/Apps/Cards/target/x86_64-apple-darwin/debug/build/freetype-sys-f0a0d91373846782/out/build/CMakeFiles/CMakeTmp'
      make: *** [Makefile:127: cmTC_54e32/fast] Error 2





    CMake will not be able to correctly generate this project.
  Call Stack (most recent call first):
    CMakeLists.txt:119 (project)


  thread 'main' panicked at '
  command did not execute successfully, got: exit status: 1

  build script failed, must exit now', /home/swire/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.48/src/lib.rs:975:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Swire42 avatar Oct 29 '22 02:10 Swire42