conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.27k stars 981 forks source link

[bug] Compile Error for fmt/9.1.0 #13332

Closed CaiJingLong closed 1 year ago

CaiJingLong commented 1 year ago

Environment details

Xcode c++ version

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ --version
Apple clang version 14.0.0 (clang-1400.0.29.102)
Target: x86_64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Steps to reproduce

I Just create a example conanfile.py

from conan import ConanFile
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout
from conan.tools.scm import Git
from conan.tools.build import check_min_cppstd

class helloRecipe(ConanFile):
    name = "hellofmt"
    version = "1.0"

    # Optional metadata
    license = "<Put the package license here>"
    author = "<Put your name here> <And your email here>"
    url = "<Package recipe repository url here, for issues about the package>"
    description = "<Description of hello package here>"
    topics = ("<Put some tag here>", "<here>", "<and here>")

    # Binary configuration
    settings = "os", "compiler", "build_type", "arch"
    options = {"shared": [True, False], "fPIC": [True, False]}
    default_options = {"shared": False, "fPIC": True}

    generators = "CMakeDeps"

    def validate(self):
        check_min_cppstd(self, "11")

    def source(self):
        git = Git(self)
        git.clone(url="https://github.com/conan-io/libhello.git", target=".")
        # Please, be aware that using the head of the branch instead of an immutable tag
        # or commit is not a good practice in general
        git.checkout("require_fmt")

    def requirements(self):
        self.requires("fmt/9.1.0")

    def config_options(self):
        if self.settings.os == "Windows":
            del self.options.fPIC

    def layout(self):
        cmake_layout(self)

    def generate(self):
        tc = CMakeToolchain(self)
        tc.generate()

    def build(self):
        cmake = CMake(self)
        cmake.configure()
        cmake.build()

    def package(self):
        cmake = CMake(self)
        cmake.install()

    def package_info(self):
        self.cpp_info.libs = ["hellofmt"]

profile

[settings]
arch=x86_64
build_type=Release
compiler=clang
compiler.cppstd=gnu14
compiler.libcxx=libstdc++11
compiler.version=15
os=Macos

Run the command conan create . --version 9.1.0 --build=missing -vvv

And I just copy https://github.com/conan-io/conan-center-index/tree/master/recipes/fmt/all to my local and run conan create . --version 9.1.0 --build=missing -vvv happen same error

Logs

main error log: ld: library not found for -lstdc++

