question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[bug] MesonToolchain does not respect libcxx setting

See original GitHub issue

Environment Details (include every applicable attribute)

  • Operating System+version: Ubuntu 22.04 LTS
  • Compiler+version: Clang 13
  • Conan version: 1.52.0
  • Python version: 3.10.3

Steps to reproduce (Include if Applicable)

When running a verbose build, the -stdlib=libc++ option does not appear to be passed to Clang, causing the test package to fail with linking errors. As there are no other CCI packages using the new MesonToolchain to build C++ libraries, I’m not sure if this is a bug or if I am missing some generation step.

See libsigcpp recipe in https://github.com/conan-io/conan-center-index/pull/12775

Logs (Executed commands with output) (Include/Attach if Applicable)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
planetmarshallcommented, Sep 2, 2022

Workaround

(not comprehensive)

def generate(self):
      tc = MesonToolchain(self)
      if self.settings.compiler == "clang":
          libcxx = {
                  "libc++": ("-stdlib=libc++", None),
                  "libstdc++": ("-stdlib=libstdc++", 0),
                  "libstdc++11": ("-stdlib=libstdc++", 1)
                  }
          cxxflags, cxx11 = libcxx[str(self.settings.compiler.libcxx)]
          tc.cpp_args = [cxxflags]
          if cxx11 is not None:
              tc.cpp_args = [f"-D_GLIBCXX_USE_CXX11_ABI={cxx11}"]
              tc.c_args = [f"-D_GLIBCXX_USE_CXX11_ABI={cxx11}"]

      tc.generate()
1reaction
planetmarshallcommented, Sep 2, 2022

Test package created using

conan new <package> -t -m meson_lib

With a few modifications to run the test package using the new CMake toolchain.

conan-meson.zip

Steps to reproduce

  1. Unzip the test package
  2. Run conan create . -s compiler.libcxx=libc++ (with Clang)

Expected results

The test package is built correctly

Actual results

The test package fails with linking errors caused by linking a different C++ standard library to that used by the main package.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[bug] MesonToolchain does not pick up CC/CXX from build ...
[bug] MesonToolchain does not pick up CC/CXX from build requirements ... won't contain the properties.c values, set by crosscompiler/0.1 .
Read more >
Conan not respecting compiler.libcxx abi setting - c++
I have the following conan profile: $ conan profile show default Configuration for profile default: [settings] os=Linux os_build=Linux ...
Read more >
Changelog — conan 1.56.0 documentation
Docs here; Fix: Raise a clear error if settings.compiler is not defined for MesonToolchain . #12623; Fix: Fix runenv for cmake.test() .
Read more >
conan Changelog - pyup.io
Fix: Raise a clear error if ``settings.compiler`` is not defined for ``MesonToolchain``. (https://github.com/conan-io/conan/pull/12623)
Read more >
troubleshooting · master · RD51 Software and Firmware for ...
§1: if a bug is declared as HW look for a bug in FW or SW ... --build=outdated --no-imports -- ERROR: compiler not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found