Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[package] boost/1.76.0: build fails on MacOS Catalina, clang not found #5569

Closed
jakecobb opened this issue May 19, 2021 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@jakecobb
Copy link
Contributor

jakecobb commented May 19, 2021

Package and Environment Details (include every applicable attribute)

  • Package Name/Version: boost/1.76.0
  • Operating System+version: MacOS Catalina
  • Compiler+version: apple-clang
  • Conan version: conan 1.36.0
  • Python version: Python 3.8.6

Conan profile (output of conan profile show default or conan profile show <profile> if custom profile is in use)

Configuration for profile default:

[settings]
os=Macos
os_build=Macos
arch=x86_64
arch_build=x86_64
compiler=apple-clang
compiler.version=11.0
compiler.libcxx=libc++
build_type=Release
[options]
[build_requires]
[env]

Steps to reproduce (Include if Applicable)

The build generates an invalid user-config.jam file with this line:

using "clang-darwin" :  :   -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -arch x86_64 :
<archiver>"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar" <ranlib>"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib"  ;

Giving an error when it tries to run -isysroot as a command:

warning: toolset clang-darwin initialization:
warning: can not find user-provided command '-isysroot' '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk' '-arch' 'x86_64'

warning: initialized from /Users/jake/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/user-config.jam:5

sh: -y: invalid option
Longer log output
boost/1.76.0: 

WARN: replace_in_file didn't find pattern '/* thread_local */' in '/Users/jake/.conan/data/boost/1.76.0/_/_/source/source_subfolder/boost/stacktrace/detail/libbacktrace_impls.hpp' file.
WARN: replace_in_file didn't find pattern '/* static __thread */' in '/Users/jake/.conan/data/boost/1.76.0/_/_/source/source_subfolder/boost/stacktrace/detail/libbacktrace_impls.hpp' file.
boost/1.76.0: WARN: Patching user-config.jam
boost/1.76.0: WARN: 
using zlib : 1.2.11 : <include>"/Users/jake/.conan/data/zlib/1.2.11/_/_/package/0aa7be2d0914b6f3128105e305c90b9cb0cae86d/include" <search>"/Users/jake/.conan/data/zlib/1.2.11/_/_/package/0aa7be2d0914b6f3128105e305c90b9cb0cae86d/lib" <name>z ;
using bzip2 : 1.0.8 : <include>"/Users/jake/.conan/data/bzip2/1.0.8/_/_/package/e26f883c3e136952d830bcdc838898582f2a8d80/include" <search>"/Users/jake/.conan/data/bzip2/1.0.8/_/_/package/e26f883c3e136952d830bcdc838898582f2a8d80/lib" <name>bz2 ;
using "clang-darwin" :  :   -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacO
SX.platform/Developer/SDKs/MacOSX10.15.sdk -arch x86_64 : 
<archiver>"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar" <ranlib>"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib"  ;
boost/1.76.0: WARN: b2 -q target-os=darwin architecture=x86 address-model=64 binary-format=mach-o abi=sysv --layout=system --user-config=/Users/jake/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/user-config.jam -sNO_ZLIB=0 -sNO_BZIP2=0 -sNO_LZMA=1 -sNO_ZSTD=1 boost.locale.iconv=on boost.locale.icu=off --disable-icu threading=multi visibility=hidden link=shared variant=debug --with-atomic --with-chrono --with-container --with-context --with-contract --with-coroutine --with-date_time --with-exception --with-filesystem --with-iostreams --with-locale --with-log --with-program_options --with-random --with-regex --with-serialization --with-stacktrace --with-system --with-test --with-thread --with-timer --with-type_erasure --with-wave
 toolset=clang-darwin pch=on -sICONV_PATH=/Users/jake/.conan/data/libiconv/1.16/_/_/package/0aa7be2d0914b6f3128105e305c90b9cb0cae86d linkflags="-stdlib=libc++" cxxflags="-fPIC -stdlib=libc++ -DBOOST_STACKTRACE_ADDR2LINE_LOCATION=/usr/bin/addr2line" install --prefix=/Users/jake/.conan/data/boost/1.76.0/_/_/package/919e25258b36635e511e92527cc7d25469a26c9c -j8 --abbreviate-paths -d0 --debug-configuration --build-dir="/Users/jake/.conan/data/boost/1.76.0/_/_/build/919e25258b36635e511e92527cc7d25469a26c9c"
boost/1.76.0: ERROR: Package '919e25258b36635e511e92527cc7d25469a26c9c' build failed
boost/1.76.0: WARN: Build folder /Users/jake/.conan/data/boost/1.76.0/_/_/build/919e25258b36635e511e92527cc7d25469a26c9c
ERROR: boost/1.76.0: Error in build() method, line 774
	self.run(full_command, run_environment=True)
	ConanException: Error 1 while executing DYLD_LIBRARY_PATH="/Users/jake/.conan/data/bzip2/1.0.8/_/_/package/e26f883c3e136952d830bcdc838898582f2a8d80/lib:/Users/jake/.conan/data/zlib/1.2.11/_/_/package/0aa7be2d0
