Skip to content

[Bug] Compilation error with libfmt-11.2.0 #2225

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

Open
xhub opened this issue May 4, 2025 · 1 comment
Open

[Bug] Compilation error with libfmt-11.2.0 #2225

xhub opened this issue May 4, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@xhub
Copy link

xhub commented May 4, 2025

Operating System

Linux

What's the issue you encountered?

Rebuilding Imhex-1.37.4 after updating libfmt to 11.2.0 failed because of tm fmt::v11::localtime(time_t) is deprecated:

[111/420] /usr/bin/x86_64-pc-linux-gnu-g++ -DFMT_SHARED -DLIBWOLV_BUILTIN_UINT128 -DNDEBUG -DOS_LINUX -DSYSTEM_PLUGINS_LOCATION="/usr/lib64/imhex" -I/dev/shm/portage/app-editors/imhex-1.37.4-r2/work/ImHex/lib/external/pattern_language/lib/include -I/dev/shm/portage/app-editors/imhex-1.37.4-r2/work/ImHex/lib/external/pattern_language/lib/../external/throwing_ptr/include -I/dev/shm/portage/app-editors/imhex-1.37.4-r2/work/ImHex/lib/external/libwolv/libs/types/include -I/dev/shm/portage/app-editors/imhex-1.37.4-r2/work/ImHex/lib/external/libwolv/libs/io/include -I/dev/shm/portage/app-editors/imhex-1.37.4-r2/work/ImHex/lib/external/libwolv/libs/utils/include -I/dev/shm/portage/app-editors/imhex-1.37.4-r2/work/ImHex/lib/external/libwolv/libs/hash/include -I/dev/shm/portage/app-editors/imhex-1.37.4-r2/work/ImHex/lib/external/libwolv/libs/containers/include -O2 -march=native -pipe -std=gnu++23 -fPIC -Wno-stringop-overflow -fexceptions -frtti -Wall -Wextra -Werror -Wpedantic -Wno-unknown-pragmas -Wno-array-bounds -Wno-stringop-overread -MD -MT lib/external/pattern_language/lib/CMakeFiles/libpl.dir/source/pl/lib/std/time.cpp.o -MF lib/external/pattern_language/lib/CMakeFiles/libpl.dir/source/pl/lib/std/time.cpp.o.d -o lib/external/pattern_language/lib/CMakeFiles/libpl.dir/source/pl/lib/std/time.cpp.o -c /dev/shm/portage/app-editors/imhex-1.37.4-r2/work/ImHex/lib/external/pattern_language/lib/source/pl/lib/std/time.cpp
lib/external/pattern_language/lib/CMakeFiles/libpl.dir/source/pl/lib/std/time.cpp.o
/usr/bin/x86_64-pc-linux-gnu-g++ -DFMT_SHARED -DLIBWOLV_BUILTIN_UINT128 -DNDEBUG -DOS_LINUX -DSYSTEM_PLUGINS_LOCATION="/usr/lib64/imhex" -I/dev/shm/portage/app-editors/imhex-1.37.4-r2/work/ImHex/lib/external/pattern_language/lib/include -I/dev/shm/portage/app-editors/imhex-1.37.4-r2/work/ImHex/lib/external/pattern_language/lib/../external/throwing_ptr/include -I/dev/shm/portage/app-editors/imhex-1.37.4-r2/work/ImHex/lib/external/libwolv/libs/types/include -I/dev/shm/portage/app-editors/imhex-1.37.4-r2/work/ImHex/lib/external/libwolv/libs/io/include -I/dev/shm/portage/app-editors/imhex-1.37.4-r2/work/ImHex/lib/external/libwolv/libs/utils/include -I/dev/shm/portage/app-editors/imhex-1.37.4-r2/work/ImHex/lib/external/libwolv/libs/hash/include -I/dev/shm/portage/app-editors/imhex-1.37.4-r2/work/ImHex/lib/external/libwolv/libs/containers/include -O2 -march=native -pipe -std=gnu++23 -fPIC -Wno-stringop-overflow -fexceptions -frtti -Wall -Wextra -Werror -Wpedantic -Wno-unknown-pragmas -Wno-array-bounds -Wno-stringop-overread -MD -MT lib/external/pattern_language/lib/CMakeFiles/libpl.dir/source/pl/lib/std/time.cpp.o -MF lib/external/pattern_language/lib/CMakeFiles/libpl.dir/source/pl/lib/std/time.cpp.o.d -o lib/external/pattern_language/lib/CMakeFiles/libpl.dir/source/pl/lib/std/time.cpp.o -c /dev/shm/portage/app-editors/imhex-1.37.4-r2/work/ImHex/lib/external/pattern_language/lib/source/pl/lib/std/time.cpp
/dev/shm/portage/app-editors/imhex-1.37.4-r2/work/ImHex/lib/external/pattern_language/lib/source/pl/lib/std/time.cpp: In lambda function:
/dev/shm/portage/app-editors/imhex-1.37.4-r2/work/ImHex/lib/external/pattern_language/lib/source/pl/lib/std/time.cpp:60:52: error: ‘tm fmt::v11::localtime(time_t)’ is deprecated [-Werror=deprecated-declarations]
60 | auto localTime = fmt::localtime(time);
| ~~~~~~~~~~~~~~^~~~~~
In file included from /dev/shm/portage/app-editors/imhex-1.37.4-r2/work/ImHex/lib/external/pattern_language/lib/source/pl/lib/std/time.cpp:10:
/usr/include/fmt/chrono.h:538:28: note: declared here
538 | FMT_DEPRECATED inline auto localtime(std::time_t time) -> std::tm {
| ^~~~~~~~~
/dev/shm/portage/app-editors/imhex-1.37.4-r2/work/ImHex/lib/external/pattern_language/lib/source/pl/lib/std/time.cpp: In instantiation of ‘pl::lib::libstd::time::registerFunctions(pl::PatternLanguage&)::<lambda(pl::core::Evaluator*, auto:64)> [with auto:64 = std::vectorpl::core::Token::Literal]’:
/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/invoke.h:61:36: required from ‘constexpr _Res std::__invoke_impl(__invoke_other, _Fn&&, _Args&& ...) [with _Res = optionalpl::core::Token::Literal; _Fn = pl::lib::libstd::time::registerFunctions(pl::PatternLanguage&)::<lambda(pl::core::Evaluator*, auto:64)>&; _Args = {pl::core::Evaluator*, const vector<pl::core::Token::Literal, allocatorpl::core::Token::Literal >&}]’
61 | { return std::forward<_Fn>(__f)(std::forward<_Args>(__args)...); }
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/invoke.h:114:35: required from ‘constexpr std::enable_if_t<((bool)is_invocable_r_v<_Res, _Callable, _Args ...>), _Res> std::__invoke_r(_Callable&&, _Args&& ...) [with _Res = optionalpl::core::Token::Literal; _Callable = pl::lib::libstd::time::registerFunctions(pl::PatternLanguage&)::<lambda(pl::core::Evaluator*, auto:64)>&; _Args = {pl::core::Evaluator*, const vector<pl::core::Token::Literal, allocatorpl::core::Token::Literal >&}; enable_if_t<((bool)is_invocable_r_v<_Res, _Callable, _Args ...>), _Res> = optionalpl::core::Token::Literal]’
114 | return std::__invoke_impl<__type>(__tag{},
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
115 | std::forward<_Callable>(__fn),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
116 | std::forward<_Args>(__args)...);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/std_function.h:290:30: required from ‘static _Res std::_Function_handler<_Res(_ArgTypes ...), _Functor>::_M_invoke(const std::_Any_data&, _ArgTypes&& ...) [with _Res = std::optionalpl::core::Token::Literal; _Functor = pl::lib::libstd::time::registerFunctions(pl::PatternLanguage&)::<lambda(pl::core::Evaluator*, auto:64)>; _ArgTypes = {pl::core::Evaluator*, const std::vector<pl::core::Token::Literal, std::allocatorpl::core::Token::Literal >&}]’
290 | return std::__invoke_r<_Res>(_Base::_M_get_pointer(__functor),
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
291 | std::forward<_ArgTypes>(__args)...);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/std_function.h:451:21: required from ‘std::function<_Res(_ArgTypes ...)>::function(_Functor&&) [with _Functor = pl::lib::libstd::time::registerFunctions(pl::PatternLanguage&)::<lambda(pl::core::Evaluator
, auto:64)>; _Constraints = void; _Res = std::optionalpl::core::Token::Literal; _ArgTypes = {pl::core::Evaluator*, const std::vector<pl::core::Token::Literal, std::allocatorpl::core::Token::Literal >&}]’
451 | _M_invoker = &_My_handler::_M_invoke;
| ^~~~~~~~~~~~~~~~~~~~~~~
/dev/shm/portage/app-editors/imhex-1.37.4-r2/work/ImHex/lib/external/pattern_language/lib/source/pl/lib/std/time.cpp:56:32: required from here
56 | runtime.addFunction(nsStdTime, "to_local", FunctionParameterCount::exactly(1), [](Evaluator *, auto params) -> std::optionalToken::Literal {
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
57 | auto time = time_t(params[0].toUnsigned());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
58 |
|
59 | try {
| ~~~~~
60 | auto localTime = fmt::localtime(time);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
61 |
|
62 | return { packTMValue(localTime) };
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63 | } catch (const fmt::format_error&) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
64 | return u128(0);
| ~~~~~~~~~~~~~~~
65 | }
| ~
66 | });
| ~~
/dev/shm/portage/app-editors/imhex-1.37.4-r2/work/ImHex/lib/external/pattern_language/lib/source/pl/lib/std/time.cpp:60:52: error: ‘tm fmt::v11::localtime(time_t)’ is deprecated [-Werror=deprecated-declarations]
60 | auto localTime = fmt::localtime(time);
| ~~~~~~~~~~~~~~^~~~~~
/usr/include/fmt/chrono.h:538:28: note: declared here
538 | FMT_DEPRECATED inline auto localtime(std::time_t time) -> std::tm {
| ^~~~~~~~~
/dev/shm/portage/app-editors/imhex-1.37.4-r2/work/ImHex/lib/external/pattern_language/lib/source/pl/lib/std/time.cpp:60:52: error: ‘tm fmt::v11::localtime(time_t)’ is deprecated [-Werror=deprecated-declarations]
60 | auto localTime = fmt::localtime(time);
| ~~~~~~~~~~~~~~^~~~~~
/usr/include/fmt/chrono.h:538:28: note: declared here
538 | FMT_DEPRECATED inline auto localtime(std::time_t time) -> std::tm {
| ^~~~~~~~~
/dev/shm/portage/app-editors/imhex-1.37.4-r2/work/ImHex/lib/external/pattern_language/lib/source/pl/lib/std/time.cpp:60:52: error: ‘tm fmt::v11::localtime(time_t)’ is deprecated [-Werror=deprecated-declarations]
60 | auto localTime = fmt::localtime(time);
| ~~~~~~~~~~~~~~^~~~~~
/usr/include/fmt/chrono.h:538:28: note: declared here
538 | FMT_DEPRECATED inline auto localtime(std::time_t time) -> std::tm {
| ^~~~~~~~~
cc1plus: all warnings being treated as errors
[


### How can the issue be reproduced?

- build Imhex against libfmt-11.2.0

### ImHex Version

1.37.4

### ImHex Build Type

- [ ] Nightly or built from sources

### Installation type

Gentoo package

### Additional context?

- built using Gentoo overlay GURU
- GCC 14.2.1
@xhub xhub added the bug Something isn't working label May 4, 2025
@henri-gasc
Copy link
Contributor

I updated the ebuild (by limiting the version of libfmt accepted) ~2h ago, so give it 1 or 2 days to land in master.
If you do not want to wait until then you can create the patch from the pull requests. (I do not have the time right now, I will do it later if needed)

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

2 participants