community icon indicating copy to clipboard operation
community copied to clipboard

[BPT] Setting SDKROOT/MACOSX_DEPLOYMENT_TARGET on macOS (APPLE_CLANG)

Open jmarrec opened this issue 4 years ago • 0 comments

Hello, I'm having trouble with bincrafters-package-tools for APPLE_CLANG 10 on Github Actions. I'm getting an error that seem to imply the SDK root and/or Mac OS deployment target or something should be set.

ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib/libSystem.tbd' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

BPT issues xcode-select --switch:

https://github.com/bincrafters/bincrafters-package-tools/blob/dcbcab93cdec66a89b95c0c8b67069a88a7617dc/bincrafters/prepare_env.py#L64-L77

I ended up fixing my problem by doing this

if [[ "${{ matrix.build_name }}" == 'Apple-Clang 10' ]]; then
  echo "MACOSX_DEPLOYMENT_TARGET=10.14" >> $GITHUB_ENV
  echo "SDKROOT=/Applications/Xcode_10.3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" >> $GITHUB_ENV
fi

The configure script of the project I'm trying to build (github.com/ruby/ruby) does recognize the SDKROOT environment variable, so does CMake. I think BPT should go that for mac to avoid issues.

Package and Environment Details (include every applicable attribute)

  • Conan version: conan 1.39.0
  • Python version: Python 3.7.4

Logs (Include/Attach if Applicable)

Here is a run that fails. On the run one it just says the "C Compiler cannot compile executables".

https://github.com/NREL/conan-openstudio-ruby/runs/3348070035?check_suite_focus=true#step:5:1558

But later I cat the configure log from ruby, and I see the ld issue mentioned above: https://github.com/NREL/conan-openstudio-ruby/runs/3348070035?check_suite_focus=true#step:6:178

After setting the SDKROOT, the C compiler can now compile executables: https://github.com/NREL/conan-openstudio-ruby/runs/3348346142?check_suite_focus=true#step:5:1569

jmarrec avatar Aug 23 '21 12:08 jmarrec