console log ``` ======== Exporting recipe to the cache ======== hellofmt/1.0: Exporting package recipe: /Users/jinglongcai/code/c/conan2/conan-study-projects/010-add-deps/2-official-website-example/conanfile.py hellofmt/1.0: Copied 1 '.py' file: conanfile.py hellofmt/1.0: Exported to cache folder: /Users/jinglongcai/.conan2/p/hello4f7e8e9779bd5/e hellofmt/1.0: Exported: hellofmt/1.0#8eed8cb5f9bebe8c8828406f2a3e5ce6 (2023-03-06 02:01:06 UTC) ======== Input profiles ======== Profile host: [settings] arch=x86_64 build_type=Release compiler=clang compiler.cppstd=gnu11 compiler.libcxx=libstdc++11 compiler.version=15 os=Macos Profile build: [settings] arch=x86_64 build_type=Release compiler=clang compiler.cppstd=gnu11 compiler.libcxx=libstdc++11 compiler.version=15 os=Macos ======== Computing dependency graph ======== Graph root cli Requirements fmt/9.1.0#6708c9d84f98d56a6d9f2e6c2d5639ba - Cache hellofmt/1.0#8eed8cb5f9bebe8c8828406f2a3e5ce6 - Cache ======== Computing necessary packages ======== => _action: REST_API_CALL, method: GET, url: https://center.conan.io/v1/ping, duration: 5.556649923324585, headers: {'X-Client-Anonymous-Id': '**********', 'X-Client-Id': '', 'User-Agent': 'Conan/2.0.0 (Darwin 21.6.0; Python 3.11.2; x86_64)'} => _action: REST_API_CALL, method: GET, url: https://center.conan.io/v2/conans/fmt/9.1.0/_/_/revisions/6708c9d84f98d56a6d9f2e6c2d5639ba/packages/3f0d131d59543ec07381540e7e1b6a64052bd2b3/latest, duration: 0.31484436988830566, headers: {'X-Client-Anonymous-Id': '**********', 'X-Client-Id': '', 'User-Agent': 'Conan/2.0.0 (Darwin 21.6.0; Python 3.11.2; x86_64)', 'Conan-PkgID-Settings': 'arch=x86_64;build_type=Release;compiler=clang;compiler.cppstd=gnu11;compiler.libcxx=libstdc++11;compiler.version=15;os=Macos', 'Conan-PkgID-Options': 'fPIC=True;header_only=False;shared=False'} fmt/9.1.0: Checking 9 compatible configurations: fmt/9.1.0: 'bc2cd352a8e96491d21f2600fdb70343efcebca8': compiler.cppstd=11 => _action: REST_API_CALL, method: GET, url: https://center.conan.io/v2/conans/fmt/9.1.0/_/_/revisions/6708c9d84f98d56a6d9f2e6c2d5639ba/packages/bc2cd352a8e96491d21f2600fdb70343efcebca8/latest, duration: 0.5534172058105469, headers: {'X-Client-Anonymous-Id': '**********', 'X-Client-Id': '', 'Conan-PkgID-Settings': 'arch=x86_64;build_type=Release;compiler=clang;compiler.cppstd=gnu11;compiler.libcxx=libstdc++11;compiler.version=15;os=Macos', 'Conan-PkgID-Options': 'fPIC=True;header_only=False;shared=False', 'User-Agent': 'Conan/2.0.0 (Darwin 21.6.0; Python 3.11.2; x86_64)'} fmt/9.1.0: '667d4cf1daa2dc5ce49928f65bd714dc5de75ef7': compiler.cppstd=14 => _action: REST_API_CALL, method: GET, url: https://center.conan.io/v2/conans/fmt/9.1.0/_/_/revisions/6708c9d84f98d56a6d9f2e6c2d5639ba/packages/667d4cf1daa2dc5ce49928f65bd714dc5de75ef7/latest, duration: 0.574235200881958, headers: {'X-Client-Anonymous-Id': '**********', 'X-Client-Id': '', 'Conan-PkgID-Settings': 'arch=x86_64;build_type=Release;compiler=clang;compiler.cppstd=gnu11;compiler.libcxx=libstdc++11;compiler.version=15;os=Macos', 'Conan-PkgID-Options': 'fPIC=True;header_only=False;shared=False', 'User-Agent': 'Conan/2.0.0 (Darwin 21.6.0; Python 3.11.2; x86_64)'} fmt/9.1.0: 'ae7bea5c510d7c5a16409827c2a363526ba9e7ca': compiler.cppstd=gnu14 => _action: REST_API_CALL, method: GET, url: https://center.conan.io/v2/conans/fmt/9.1.0/_/_/revisions/6708c9d84f98d56a6d9f2e6c2d5639ba/packages/ae7bea5c510d7c5a16409827c2a363526ba9e7ca/latest, duration: 0.3066272735595703, headers: {'X-Client-Anonymous-Id': '**********', 'X-Client-Id': '', 'Conan-PkgID-Settings': 'arch=x86_64;build_type=Release;compiler=clang;compiler.cppstd=gnu11;compiler.libcxx=libstdc++11;compiler.version=15;os=Macos', 'Conan-PkgID-Options': 'fPIC=True;header_only=False;shared=False', 'User-Agent': 'Conan/2.0.0 (Darwin 21.6.0; Python 3.11.2; x86_64)'} fmt/9.1.0: 'f9ff1a561bbe80185d09deadc14309a0da1f3f00': compiler.cppstd=17 => _action: REST_API_CALL, method: GET, url: https://center.conan.io/v2/conans/fmt/9.1.0/_/_/revisions/6708c9d84f98d56a6d9f2e6c2d5639ba/packages/f9ff1a561bbe80185d09deadc14309a0da1f3f00/latest, duration: 0.2942311763763428, headers: {'X-Client-Anonymous-Id': '**********', 'X-Client-Id': '', 'Conan-PkgID-Settings': 'arch=x86_64;build_type=Release;compiler=clang;compiler.cppstd=gnu11;compiler.libcxx=libstdc++11;compiler.version=15;os=Macos', 'Conan-PkgID-Options': 'fPIC=True;header_only=False;shared=False', 'User-Agent': 'Conan/2.0.0 (Darwin 21.6.0; Python 3.11.2; x86_64)'} fmt/9.1.0: '1842e6b5c82672258c6e35a1155b0f777c691d0c': compiler.cppstd=gnu17 => _action: REST_API_CALL, method: GET, url: https://center.conan.io/v2/conans/fmt/9.1.0/_/_/revisions/6708c9d84f98d56a6d9f2e6c2d5639ba/packages/1842e6b5c82672258c6e35a1155b0f777c691d0c/latest, duration: 0.5515809059143066, headers: {'X-Client-Anonymous-Id': '**********', 'X-Client-Id': '', 'Conan-PkgID-Settings': 'arch=x86_64;build_type=Release;compiler=clang;compiler.cppstd=gnu11;compiler.libcxx=libstdc++11;compiler.version=15;os=Macos', 'Conan-PkgID-Options': 'fPIC=True;header_only=False;shared=False', 'User-Agent': 'Conan/2.0.0 (Darwin 21.6.0; Python 3.11.2; x86_64)'} fmt/9.1.0: 'ac26db5a038b476e777c1479b34f0b3b7794f2f5': compiler.cppstd=20 => _action: REST_API_CALL, method: GET, url: https://center.conan.io/v2/conans/fmt/9.1.0/_/_/revisions/6708c9d84f98d56a6d9f2e6c2d5639ba/packages/ac26db5a038b476e777c1479b34f0b3b7794f2f5/latest, duration: 0.5710160732269287, headers: {'X-Client-Anonymous-Id': '**********', 'X-Client-Id': '', 'Conan-PkgID-Settings': 'arch=x86_64;build_type=Release;compiler=clang;compiler.cppstd=gnu11;compiler.libcxx=libstdc++11;compiler.version=15;os=Macos', 'Conan-PkgID-Options': 'fPIC=True;header_only=False;shared=False', 'User-Agent': 'Conan/2.0.0 (Darwin 21.6.0; Python 3.11.2; x86_64)'} fmt/9.1.0: 'b51969eda5a6c3f60c7243daaa0291e437b9224b': compiler.cppstd=gnu20 => _action: REST_API_CALL, method: GET, url: https://center.conan.io/v2/conans/fmt/9.1.0/_/_/revisions/6708c9d84f98d56a6d9f2e6c2d5639ba/packages/b51969eda5a6c3f60c7243daaa0291e437b9224b/latest, duration: 0.5415220260620117, headers: {'X-Client-Anonymous-Id': '**********', 'X-Client-Id': '', 'Conan-PkgID-Settings': 'arch=x86_64;build_type=Release;compiler=clang;compiler.cppstd=gnu11;compiler.libcxx=libstdc++11;compiler.version=15;os=Macos', 'Conan-PkgID-Options': 'fPIC=True;header_only=False;shared=False', 'User-Agent': 'Conan/2.0.0 (Darwin 21.6.0; Python 3.11.2; x86_64)'} fmt/9.1.0: '9f50d5af89c05b30ab654cc8d66d1c5601f20a66': compiler.cppstd=23 => _action: REST_API_CALL, method: GET, url: https://center.conan.io/v2/conans/fmt/9.1.0/_/_/revisions/6708c9d84f98d56a6d9f2e6c2d5639ba/packages/9f50d5af89c05b30ab654cc8d66d1c5601f20a66/latest, duration: 0.542870044708252, headers: {'X-Client-Anonymous-Id': '**********', 'X-Client-Id': '', 'Conan-PkgID-Settings': 'arch=x86_64;build_type=Release;compiler=clang;compiler.cppstd=gnu11;compiler.libcxx=libstdc++11;compiler.version=15;os=Macos', 'Conan-PkgID-Options': 'fPIC=True;header_only=False;shared=False', 'User-Agent': 'Conan/2.0.0 (Darwin 21.6.0; Python 3.11.2; x86_64)'} fmt/9.1.0: '064d709629d1b12583b4d2cfe2307e91433a954d': compiler.cppstd=gnu23 => _action: REST_API_CALL, method: GET, url: https://center.conan.io/v2/conans/fmt/9.1.0/_/_/revisions/6708c9d84f98d56a6d9f2e6c2d5639ba/packages/064d709629d1b12583b4d2cfe2307e91433a954d/latest, duration: 0.5433778762817383, headers: {'X-Client-Anonymous-Id': '**********', 'X-Client-Id': '', 'Conan-PkgID-Settings': 'arch=x86_64;build_type=Release;compiler=clang;compiler.cppstd=gnu11;compiler.libcxx=libstdc++11;compiler.version=15;os=Macos', 'Conan-PkgID-Options': 'fPIC=True;header_only=False;shared=False', 'User-Agent': 'Conan/2.0.0 (Darwin 21.6.0; Python 3.11.2; x86_64)'} => _action: REST_API_CALL, method: GET, url: https://center.conan.io/v2/conans/hellofmt/1.0/_/_/revisions/8eed8cb5f9bebe8c8828406f2a3e5ce6/packages/d46785d34d8cb862dc875832a873c875730a6e40/latest, duration: 0.5454099178314209, headers: {'X-Client-Anonymous-Id': '**********', 'X-Client-Id': '', 'Conan-PkgID-Settings': 'arch=x86_64;build_type=Release;compiler=clang;compiler.cppstd=gnu11;compiler.libcxx=libstdc++11;compiler.version=15;os=Macos', 'Conan-PkgID-Options': 'fPIC=True;shared=False', 'User-Agent': 'Conan/2.0.0 (Darwin 21.6.0; Python 3.11.2; x86_64)'} hellofmt/1.0: Checking 9 compatible configurations: hellofmt/1.0: 'cd13cb65382c1d64f3eed223c47a8b2791a9eab6': compiler.cppstd=11 => _action: REST_API_CALL, method: GET, url: https://center.conan.io/v2/conans/hellofmt/1.0/_/_/revisions/8eed8cb5f9bebe8c8828406f2a3e5ce6/packages/cd13cb65382c1d64f3eed223c47a8b2791a9eab6/latest, duration: 0.5855112075805664, headers: {'X-Client-Anonymous-Id': '**********', 'X-Client-Id': '', 'Conan-PkgID-Settings': 'arch=x86_64;build_type=Release;compiler=clang;compiler.cppstd=gnu11;compiler.libcxx=libstdc++11;compiler.version=15;os=Macos', 'Conan-PkgID-Options': 'fPIC=True;shared=False', 'User-Agent': 'Conan/2.0.0 (Darwin 21.6.0; Python 3.11.2; x86_64)'} hellofmt/1.0: 'cf0e932cba3e94d1c5223f63019fde1cefdaee1d': compiler.cppstd=14 => _action: REST_API_CALL, method: GET, url: https://center.conan.io/v2/conans/hellofmt/1.0/_/_/revisions/8eed8cb5f9bebe8c8828406f2a3e5ce6/packages/cf0e932cba3e94d1c5223f63019fde1cefdaee1d/latest, duration: 0.32322096824645996, headers: {'X-Client-Anonymous-Id': '**********', 'X-Client-Id': '', 'Conan-PkgID-Settings': 'arch=x86_64;build_type=Release;compiler=clang;compiler.cppstd=gnu11;compiler.libcxx=libstdc++11;compiler.version=15;os=Macos', 'Conan-PkgID-Options': 'fPIC=True;shared=False', 'User-Agent': 'Conan/2.0.0 (Darwin 21.6.0; Python 3.11.2; x86_64)'} hellofmt/1.0: '3d55c1e6a7608f61b173213f35ab6b5a0241d6ff': compiler.cppstd=gnu14 => _action: REST_API_CALL, method: GET, url: https://center.conan.io/v2/conans/hellofmt/1.0/_/_/revisions/8eed8cb5f9bebe8c8828406f2a3e5ce6/packages/3d55c1e6a7608f61b173213f35ab6b5a0241d6ff/latest, duration: 5.54298996925354, headers: {'X-Client-Anonymous-Id': '**********', 'X-Client-Id': '', 'Conan-PkgID-Settings': 'arch=x86_64;build_type=Release;compiler=clang;compiler.cppstd=gnu11;compiler.libcxx=libstdc++11;compiler.version=15;os=Macos', 'Conan-PkgID-Options': 'fPIC=True;shared=False', 'User-Agent': 'Conan/2.0.0 (Darwin 21.6.0; Python 3.11.2; x86_64)'} hellofmt/1.0: '01541b61b1ee4633f6c9396a556adaa19ea06f8e': compiler.cppstd=17 => _action: REST_API_CALL, method: GET, url: https://center.conan.io/v2/conans/hellofmt/1.0/_/_/revisions/8eed8cb5f9bebe8c8828406f2a3e5ce6/packages/01541b61b1ee4633f6c9396a556adaa19ea06f8e/latest, duration: 0.5588188171386719, headers: {'X-Client-Anonymous-Id': '**********', 'X-Client-Id': '', 'Conan-PkgID-Settings': 'arch=x86_64;build_type=Release;compiler=clang;compiler.cppstd=gnu11;compiler.libcxx=libstdc++11;compiler.version=15;os=Macos', 'Conan-PkgID-Options': 'fPIC=True;shared=False', 'User-Agent': 'Conan/2.0.0 (Darwin 21.6.0; Python 3.11.2; x86_64)'} hellofmt/1.0: 'f6eaf016c44ac2eab03f1a1e57fb2543c84121d4': compiler.cppstd=gnu17 => _action: REST_API_CALL, method: GET, url: https://center.conan.io/v2/conans/hellofmt/1.0/_/_/revisions/8eed8cb5f9bebe8c8828406f2a3e5ce6/packages/f6eaf016c44ac2eab03f1a1e57fb2543c84121d4/latest, duration: 0.5270299911499023, headers: {'X-Client-Anonymous-Id': '**********', 'X-Client-Id': '', 'Conan-PkgID-Settings': 'arch=x86_64;build_type=Release;compiler=clang;compiler.cppstd=gnu11;compiler.libcxx=libstdc++11;compiler.version=15;os=Macos', 'Conan-PkgID-Options': 'fPIC=True;shared=False', 'User-Agent': 'Conan/2.0.0 (Darwin 21.6.0; Python 3.11.2; x86_64)'} hellofmt/1.0: '021ca333fb0809190f6186c7268341b9310b4d20': compiler.cppstd=20 => _action: REST_API_CALL, method: GET, url: https://center.conan.io/v2/conans/hellofmt/1.0/_/_/revisions/8eed8cb5f9bebe8c8828406f2a3e5ce6/packages/021ca333fb0809190f6186c7268341b9310b4d20/latest, duration: 0.5683619976043701, headers: {'X-Client-Anonymous-Id': '**********', 'X-Client-Id': '', 'Conan-PkgID-Settings': 'arch=x86_64;build_type=Release;compiler=clang;compiler.cppstd=gnu11;compiler.libcxx=libstdc++11;compiler.version=15;os=Macos', 'Conan-PkgID-Options': 'fPIC=True;shared=False', 'User-Agent': 'Conan/2.0.0 (Darwin 21.6.0; Python 3.11.2; x86_64)'} hellofmt/1.0: '770f9def01ee923637f6da89311adf2378ca8bd9': compiler.cppstd=gnu20 => _action: REST_API_CALL, method: GET, url: https://center.conan.io/v2/conans/hellofmt/1.0/_/_/revisions/8eed8cb5f9bebe8c8828406f2a3e5ce6/packages/770f9def01ee923637f6da89311adf2378ca8bd9/latest, duration: 0.572141170501709, headers: {'X-Client-Anonymous-Id': '**********', 'X-Client-Id': '', 'Conan-PkgID-Settings': 'arch=x86_64;build_type=Release;compiler=clang;compiler.cppstd=gnu11;compiler.libcxx=libstdc++11;compiler.version=15;os=Macos', 'Conan-PkgID-Options': 'fPIC=True;shared=False', 'User-Agent': 'Conan/2.0.0 (Darwin 21.6.0; Python 3.11.2; x86_64)'} hellofmt/1.0: '43b2ff6990a8fdf813fb0bfed2e223c7285855e0': compiler.cppstd=23 => _action: REST_API_CALL, method: GET, url: https://center.conan.io/v2/conans/hellofmt/1.0/_/_/revisions/8eed8cb5f9bebe8c8828406f2a3e5ce6/packages/43b2ff6990a8fdf813fb0bfed2e223c7285855e0/latest, duration: 0.6014111042022705, headers: {'X-Client-Anonymous-Id': '**********', 'X-Client-Id': '', 'Conan-PkgID-Settings': 'arch=x86_64;build_type=Release;compiler=clang;compiler.cppstd=gnu11;compiler.libcxx=libstdc++11;compiler.version=15;os=Macos', 'Conan-PkgID-Options': 'fPIC=True;shared=False', 'User-Agent': 'Conan/2.0.0 (Darwin 21.6.0; Python 3.11.2; x86_64)'} hellofmt/1.0: 'b410b6d447bdb00b42876884055e2602b9a41eb4': compiler.cppstd=gnu23 => _action: REST_API_CALL, method: GET, url: https://center.conan.io/v2/conans/hellofmt/1.0/_/_/revisions/8eed8cb5f9bebe8c8828406f2a3e5ce6/packages/b410b6d447bdb00b42876884055e2602b9a41eb4/latest, duration: 1.1124520301818848, headers: {'X-Client-Anonymous-Id': '**********', 'X-Client-Id': '', 'Conan-PkgID-Settings': 'arch=x86_64;build_type=Release;compiler=clang;compiler.cppstd=gnu11;compiler.libcxx=libstdc++11;compiler.version=15;os=Macos', 'Conan-PkgID-Options': 'fPIC=True;shared=False', 'User-Agent': 'Conan/2.0.0 (Darwin 21.6.0; Python 3.11.2; x86_64)'} Requirements fmt/9.1.0#6708c9d84f98d56a6d9f2e6c2d5639ba:3f0d131d59543ec07381540e7e1b6a64052bd2b3 - Build hellofmt/1.0#8eed8cb5f9bebe8c8828406f2a3e5ce6:d46785d34d8cb862dc875832a873c875730a6e40 - Build ======== Installing packages ======== -------- Building package fmt/9.1.0 from source (1 of 2) -------- fmt/9.1.0: Package fmt/9.1.0:3f0d131d59543ec07381540e7e1b6a64052bd2b3 fmt/9.1.0: Copying sources to build folder fmt/9.1.0: Building your package in /Users/jinglongcai/.conan2/p/t/fmt2aa8180d2f364/b fmt/9.1.0: Calling generate() fmt/9.1.0: Generators folder: /Users/jinglongcai/.conan2/p/t/fmt2aa8180d2f364/b/build/Release/generators fmt/9.1.0: CMakeToolchain generated: conan_toolchain.cmake fmt/9.1.0: CMakeToolchain generated: CMakePresets.json fmt/9.1.0: CMakeToolchain generated: ../../../src/CMakeUserPresets.json fmt/9.1.0: Generating aggregated env files fmt/9.1.0: Generated aggregated env files: ['conanbuild.sh', 'conanrun.sh'] fmt/9.1.0: Calling build() fmt/9.1.0: Running CMake.configure() fmt/9.1.0: RUN: cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="/Users/jinglongcai/.conan2/p/t/fmt2aa8180d2f364/b/build/Release/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/Users/jinglongcai/.conan2/p/t/fmt2aa8180d2f364/p" -DFMT_DOC="OFF" -DFMT_TEST="OFF" -DFMT_INSTALL="ON" -DFMT_LIB_DIR="lib" -DFMT_OS="ON" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "/Users/jinglongcai/.conan2/p/t/fmt2aa8180d2f364/b/src" -- CMake version: 3.25.2 -- Using Conan toolchain: /Users/jinglongcai/.conan2/p/t/fmt2aa8180d2f364/b/build/Release/generators/conan_toolchain.cmake -- Conan toolchain: Setting CMAKE_POSITION_INDEPENDENT_CODE=ON (options.fPIC) -- Conan toolchain: C++ Standard 11 with extensions ON -- Conan toolchain: Setting BUILD_SHARED_LIBS = OFF -- The CXX compiler identification is AppleClang 14.0.0.14000029 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - failed -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - broken CMake Error at /usr/local/Cellar/cmake/3.25.2/share/cmake/Modules/CMakeTestCXXCompiler.cmake:63 (message): The C++ compiler "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++" is not able to compile a simple test program. It fails with the following output: Change Dir: /Users/jinglongcai/.conan2/p/t/fmt2aa8180d2f364/b/build/Release/CMakeFiles/CMakeScratch/TryCompile-XVMBOf Run Build Command(s):/usr/bin/make -f Makefile cmTC_ea4f4/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_ea4f4.dir/build.make CMakeFiles/cmTC_ea4f4.dir/build Building CXX object CMakeFiles/cmTC_ea4f4.dir/testCXXCompiler.cxx.o /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -m64 -stdlib=libstdc++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -fPIE -std=gnu++11 -MD -MT CMakeFiles/cmTC_ea4f4.dir/testCXXCompiler.cxx.o -MF CMakeFiles/cmTC_ea4f4.dir/testCXXCompiler.cxx.o.d -o CMakeFiles/cmTC_ea4f4.dir/testCXXCompiler.cxx.o -c /Users/jinglongcai/.conan2/p/t/fmt2aa8180d2f364/b/build/Release/CMakeFiles/CMakeScratch/TryCompile-XVMBOf/testCXXCompiler.cxx clang: warning: include path for libstdc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found] Linking CXX executable cmTC_ea4f4 /usr/local/Cellar/cmake/3.25.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_ea4f4.dir/link.txt --verbose=1 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -m64 -stdlib=libstdc++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names -m64 CMakeFiles/cmTC_ea4f4.dir/testCXXCompiler.cxx.o -o cmTC_ea4f4 clang: warning: libstdc++ is deprecated; move to libc++ [-Wdeprecated] ld: library not found for -lstdc++ clang: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: *** [cmTC_ea4f4] Error 1 make: *** [cmTC_ea4f4/fast] Error 2 CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:66 (project) -- Configuring incomplete, errors occurred! See also "/Users/jinglongcai/.conan2/p/t/fmt2aa8180d2f364/b/build/Release/CMakeFiles/CMakeOutput.log". See also "/Users/jinglongcai/.conan2/p/t/fmt2aa8180d2f364/b/build/Release/CMakeFiles/CMakeError.log". fmt/9.1.0: ERROR: Package '3f0d131d59543ec07381540e7e1b6a64052bd2b3' build failed fmt/9.1.0: WARN: Build folder /Users/jinglongcai/.conan2/p/t/fmt2aa8180d2f364/b/build/Release ********************************************************* Recipe 'fmt/9.1.0' cannot build its binary It is possible that this recipe is not Conan 2.0 ready If the recipe comes from ConanCenter check: https://conan.io/cci-v2.html If it is your recipe, check it is updated to 2.0 ********************************************************* ERROR: fmt/9.1.0: Error in build() method, line 93 cmake.configure() ConanException: Error 1 while executing ```
CMakeError.log ```log Detecting CXX compiler ABI info failed to compile with the following output: Change Dir: /Users/jinglongcai/.conan2/p/t/fmt2aa8180d2f364/b/build/Release/CMakeFiles/CMakeScratch/TryCompile-6XX8Ep Run Build Command(s):/usr/bin/make -f Makefile cmTC_90b95/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_90b95.dir/build.make CMakeFiles/cmTC_90b95.dir/build Building CXX object CMakeFiles/cmTC_90b95.dir/CMakeCXXCompilerABI.cpp.o /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -m64 -stdlib=libstdc++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -fPIE -v -Wl,-v -std=gnu++11 -MD -MT CMakeFiles/cmTC_90b95.dir/CMakeCXXCompilerABI.cpp.o -MF CMakeFiles/cmTC_90b95.dir/CMakeCXXCompilerABI.cpp.o.d -o CMakeFiles/cmTC_90b95.dir/CMakeCXXCompilerABI.cpp.o -c /usr/local/Cellar/cmake/3.25.2/share/cmake/Modules/CMakeCXXCompilerABI.cpp Apple clang version 14.0.0 (clang-1400.0.29.102) Target: x86_64-apple-darwin21.6.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin clang: warning: -Wl,-v: 'linker' input unused [-Wunused-command-line-argument] clang: warning: include path for libstdc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found] "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx12.0.0 -Wundef-prefix=TARGET_OS_ -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name CMakeCXXCompilerABI.cpp -mrelocation-model pic -pic-level 2 -mframe-pointer=all -fno-strict-return -fno-rounding-math -funwind-tables=2 -target-sdk-version=12.3 -fvisibility-inlines-hidden-static-local-var -target-cpu penryn -tune-cpu generic -debugger-tuning=lldb -target-linker-version 819.6 -v -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0 -dependency-file CMakeFiles/cmTC_90b95.dir/CMakeCXXCompilerABI.cpp.o.d -skip-unused-modulemap-deps -MT CMakeFiles/cmTC_90b95.dir/CMakeCXXCompilerABI.cpp.o -sys-header-deps -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -stdlib=libstdc++ -internal-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/4.2.1 -internal-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64 -internal-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/4.2.1/backward -internal-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/4.0.0 -internal-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/4.0.0/i686-apple-darwin8 -internal-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/4.0.0/backward -internal-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/local/include -internal-isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include -internal-externc-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include -internal-externc-isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-final-dtor-non-final-class -Wno-extra-semi-stmt -Wno-misleading-indentation -Wno-quoted-include-in-framework-header -Wno-implicit-fallthrough -Wno-enum-enum-conversion -Wno-enum-float-conversion -Wno-elaborated-enum-base -Wno-reserved-identifier -Wno-gnu-folding-constant -Wno-cast-function-type -Wno-bitwise-instead-of-logical -std=gnu++11 -fdeprecated-macro -fdebug-compilation-dir=/Users/jinglongcai/.conan2/p/t/fmt2aa8180d2f364/b/build/Release/CMakeFiles/CMakeScratch/TryCompile-6XX8Ep -ferror-limit 19 -stack-protector 1 -fstack-check -mdarwin-stkchk-strong-link -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fno-cxx-modules -fcxx-exceptions -fexceptions -fmax-type-align=16 -fcommon -clang-vendor-feature=+messageToSelfInClassMethodIdReturnType -clang-vendor-feature=+disableInferNewAvailabilityFromInit -clang-vendor-feature=+disableNonDependentMemberExprInCurrentInstantiation -fno-odr-hash-protocols -clang-vendor-feature=+enableAggressiveVLAFolding -clang-vendor-feature=+revert09abecef7bbf -clang-vendor-feature=+thisNoAlignAttr -clang-vendor-feature=+thisNoNullAttr -mllvm -disable-aligned-alloc-awareness=1 -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o CMakeFiles/cmTC_90b95.dir/CMakeCXXCompilerABI.cpp.o -x c++ /usr/local/Cellar/cmake/3.25.2/share/cmake/Modules/CMakeCXXCompilerABI.cpp clang -cc1 version 14.0.0 (clang-1400.0.29.102) default target x86_64-apple-darwin21.6.0 ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/4.2.1" ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64" ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/4.2.1/backward" ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/4.0.0" ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/4.0.0/i686-apple-darwin8" ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/4.0.0/backward" ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/local/include" ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/Library/Frameworks" #include "..." search starts here: #include <...> search starts here: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks (framework directory) End of search list. Linking CXX executable cmTC_90b95 /usr/local/Cellar/cmake/3.25.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_90b95.dir/link.txt --verbose=1 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -m64 -stdlib=libstdc++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names -m64 -v -Wl,-v CMakeFiles/cmTC_90b95.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_90b95 Apple clang version 14.0.0 (clang-1400.0.29.102) Target: x86_64-apple-darwin21.6.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin clang: warning: libstdc++ is deprecated; move to libc++ [-Wdeprecated] "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -arch x86_64 -platform_version macos 12.0.0 12.3 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -o cmTC_90b95 -search_paths_first -headerpad_max_install_names -v CMakeFiles/cmTC_90b95.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/lib/darwin/libclang_rt.osx.a @(#)PROGRAM:ld PROJECT:ld64-819.6 BUILD 14:58:37 Aug 5 2022 configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em Library search paths: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/lib Framework search paths: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/ ld: library not found for -lstdc++ clang: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: *** [cmTC_90b95] Error 1 make: *** [cmTC_90b95/fast] Error 2 Determining if the C++ compiler works failed with the following output: Change Dir: /Users/jinglongcai/.conan2/p/t/fmt2aa8180d2f364/b/build/Release/CMakeFiles/CMakeScratch/TryCompile-yPCxYC Run Build Command(s):/usr/bin/make -f Makefile cmTC_28afd/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_28afd.dir/build.make CMakeFiles/cmTC_28afd.dir/build Building CXX object CMakeFiles/cmTC_28afd.dir/testCXXCompiler.cxx.o /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -m64 -stdlib=libstdc++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -fPIE -std=gnu++11 -MD -MT CMakeFiles/cmTC_28afd.dir/testCXXCompiler.cxx.o -MF CMakeFiles/cmTC_28afd.dir/testCXXCompiler.cxx.o.d -o CMakeFiles/cmTC_28afd.dir/testCXXCompiler.cxx.o -c /Users/jinglongcai/.conan2/p/t/fmt2aa8180d2f364/b/build/Release/CMakeFiles/CMakeScratch/TryCompile-yPCxYC/testCXXCompiler.cxx clang: warning: include path for libstdc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found] Linking CXX executable cmTC_28afd /usr/local/Cellar/cmake/3.25.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_28afd.dir/link.txt --verbose=1 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -m64 -stdlib=libstdc++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names -m64 CMakeFiles/cmTC_28afd.dir/testCXXCompiler.cxx.o -o cmTC_28afd clang: warning: libstdc++ is deprecated; move to libc++ [-Wdeprecated] ld: library not found for -lstdc++ clang: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: *** [cmTC_28afd] Error 1 make: *** [cmTC_28afd/fast] Error 2 ```
CaiJingLong commented 1 year ago