914b6f3128105e305c90b9cb0cae86d/lib:/Users/jake/.conan/data/libiconv/1.16/_/_/package/0aa7be2d0914b6f3128105e305c90b9cb0cae86d/lib" DYLD_FRAMEWORK_PATH="" b2 -q target-os=darwin architecture=x86 address-model=64 binary-format=mach-o abi=sysv --layout=system --user-config=/Users/jake/.conan/data/boost/1.76.0/_/_/source/source_subfolder/tools/build/user-config.jam -sNO_ZLIB=0 -sNO_BZIP2=0 -sNO_LZMA=1 -sNO_ZSTD=1 boost.locale.iconv=on boost.locale.icu=off --disable-icu threading=multi visibility=hidden link=shared variant=debug --with-atomic --with-chrono --with-container --with-context --with-contract --with-coroutine --with-date_time --with-exception --with-filesystem --with-iostreams --with-locale --with-log --with-program_options --with-random --with-regex --with-serialization --with-stacktrace --with-system --with-test --with-thread --with-timer --with-type_erasure --with-wave toolset=clang-darwin pch=on -sICONV_PATH=/Users/jake/.conan/data/libiconv/1.16/_/_/package/0aa7be2d0914b6f3128105e305c90b9cb0cae86d 
linkflags="-stdlib=libc++" cxxflags="-fPIC -stdlib=libc++ -DBOOST_STACKTRACE_ADDR2LINE_LOCATION=/usr/bin/addr2line" install --prefix=/Users/jake/.conan/data/boost/1.76.0/_/_/package/919e25258b36635e511e92527cc7d25469a26c9c -j8 --abbreviate-paths -d0 --debug-configuration --build-dir="/Users/jake/.conan/data/boost/1.76.0/_/_/build/919e25258b36635e511e92527cc7d25469a26c9c"

It seems like the compiler detection here is failing:

    @property
    def _cxx(self):
        if "CXX" in os.environ:
            return os.environ["CXX"]
        if tools.is_apple_os(self.settings.os) and self.settings.compiler == "apple-clang":
            return tools.XCRun(self.settings).cxx

I'm not sure what the internals of XCRun run exactly, but I do find clang this way:

$ xcrun --find clang
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
$ xcrun --find clang++
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
@jakecobb jakecobb added the bug Something isn't working label May 19, 2021
@jakecobb
Copy link
Contributor Author

Sorry, let me look into this more, I may have misinterpreted the output.

@jakecobb jakecobb changed the title [package] boost/1.76.0: build requires b2 but doesn't use it [package] boost/1.76.0: build fails on MacOS Catalina, clang not found May 19, 2021
@jakecobb
Copy link
Contributor Author

Ok, I've updated the title and description. b2 is not the issue, it's a blank compiler command in the user-config.jam file.

@jakecobb jakecobb reopened this May 19, 2021
@jakecobb
Copy link
Contributor Author

I believe this is related to a CMake GUI issue: https://gitlab.kitware.com/cmake/cmake/-/issues/21449

It is setting the CC and CXX environment variables to empty, which means the recipe returns the empty string. It works as expected running cmake from the command line where these variables are not in the environment (typical). The recipe could work around it with:

    @property
    def _cxx(self):
        if os.environ.get("CXX"):
            return os.environ["CXX"]

jakecobb added a commit to jakecobb/conan-center-index that referenced this issue May 21, 2021
Fixes Issue conan-io#5569

A bug in cmake-gui would have it sometimes set CXX to
empty instead of leaving it undefined.  CXX detection
in the boost recipe would use the blank value and fail
to build.  Now we treat empty the same as undefined
and move on to e.g. xcrun detection for these properties.
jakecobb added a commit to jakecobb/conan-center-index that referenced this issue May 25, 2021
Fixes Issue conan-io#5569

A bug in cmake-gui would have it sometimes set CXX to
empty instead of leaving it undefined.  CXX detection
in the boost recipe would use the blank value and fail
to build.  Now we treat empty the same as undefined
and move on to e.g. xcrun detection for these properties.
conan-center-bot pushed a commit that referenced this issue May 26, 2021
Fixes Issue #5569

A bug in cmake-gui would have it sometimes set CXX to
empty instead of leaving it undefined.  CXX detection
in the boost recipe would use the blank value and fail
to build.  Now we treat empty the same as undefined
and move on to e.g. xcrun detection for these properties.
madebr pushed a commit to madebr/conan-center-index that referenced this issue Jun 21, 2021
Fixes Issue conan-io#5569

A bug in cmake-gui would have it sometimes set CXX to
empty instead of leaving it undefined.  CXX detection
in the boost recipe would use the blank value and fail
to build.  Now we treat empty the same as undefined
and move on to e.g. xcrun detection for these properties.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant