giada icon indicating copy to clipboard operation
giada copied to clipboard

Build from Git on Ubuntu 22.04 fails with "error: call to non-‘constexpr’ function"

Open davidmcnabnz opened this issue 2 years ago • 2 comments

Environment

  • OS: Ubuntu 22.04 LTS
  • Giada version: git 6e618c87ec4f0a074dee8e22e59084a134638ec1

Describe the bug Attempting to build giada fails with a C++ compilation error: error: call to non-‘constexpr’ function

To Reproduce Steps to reproduce the behavior:

  1. clone the current git repo on Ubuntu 22.04 LTS
  2. ensure all deps are present (eg, sudo build-dep gardia), plus a few other dev lib packages such as librtaudio-dev
  3. follow the instructions on the gardia "Compiling from Source" page
  4. Observe compilation errors. There are 3 points in the codebase where g++ is complaining about "call to non-constexpr function"

Expected behavior gardia fully compiles and links without problems

Screenshots Here is one of the 3 compilation error messages:

/home/david/giada/src/gui/dialogs/sampleEditor.cpp: In member function ‘void giada::v::gdSampleEditor::updateInfo()’:
/home/david/giada/src/gui/dialogs/sampleEditor.cpp:233:63: error: call to non-‘constexpr’ function ‘const char* giada::v::LangMapper::get(const string&) const’
  233 |         std::string infoText = fmt::format(g_ui.langMapper.get(LangMap::SAMPLEEDITOR_INFO),
      |                                            ~~~~~~~~~~~~~~~~~~

Additional context Ubuntu 22.04 LTS system is up to date. It's not immediately obvious which toolchain programs and which versions are being used, eg g++ vs gcc vs some other compiler.

davidmcnabnz avatar Jan 17 '23 23:01 davidmcnabnz

Hey @davidmcnabnz , what version of gcc are you using (gcc --version)? Also, do you get the same error on a different compiler (clang)?

gvnnz avatar Jan 23 '23 12:01 gvnnz

Current gcc version on Ubuntu[Studio] 22.04 LTS is: gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0

As per your suggestion, I installed clang, removed the build/ directory, and tried to set up for a fresh build with: cmake -B build -S . -DCMAKE_CXX_COMPILER=/usr/bin/clang

This failed at the step of:

fatal error: 'atomic' file not found
              #include <atomic>

I tried to remedy this by installing all the libatomic-related dev packages, but this didn't resolve the issue.

Note that when I run cmake, accepting the default compiler (/usr/bin/), the above 'atomic not found' error does not occur.

If I've got the cmake setup command wrong (above), please correct me.

davidmcnabnz avatar Jan 23 '23 22:01 davidmcnabnz