No problem with same compile command in debian.

memsharded commented 1 year ago

Hi @CaiJingLong

Thanks for your report. Quick question: you sure you want to use the clang compiler in OSX, and not the default and recommended one apple-clang? All packages in ConanCenter are built and tested with apple-clang, it might be possible that there could be issues with that clang compiler. In case it is clang if you can report a bit how it was setup, that also helps. Also if you can try with apple-clang and report if it works or not. Thanks.

CaiJingLong commented 1 year ago

I know why happen the problem.

I created the default profile with conan profile detect --force.

Next, I open the default profile:

[settings]
arch=x86_64
build_type=Release
compiler=clang
compiler.cppstd=gnu14
compiler.libcxx=libstdc++11
compiler.version=15
os=Macos

My problem is stdc++ cannot be found, so I need change the compiler.libcxx.

-- compiler.libcxx=libstdc++11
++ compiler.libcxx=libc++

And, I build success.

Therefore, if possible, the guess of Conan's automatic profile generation may need to be modified, which is very unfriendly to Conan's beginners.

memsharded commented 1 year ago

Quick question: your conan profile detect in Conan 2.0 detects clang instead of apple-clang? Do you have installed xcode and standard dev tools in your OSX machine, or not? Maybe you just installed clang and not xcode?

The default from conan profile detect could be changed if it makes sense, re-opening to check it.

