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

Building on MacOS 12.6.5 compile errors: non-literal type 'const std::string' #647

Closed
gvnnz opened this issue Jun 3, 2023 Discussed in #642 · 2 comments
Closed

Building on MacOS 12.6.5 compile errors: non-literal type 'const std::string' #647

gvnnz opened this issue Jun 3, 2023 Discussed in #642 · 2 comments

Comments

@gvnnz
Copy link
Contributor

gvnnz commented Jun 3, 2023

Discussed in #642

Originally posted by rudenoise May 18, 2023
Hello, this may be the wrong place to ask (and is likely due to my inexperience with cmake).

I'm attempting to build giada from source, I have all the dependencies and am running cmake -B build/ -S . which succeeds.

Then when running cmake --build build/ I get the following error:

giada/src/gui/dialogs/about.cpp:65:33: error: call to consteval function 'fmt::basic_format_string<char, const char *const &, const char *, const char (&)[12]>::basic_format_string<const char *, 0>' is not a constant expression
                        text->copy_label(fmt::format(g_ui.getI18Text(LangMap::ABOUT_BODY),
                                                     ^
giada/src/gui/dialogs/about.cpp:65:49: note: non-literal type 'const std::string' (aka 'const basic_string<char, char_traits<char>, allocator<char>>') cannot be used in a constant expression
                        text->copy_label(fmt::format(g_ui.getI18Text(LangMap::ABOUT_BODY),
                                                                     ^
1 error generated.
make[2]: *** [CMakeFiles/giada.dir/src/gui/dialogs/about.cpp.o] Error 1
make[1]: *** [CMakeFiles/giada.dir/all] Error 2
make: *** [all] Error 2

From what I can tell (from a bit of searching) this may be a problem with the c++ standard?

The contents of build/CMakeFiles/giada.dir/flags.make contains:

CXX_FLAGSarm64 = -std=gnu++20 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk -mmacosx-version-min=12.6 -Wall -Wextra -Wpedantic -Wunreachable-code -Wcast-align -Wno-implicit-fallthrough -Wno-ignored-qualifiers -Wredundant-decls -Woverloaded-virtual -Wreorder

CXX_FLAGS = -std=gnu++20 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk -mmacosx-version-min=12.6 -Wall -Wextra -Wpedantic -Wunreachable-code -Wcast-align -Wno-implicit-fallthrough -Wno-ignored-qualifiers -Wredundant-decls -Woverloaded-virtual -Wreorder

I expect I'm off the mark so any advice much appreciated!

@gvnnz
Copy link
Contributor Author

gvnnz commented Jun 3, 2023

Hey @rudenoise, thanks for reporting, I've opened an issue from your original post to better track the problem. I remember fixing a similar error about fmt clashing with clang or gcc a while ago, Can you please try again with the latest master branch?

@rudenoise
Copy link

Morning @gvnnz so I'm now able to build!

I did have to add a couple more dependencies: nlohmann/json and fmtlib/fmt (unless I made a mistake somewhere along the way).

Thanks very much for the help!

@gvnnz gvnnz closed this as completed Jun 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants