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

在Mac平台构建Xerces通用二进制库的问题及版本可行性咨询

Can Xerces 3.1.1/3.2.3 be built as universal binaries for Intel and M1 Macs?

Short answer: Yes, both Xerces 3.1.1 and 3.2.3 can be compiled into universal (fat) binaries supporting x86_64 and arm64 architectures on macOS. The error you're seeing during configure is related to your compiler environment setup, not an inherent limitation of the Xerces versions.

Fixing the "C++ compiler cannot create executables" error

Your initial configure command is missing critical flags to point the compiler to the macOS SDK provided by Xcode 12.3. Here's how to adjust it:

  1. First, ensure Xcode Command Line Tools are properly installed
    Run this in Terminal to confirm or install them:

    xcode-select --install
    

    If you already have them installed, verify the SDK path is accessible:

    xcrun --show-sdk-path
    

    This should output a path like /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk (matching your Xcode 12.3's SDK version).

  2. Use an updated configure command with SDK and explicit compilers
    Xcode's g++ is actually an alias for Clang, so explicitly specifying clang++ helps avoid confusion. Add the SDK path to your flags to ensure the compiler can find all necessary headers and libraries:

    ./configure CC=clang CXX=clang++ \
      CFLAGS="-arch x86_64 -arch arm64 -isysroot $(xcrun --show-sdk-path)" \
      CXXFLAGS="-arch x86_64 -arch arm64 -isysroot $(xcrun --show-sdk-path)" \
      LDFLAGS="-arch x86_64 -arch arm64 -isysroot $(xcrun --show-sdk-path)"
    
  3. Troubleshoot with config.log
    If you still hit errors, open the generated config.log file. Look for lines starting with configure:3456: g++ -o conftest ... to see the exact compiler error—common issues include missing SDK access permissions or outdated system compiler paths.

Verifying the universal binary

After a successful configure and make (followed by make install if needed), verify the resulting library contains both architectures:

lipo -info /usr/local/lib/libxerces-c.dylib

You should see output like:

Architectures in the fat file: /usr/local/lib/libxerces-c.dylib are: x86_64 arm64

Notes for older Xerces 3.1.1

While 3.1.1 is older, it still works with the above steps. You might encounter minor compiler warnings; if these cause failures, add -Wno-error to your CXXFLAGS to treat warnings as non-fatal:

CXXFLAGS="-arch x86_64 -arch arm64 -isysroot $(xcrun --show-sdk-path) -Wno-error"

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.30 21:04:11