CaiJingLong commented 1 year ago

I installed XCode before conan, I'm a mobile developer.

I don't know whether the conan create command calls apple-clang or clang in the default profile.

Remove the old default profile withrm $(conan profile path default). Run theconan profile detect, and cat $(conan profile path default):

[settings]
arch=x86_64
build_type=Release
compiler=clang
compiler.cppstd=gnu14
compiler.libcxx=libstdc++11
compiler.version=15
os=Macos
CaiJingLong commented 1 year ago

When the default profile, error log have next part:

-- The CXX compiler identification is AppleClang 14.0.0.14000029

....

The C++ compiler
    "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++"
memsharded commented 1 year ago

Thanks for the feedback @CaiJingLong

This is quite unexpected, that you run conan profile detect in a machine with Xcode (and I assume xcode comes with the c++ compilers?) and it detects clang compiler instead. It might be possible if only the AndroidNDK is installed in the machine, because Android uses clang, but otherwise it is surprising. But as you commented, The CXX compiler identification is AppleClang 14.0.0.14000029 shows that there is a valid CXX compiler there, so not sure why the conan profile detect will not define it.

If you could run conan profile detect --force and share the output here, that might give some hints.

CaiJingLong commented 1 year ago
$ conan profile detect --force -vvv

Found clang 15.0
clang>=8, using the major as version
gcc C++ standard library: libstdc++11
Detected profile:
[settings]
arch=x86_64
build_type=Release
compiler=clang
compiler.cppstd=gnu14
compiler.libcxx=libstdc++11
compiler.version=15
os=Macos

