Skip to content

No input files given to clang in MacOS Github runner #1196

@rafaelbeckel

Description

@rafaelbeckel

I have a Rust library that includes some C dependencies and builds them with cc crate.

The build works perfectly on my machine, but cc does pass the input files to clang in GitHub CI. The build does not fail, but the library is built without the C symbols.

The library is used by an iOS App. The App builds on my machine but not in Github CI because it can't find the C symbols in the library.

While building the library on Github, I noticed it emits some warnings from the detect_compiler_family.c file from this crate.

This same warning happens for all our C dependencies, using libpng as an example:

warning: png@0.0.0: /Users/runner/work/mylib/mylib/build/aarch64-apple-ios-sim/release/build/png-9e337979ddc13f8a/out/12269455920946110607detect_compiler_family.c:2:9: warning: clang [-W#pragma-messages]
warning: png@0.0.0: #pragma message "clang"
warning: png@0.0.0:         ^
warning: png@0.0.0: /Users/runner/work/mylib/mylib/build/aarch64-apple-ios-sim/release/build/png-9e337979ddc13f8a/out/12269455920946110607detect_compiler_family.c:6:9: warning: gcc [-W#pragma-messages]
warning: png@0.0.0: #pragma message "gcc"
warning: png@0.0.0:         ^
warning: png@0.0.0: 2 warnings generated.

# The error is here
warning: png@0.0.0: clang: error: unknown argument: '-?'
warning: png@0.0.0: clang: error: no input files

How to reproduce

Build a library with some C dependency on the MacOS Github runner (I'm using macos-14).

  test_rust_ios_build:
    runs-on: "macos-14"
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          submodules: "recursive"

      - name: Install llvm from Homebrew
        run: |
          brew update
          brew install llvm@18
          export LDFLAGS="-L/opt/homebrew/opt/llvm/lib/c++ -L/opt/homebrew/opt/llvm/lib -lunwind ${LDFLAGS}"
          export CC="/opt/homebrew/opt/llvm/bin/clang"
          export CXX="/opt/homebrew/opt/llvm/bin/clang++"
          export LD="/opt/homebrew/opt/llvm/bin/clang"
          export PATH="/opt/homebrew/opt/llvm/bin:$PATH"

      - name: Setup Rust
        uses: actions-rust-lang/setup-rust-toolchain@v1
        with:
          cache: false

      - name: Setup Rust cache
        uses: Swatinem/rust-cache@v2
        with:
          cache-directories: ${{ github.workspace }}/build
          cache-all-crates: true

      - name: Run sccache-cache
        uses: mozilla-actions/sccache-action@v0.0.4

      - name: Build iOS
        env:
          CC_ENABLE_DEBUG_OUTPUT: 1
          CARGO_PROFILE_RELEASE_BUILD_OVERRIDE_DEBUG: true
          RUST_BACKTRACE: "full"
        run: cargo build -v --target $TARGET --release

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions