You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MacOS下编译libtiff时Clang无法生成可执行文件的问题求助

Why is Clang throwing "no input files" errors when building libtiff-3.9.6 on macOS?

Let's break this down clearly: those "no input files" messages you're seeing aren't the root cause of your build failure—they're side effects of outdated compatibility logic in the libtiff 3.9.6 configure script. Here's the full breakdown:

First: What's causing the "no input files" errors?

Looking at your config.log, those errors stem from two failed compiler version checks in the old configure script:

  • The script runs cc -V: This is a GCC-specific flag, but Clang doesn't support it. When Clang rejects the unrecognized flag, it also notes there are no input files (since the command only requested version info without providing source code).
  • Next it runs cc -qversion: This is a flag for IBM's XL compiler, which Clang also doesn't recognize. Again, the "no input files" message is just a secondary, harmless note here.

These are just compatibility warnings from a legacy script that wasn't updated to handle Clang properly. The actual build failure comes from a separate, critical issue:

The real problem: Linker can't find -lSystem

The error that's actually stopping your build is:

ld: library not found for -lSystem
clang: error: linker command failed with exit code 1

This happens when macOS can't locate the system SDK (part of Xcode's command line tools), which provides core system libraries like libSystem.dylib.

Fixes to resolve the issue

Follow these steps to get your build working:

1. Ensure Xcode Command Line Tools are fully installed

Run this in your terminal to install or verify the tools:

xcode-select --install

If they're already installed, you'll see a confirmation message. If not, follow the prompts to complete installation, then restart your terminal.

2. Set the correct Xcode SDK path

First check your current SDK path:

xcode-select -p

It should return /Applications/Xcode.app/Contents/Developer. If it doesn't, set it with:

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

3. Work around libtiff's outdated configure script

Since libtiff 3.9.6 is very old (released in 2012), it doesn't handle Clang's defaults well. Add these flags to your CMake configuration for libtiff to force it to use the correct SDK:

If you're using ExternalProject_Add in your CMakeLists.txt:

ExternalProject_Add(libtiff
  URL http://download.osgeo.org/libtiff/libtiff-3.9.6.tar.gz
  CONFIGURE_ARGS --disable-debug --disable-dependency-tracking
                 CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
                 CFLAGS="-isysroot $(xcrun --show-sdk-path)"
)

If you're using FetchContent:

# Set C flags to use the correct SDK before declaring libtiff
set(CMAKE_C_FLAGS "-isysroot $(xcrun --show-sdk-path)" CACHE STRING "" FORCE)

FetchContent_Declare(libtiff
  URL http://download.osgeo.org/libtiff/libtiff-3.9.6.tar.gz
)

4. Clean and rebuild from scratch

Delete your existing build directory to clear any broken cached configurations:

rm -rf build

Then re-run CMake and make:

mkdir build && cd build
cmake ..
make

Summary

The "no input files" errors are just noise from an old configure script that doesn't know how to check Clang's version properly. The real fix is ensuring your Xcode command line tools are installed correctly, and forcing libtiff to use macOS's system SDK during compilation.

内容的提问来源于stack exchange,提问作者ziad_dp

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.27 19:02:34