WARN: This profile is a guess of your environment, please check it.
WARN: Defaulted to cppstd='gnu17' for apple-clang.
WARN: The output of this command is not guaranteed to be stable and can change in future Conan versions.
WARN: Use your own profile files for stability.
Saving detected profile to /Users/jinglongcai/.conan2/profiles/default
CaiJingLong commented 1 year ago
image

The system have two clang.

image

By default, I run conan profile in the zsh shell. However, whether I use sh or bash, I get the clang under the llvm by default.

However, when I run the conan create command, reading the default profile, the compiler tool seems to become apple-clang in xcode, which is the reason why libc++ cannot be found.

CaiJingLong commented 1 year ago

This seems to be related conan profile find clang with order in $PATH, but it does not follow the same principle when conan create.

memsharded commented 1 year ago

Thanks very much for the feedback.

Lets go step by step:

What we would need to know a bit more of detail is the other possible errors when building packages. If you could test in your computer (check the arch is correct, if using a modern M1, you need to change it too):

profile "clang":

[settings]
arch=x86_64
build_type=Release
compiler=clang
compiler.cppstd=gnu14
compiler.libcxx=libc++
compiler.version=15
os=Macos

profile "appleclang":

[settings]
arch=x86_64
build_type=Release
compiler=apple-clang
compiler.cppstd=gnu17
compiler.libcxx=libc++
compiler.version=14
os=Macos
conan new cmake_lib -d name=pkg -d version=0.1
conan create . -pr=clang
conan create . -pr=appleclang

And report the full output of both "create" commands, that would hep to understand a bit better what could be failing.

CaiJingLong commented 1 year ago
image
clang.log ```log ======== Exporting recipe to the cache ======== pkg/0.1: Exporting package recipe: /Users/jinglongcai/code/c/conan-report-issue/conan-report-issue-13332/conanfile.py pkg/0.1: Copied 1 '.py' file: conanfile.py pkg/0.1: Copied 1 '.txt' file: CMakeLists.txt pkg/0.1: Copied 1 '.h' file: pkg.h pkg/0.1: Copied 1 '.cpp' file: pkg.cpp pkg/0.1: Exported to cache folder: /Users/jinglongcai/.conan2/p/pkga46465a315d11/e pkg/0.1: Exported: pkg/0.1#39063900f673dd4f1089607a3839b6b5 (2023-03-08 00:06:08 UTC) ======== Input profiles ======== Profile host: [settings] arch=x86_64 build_type=Release compiler=clang compiler.cppstd=gnu14 compiler.libcxx=libc++ compiler.version=15 os=Macos Profile build: [settings] arch=x86_64 build_type=Release compiler=clang compiler.cppstd=gnu17 compiler.libcxx=libc++ compiler.version=14 os=Macos ======== Computing dependency graph ======== Graph root cli Requirements pkg/0.1#39063900f673dd4f1089607a3839b6b5 - Cache ======== Computing necessary packages ======== pkg/0.1: Forced build from source Requirements pkg/0.1#39063900f673dd4f1089607a3839b6b5:55b20d5f48bf9bd610ef25b630bc41e9f6796fd2 - Build ======== Installing packages ======== -------- Building package pkg/0.1 from source (1 of 1) -------- pkg/0.1: Package pkg/0.1:55b20d5f48bf9bd610ef25b630bc41e9f6796fd2 pkg/0.1: Copying sources to build folder pkg/0.1: Building your package in /Users/jinglongcai/.conan2/p/t/pkg0692ab791a8ae/b pkg/0.1: Calling generate() pkg/0.1: Generators folder: /Users/jinglongcai/.conan2/p/t/pkg0692ab791a8ae/b/build/Release/generators pkg/0.1: CMakeToolchain generated: conan_toolchain.cmake pkg/0.1: CMakeToolchain generated: CMakePresets.json pkg/0.1: CMakeToolchain generated: ../../../CMakeUserPresets.json pkg/0.1: Generating aggregated env files pkg/0.1: Generated aggregated env files: ['conanbuild.sh', 'conanrun.sh'] pkg/0.1: Calling build() pkg/0.1: Running CMake.configure() pkg/0.1: RUN: cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="/Users/jinglongcai/.conan2/p/t/pkg0692ab791a8ae/b/build/Release/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/Users/jinglongcai/.conan2/p/t/pkg0692ab791a8ae/p" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "/Users/jinglongcai/.conan2/p/t/pkg0692ab791a8ae/b/." -- Using Conan toolchain: /Users/jinglongcai/.conan2/p/t/pkg0692ab791a8ae/b/build/Release/generators/conan_toolchain.cmake -- Conan toolchain: Setting CMAKE_POSITION_INDEPENDENT_CODE=ON (options.fPIC) -- Conan toolchain: C++ Standard 14 with extensions ON -- Conan toolchain: Setting BUILD_SHARED_LIBS = OFF -- The CXX compiler identification is AppleClang 14.0.0.14000029 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done CMake Warning: Manually-specified variables were not used by the project: CMAKE_POLICY_DEFAULT_CMP0091 -- Build files have been written to: /Users/jinglongcai/.conan2/p/t/pkg0692ab791a8ae/b/build/Release pkg/0.1: Running CMake.build() pkg/0.1: RUN: cmake --build "/Users/jinglongcai/.conan2/p/t/pkg0692ab791a8ae/b/build/Release" -- -j6 [ 50%] Building CXX object CMakeFiles/pkg.dir/src/pkg.cpp.o [100%] Linking CXX static library libpkg.a [100%] Built target pkg pkg/0.1: Package '55b20d5f48bf9bd610ef25b630bc41e9f6796fd2' built pkg/0.1: Build folder /Users/jinglongcai/.conan2/p/t/pkg0692ab791a8ae/b/build/Release pkg/0.1: Generating the package pkg/0.1: Temporary package folder /Users/jinglongcai/.conan2/p/t/pkg0692ab791a8ae/p pkg/0.1: Calling package() pkg/0.1: Running CMake.install() pkg/0.1: RUN: cmake --install "/Users/jinglongcai/.conan2/p/t/pkg0692ab791a8ae/b/build/Release" --prefix "/Users/jinglongcai/.conan2/p/t/pkg0692ab791a8ae/p" -- Install configuration: "Release" -- Installing: /Users/jinglongcai/.conan2/p/t/pkg0692ab791a8ae/p/lib/libpkg.a -- Installing: /Users/jinglongcai/.conan2/p/t/pkg0692ab791a8ae/p/include/pkg.h pkg/0.1: package(): Packaged 1 '.h' file: pkg.h pkg/0.1: package(): Packaged 1 '.a' file: libpkg.a pkg/0.1: Created package revision 153de2f7c2254ed289d5a879cac59dc9 pkg/0.1: Package '55b20d5f48bf9bd610ef25b630bc41e9f6796fd2' created pkg/0.1: Full package reference: pkg/0.1#39063900f673dd4f1089607a3839b6b5:55b20d5f48bf9bd610ef25b630bc41e9f6796fd2#153de2f7c2254ed289d5a879cac59dc9 => _action: PACKAGE_BUILT_FROM_SOURCES, _id: pkg/0.1#39063900f673dd4f1089607a3839b6b5%1678233968.4246368:55b20d5f48bf9bd610ef25b630bc41e9f6796fd2, duration: 1.1742939949035645, log: None pkg/0.1: Package folder /Users/jinglongcai/.conan2/p/pkgfa1a5f7616dc1/p ======== Launching test_package ======== ======== Computing dependency graph ======== Graph root pkg/0.1 (test package): /Users/jinglongcai/code/c/conan-report-issue/conan-report-issue-13332/test_package/conanfile.py Requirements pkg/0.1#39063900f673dd4f1089607a3839b6b5 - Cache ======== Computing necessary packages ======== Requirements pkg/0.1#39063900f673dd4f1089607a3839b6b5:55b20d5f48bf9bd610ef25b630bc41e9f6796fd2#153de2f7c2254ed289d5a879cac59dc9 - Cache ======== Installing packages ======== pkg/0.1: Already installed! => _action: GOT_PACKAGE_FROM_LOCAL_CACHE, _id: pkg/0.1#39063900f673dd4f1089607a3839b6b5%1678233968.4246368:55b20d5f48bf9bd610ef25b630bc41e9f6796fd2 ======== Testing the package ======== Removing previously existing 'test_package' build folder: /Users/jinglongcai/code/c/conan-report-issue/conan-report-issue-13332/test_package/build/clang-15-x86_64-gnu14-release pkg/0.1 (test package): Test package build: build/clang-15-x86_64-gnu14-release pkg/0.1 (test package): Test package build folder: /Users/jinglongcai/code/c/conan-report-issue/conan-report-issue-13332/test_package/build/clang-15-x86_64-gnu14-release pkg/0.1 (test package): Writing generators to /Users/jinglongcai/code/c/conan-report-issue/conan-report-issue-13332/test_package/build/clang-15-x86_64-gnu14-release/generators pkg/0.1 (test package): Generator 'CMakeDeps' calling 'generate()' pkg/0.1 (test package): Generator 'CMakeToolchain' calling 'generate()' pkg/0.1 (test package): CMakeToolchain generated: conan_toolchain.cmake pkg/0.1 (test package): CMakeToolchain generated: CMakePresets.json pkg/0.1 (test package): CMakeToolchain generated: ../../../CMakeUserPresets.json pkg/0.1 (test package): Generating aggregated env files pkg/0.1 (test package): Generated aggregated env files: ['conanbuild.sh', 'conanrun.sh'] ======== Testing the package: Building ======== pkg/0.1 (test package): Calling build() pkg/0.1 (test package): Running CMake.configure() pkg/0.1 (test package): RUN: cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="/Users/jinglongcai/code/c/conan-report-issue/conan-report-issue-13332/test_package/build/clang-15-x86_64-gnu14-release/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/Users/jinglongcai/code/c/conan-report-issue/conan-report-issue-13332/test_package" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "/Users/jinglongcai/code/c/conan-report-issue/conan-report-issue-13332/test_package/." -- Using Conan toolchain: /Users/jinglongcai/code/c/conan-report-issue/conan-report-issue-13332/test_package/build/clang-15-x86_64-gnu14-release/generators/conan_toolchain.cmake -- Conan toolchain: C++ Standard 14 with extensions ON -- The CXX compiler identification is AppleClang 14.0.0.14000029 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Conan: Target declared 'pkg::pkg' -- Configuring done -- Generating done CMake Warning: Manually-specified variables were not used by the project: CMAKE_POLICY_DEFAULT_CMP0091 -- Build files have been written to: /Users/jinglongcai/code/c/conan-report-issue/conan-report-issue-13332/test_package/build/clang-15-x86_64-gnu14-release pkg/0.1 (test package): Running CMake.build() pkg/0.1 (test package): RUN: cmake --build "/Users/jinglongcai/code/c/conan-report-issue/conan-report-issue-13332/test_package/build/clang-15-x86_64-gnu14-release" -- -j6 [ 50%] Building CXX object CMakeFiles/example.dir/src/example.cpp.o [100%] Linking CXX executable example [100%] Built target example ======== Testing the package: Executing test ======== pkg/0.1 (test package): Running test() pkg/0.1 (test package): RUN: ./example pkg/0.1: Hello World Release! pkg/0.1: __x86_64__ defined pkg/0.1: __cplusplus201402 pkg/0.1: __GNUC__4 pkg/0.1: __GNUC_MINOR__2 pkg/0.1: __clang_major__14 pkg/0.1: __apple_build_version__14000029 ```
apple-clang.log ```log ======== Exporting recipe to the cache ======== pkg/0.1: Exporting package recipe: /Users/jinglongcai/code/c/conan-report-issue/conan-report-issue-13332/conanfile.py pkg/0.1: Copied 1 '.py' file: conanfile.py pkg/0.1: Copied 1 '.txt' file: CMakeLists.txt pkg/0.1: Copied 1 '.h' file: pkg.h pkg/0.1: Copied 1 '.cpp' file: pkg.cpp pkg/0.1: Exported to cache folder: /Users/jinglongcai/.conan2/p/pkga46465a315d11/e pkg/0.1: Exported: pkg/0.1#39063900f673dd4f1089607a3839b6b5 (2023-03-08 00:07:54 UTC) ======== Input profiles ======== Profile host: [settings] arch=x86_64 build_type=Release compiler=apple-clang compiler.cppstd=gnu17 compiler.libcxx=libc++ compiler.version=14 os=Macos Profile build: [settings] arch=x86_64 build_type=Release compiler=clang compiler.cppstd=gnu17 compiler.libcxx=libc++ compiler.version=14 os=Macos ======== Computing dependency graph ======== Graph root cli Requirements pkg/0.1#39063900f673dd4f1089607a3839b6b5 - Cache ======== Computing necessary packages ======== pkg/0.1: Forced build from source Requirements pkg/0.1#39063900f673dd4f1089607a3839b6b5:3a30e794f52cc541a8eef1d48bd278ebdcc60c18 - Build ======== Installing packages ======== -------- Building package pkg/0.1 from source (1 of 1) -------- pkg/0.1: Package pkg/0.1:3a30e794f52cc541a8eef1d48bd278ebdcc60c18 pkg/0.1: Copying sources to build folder pkg/0.1: Building your package in /Users/jinglongcai/.conan2/p/t/pkgf1f389b7edba7/b pkg/0.1: Calling generate() pkg/0.1: Generators folder: /Users/jinglongcai/.conan2/p/t/pkgf1f389b7edba7/b/build/Release/generators pkg/0.1: CMakeToolchain generated: conan_toolchain.cmake pkg/0.1: CMakeToolchain generated: CMakePresets.json pkg/0.1: CMakeToolchain generated: ../../../CMakeUserPresets.json pkg/0.1: Generating aggregated env files pkg/0.1: Generated aggregated env files: ['conanbuild.sh', 'conanrun.sh'] pkg/0.1: Calling build() pkg/0.1: Running CMake.configure() pkg/0.1: RUN: cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="/Users/jinglongcai/.conan2/p/t/pkgf1f389b7edba7/b/build/Release/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/Users/jinglongcai/.conan2/p/t/pkgf1f389b7edba7/p" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "/Users/jinglongcai/.conan2/p/t/pkgf1f389b7edba7/b/." -- Using Conan toolchain: /Users/jinglongcai/.conan2/p/t/pkgf1f389b7edba7/b/build/Release/generators/conan_toolchain.cmake -- Conan toolchain: Setting CMAKE_POSITION_INDEPENDENT_CODE=ON (options.fPIC) -- Conan toolchain: C++ Standard 17 with extensions ON -- Conan toolchain: Setting BUILD_SHARED_LIBS = OFF -- The CXX compiler identification is AppleClang 14.0.0.14000029 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done CMake Warning: Manually-specified variables were not used by the project: CMAKE_POLICY_DEFAULT_CMP0091 -- Build files have been written to: /Users/jinglongcai/.conan2/p/t/pkgf1f389b7edba7/b/build/Release pkg/0.1: Running CMake.build() pkg/0.1: RUN: cmake --build "/Users/jinglongcai/.conan2/p/t/pkgf1f389b7edba7/b/build/Release" -- -j6 [ 50%] Building CXX object CMakeFiles/pkg.dir/src/pkg.cpp.o [100%] Linking CXX static library libpkg.a [100%] Built target pkg pkg/0.1: Package '3a30e794f52cc541a8eef1d48bd278ebdcc60c18' built pkg/0.1: Build folder /Users/jinglongcai/.conan2/p/t/pkgf1f389b7edba7/b/build/Release pkg/0.1: Generating the package pkg/0.1: Temporary package folder /Users/jinglongcai/.conan2/p/t/pkgf1f389b7edba7/p pkg/0.1: Calling package() pkg/0.1: Running CMake.install() pkg/0.1: RUN: cmake --install "/Users/jinglongcai/.conan2/p/t/pkgf1f389b7edba7/b/build/Release" --prefix "/Users/jinglongcai/.conan2/p/t/pkgf1f389b7edba7/p" -- Install configuration: "Release" -- Installing: /Users/jinglongcai/.conan2/p/t/pkgf1f389b7edba7/p/lib/libpkg.a -- Installing: /Users/jinglongcai/.conan2/p/t/pkgf1f389b7edba7/p/include/pkg.h pkg/0.1: package(): Packaged 1 '.h' file: pkg.h pkg/0.1: package(): Packaged 1 '.a' file: libpkg.a pkg/0.1: Created package revision 11dd633702b0ce448ff2c6a1dd38b45d pkg/0.1: Package '3a30e794f52cc541a8eef1d48bd278ebdcc60c18' created pkg/0.1: Full package reference: pkg/0.1#39063900f673dd4f1089607a3839b6b5:3a30e794f52cc541a8eef1d48bd278ebdcc60c18#11dd633702b0ce448ff2c6a1dd38b45d => _action: PACKAGE_BUILT_FROM_SOURCES, _id: pkg/0.1#39063900f673dd4f1089607a3839b6b5%1678234074.595932:3a30e794f52cc541a8eef1d48bd278ebdcc60c18, duration: 1.1990320682525635, log: None pkg/0.1: Package folder /Users/jinglongcai/.conan2/p/pkg45db34e27913a/p ======== Launching test_package ======== ======== Computing dependency graph ======== Graph root pkg/0.1 (test package): /Users/jinglongcai/code/c/conan-report-issue/conan-report-issue-13332/test_package/conanfile.py Requirements pkg/0.1#39063900f673dd4f1089607a3839b6b5 - Cache ======== Computing necessary packages ======== Requirements pkg/0.1#39063900f673dd4f1089607a3839b6b5:3a30e794f52cc541a8eef1d48bd278ebdcc60c18#11dd633702b0ce448ff2c6a1dd38b45d - Cache ======== Installing packages ======== pkg/0.1: Already installed! => _action: GOT_PACKAGE_FROM_LOCAL_CACHE, _id: pkg/0.1#39063900f673dd4f1089607a3839b6b5%1678234074.595932:3a30e794f52cc541a8eef1d48bd278ebdcc60c18 ======== Testing the package ======== Removing previously existing 'test_package' build folder: /Users/jinglongcai/code/c/conan-report-issue/conan-report-issue-13332/test_package/build/apple-clang-14-x86_64-gnu17-release pkg/0.1 (test package): Test package build: build/apple-clang-14-x86_64-gnu17-release pkg/0.1 (test package): Test package build folder: /Users/jinglongcai/code/c/conan-report-issue/conan-report-issue-13332/test_package/build/apple-clang-14-x86_64-gnu17-release pkg/0.1 (test package): Writing generators to /Users/jinglongcai/code/c/conan-report-issue/conan-report-issue-13332/test_package/build/apple-clang-14-x86_64-gnu17-release/generators pkg/0.1 (test package): Generator 'CMakeToolchain' calling 'generate()' pkg/0.1 (test package): CMakeToolchain generated: conan_toolchain.cmake pkg/0.1 (test package): CMakeToolchain generated: CMakePresets.json pkg/0.1 (test package): CMakeToolchain generated: ../../../CMakeUserPresets.json pkg/0.1 (test package): Generator 'CMakeDeps' calling 'generate()' pkg/0.1 (test package): Generating aggregated env files pkg/0.1 (test package): Generated aggregated env files: ['conanbuild.sh', 'conanrun.sh'] ======== Testing the package: Building ======== pkg/0.1 (test package): Calling build() pkg/0.1 (test package): Running CMake.configure() pkg/0.1 (test package): RUN: cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="/Users/jinglongcai/code/c/conan-report-issue/conan-report-issue-13332/test_package/build/apple-clang-14-x86_64-gnu17-release/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/Users/jinglongcai/code/c/conan-report-issue/conan-report-issue-13332/test_package" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "/Users/jinglongcai/code/c/conan-report-issue/conan-report-issue-13332/test_package/." -- Using Conan toolchain: /Users/jinglongcai/code/c/conan-report-issue/conan-report-issue-13332/test_package/build/apple-clang-14-x86_64-gnu17-release/generators/conan_toolchain.cmake -- Conan toolchain: C++ Standard 17 with extensions ON -- The CXX compiler identification is AppleClang 14.0.0.14000029 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Conan: Target declared 'pkg::pkg' -- Configuring done -- Generating done CMake Warning: Manually-specified variables were not used by the project: CMAKE_POLICY_DEFAULT_CMP0091 -- Build files have been written to: /Users/jinglongcai/code/c/conan-report-issue/conan-report-issue-13332/test_package/build/apple-clang-14-x86_64-gnu17-release pkg/0.1 (test package): Running CMake.build() pkg/0.1 (test package): RUN: cmake --build "/Users/jinglongcai/code/c/conan-report-issue/conan-report-issue-13332/test_package/build/apple-clang-14-x86_64-gnu17-release" -- -j6 [ 50%] Building CXX object CMakeFiles/example.dir/src/example.cpp.o [100%] Linking CXX executable example [100%] Built target example ======== Testing the package: Executing test ======== pkg/0.1 (test package): Running test() pkg/0.1 (test package): RUN: ./example pkg/0.1: Hello World Release! pkg/0.1: __x86_64__ defined pkg/0.1: __cplusplus201703 pkg/0.1: __GNUC__4 pkg/0.1: __GNUC_MINOR__2 pkg/0.1: __clang_major__14 pkg/0.1: __apple_build_version__14000029 ```

Currently, it does not follow the configuration of profile to use cxx compile. The input of profile is clang or apple-clang, but cxx compile of pkg build and test_package is always apple-clang.

memsharded commented 1 year ago

Thanks very much for the feedback.

To clarify, the purpose of the "profile" is not to configure the environment (compiler) in any way, it is just a declaration of what is supposed to be the configured environment that is going to be used, to define the binary package_id identifier that will be created. But it is the responsibility of the user to setup the environment to match the declared settings in the profile.

In your case, there is indeed a configuration problem:

It seems that Conan can't do much here (besides the bug with the PR to be fixed for libc++), but it is a matter of setup. Depending on what to do, it would make sense to use different approaches, but in the end is how to configure CMake to use the compiler you want. Do you really want to use clang or apple-clang (apple-clang is the standard in OSX)? Do you want to alternate between both compilers for different purposes?

CaiJingLong commented 1 year ago

My goal is compile lib success and make it available.

If the function of profile is not specified but declared, then I understand, but the package manager should not be just that.

The compilation speed and default compilation configuration of different compilers are different, so the compiler specified in the profile should be more intuitive "what you get is what you see". I mean that llvm-clang is configured in the profile, so llvm-clang should be used when compiling. The same is true for gcc or apple-clang.


Ps: Multiple clang are not my requirement, but because the binary installed by brew will be higher in PATH than the '/usr/bin' directory. A vscode plugin is required by cquery, and cquery required by llvm, so the llvm was installed.

memsharded commented 1 year ago

If the function of profile is not specified but declared, then I understand, but the package manager should not be just that.

yes, the role of a package manager is to install packages, not to configure the environment. Because, for a start, there are some mainstream compilers that cannot be even redistributed by third parties, like the Microsoft VS compiler. If Conan is not allowed to distribute and setup that compiler, then this is impossible. Same happens for Apple OSX (and iOS, etc) toolchains.

So installing and configuring the environment like compiler needs to be managed by users, there is no other possibility.

If Conan cannot have control over that, then it is almost impossible to guarantee that a Conan profile can configure the environment in the expected way. What was happening in your case is a good example. Conan "sees" a clang compiler in the path with higher priority, so it thinks "ok, there is a compiler in the path, it is clang 15, lets use it", and then your environment changes that and that compiler is no longer the one, and other tools like CMake will not see it with higher priority. What Conan can do? It just detected clang 15 because it was there in the path, and it worked (conan executed clang --version to get its version)

memsharded commented 1 year ago

this issue has been closed by https://github.com/conan-io/conan/pull/13359, fixing the libc++ detection in conan profile detect for clang compiler in OSX.

As commented above, there is little Conan can do about the configuration of the compiler in the system, but please open new tickets if you have any further questions. Thanks!