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

Regression in fmt 10+ with gcc: error: 'current_zone' is not a member of 'std::chrono' #4160

Closed
barracuda156 opened this issue Sep 13, 2024 · 11 comments

Comments

@barracuda156
Copy link

Example of the issue: complexlogic/rsgain#126

The same code builds fine against libfmt 9, but fails with 10 and 11. Identical compiler is being used, gcc 14.2.0.

Log:

make[2]: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/build'
/usr/bin/make  -f src/CMakeFiles/rsgain.dir/build.make src/CMakeFiles/rsgain.dir/build
make[2]: Entering directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/build'
[ 16%] Building CXX object src/CMakeFiles/rsgain.dir/easymode.cpp.o
cd /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/build/src && /opt/local/bin/ccache /opt/local/bin/g++-mp-14 -DBUILD_DATE=\"2024-09-12\" -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/build -isystem /opt/local/include -isystem /opt/local/include/taglib -isystem /opt/local/include/libfmt11 -pipe -Os -DNDEBUG -I/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -std=gnu++20 -arch ppc -mmacosx-version-min=10.6 -MD -MT src/CMakeFiles/rsgain.dir/easymode.cpp.o -MF CMakeFiles/rsgain.dir/easymode.cpp.o.d -o CMakeFiles/rsgain.dir/easymode.cpp.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/rsgain-3.5.2/src/easymode.cpp
[ 33%] Building CXX object src/CMakeFiles/rsgain.dir/output.cpp.o
cd /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/build/src && /opt/local/bin/ccache /opt/local/bin/g++-mp-14 -DBUILD_DATE=\"2024-09-12\" -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/build -isystem /opt/local/include -isystem /opt/local/include/taglib -isystem /opt/local/include/libfmt11 -pipe -Os -DNDEBUG -I/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -std=gnu++20 -arch ppc -mmacosx-version-min=10.6 -MD -MT src/CMakeFiles/rsgain.dir/output.cpp.o -MF CMakeFiles/rsgain.dir/output.cpp.o.d -o CMakeFiles/rsgain.dir/output.cpp.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/rsgain-3.5.2/src/output.cpp
[ 50%] Building CXX object src/CMakeFiles/rsgain.dir/scan.cpp.o
cd /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/build/src && /opt/local/bin/ccache /opt/local/bin/g++-mp-14 -DBUILD_DATE=\"2024-09-12\" -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/build -isystem /opt/local/include -isystem /opt/local/include/taglib -isystem /opt/local/include/libfmt11 -pipe -Os -DNDEBUG -I/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -std=gnu++20 -arch ppc -mmacosx-version-min=10.6 -MD -MT src/CMakeFiles/rsgain.dir/scan.cpp.o -MF CMakeFiles/rsgain.dir/scan.cpp.o.d -o CMakeFiles/rsgain.dir/scan.cpp.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/rsgain-3.5.2/src/scan.cpp
[ 66%] Building CXX object src/CMakeFiles/rsgain.dir/rsgain.cpp.o
cd /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/build/src && /opt/local/bin/ccache /opt/local/bin/g++-mp-14 -DBUILD_DATE=\"2024-09-12\" -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/build -isystem /opt/local/include -isystem /opt/local/include/taglib -isystem /opt/local/include/libfmt11 -pipe -Os -DNDEBUG -I/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -std=gnu++20 -arch ppc -mmacosx-version-min=10.6 -MD -MT src/CMakeFiles/rsgain.dir/rsgain.cpp.o -MF CMakeFiles/rsgain.dir/rsgain.cpp.o.d -o CMakeFiles/rsgain.dir/rsgain.cpp.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/rsgain-3.5.2/src/rsgain.cpp
[ 83%] Building CXX object src/CMakeFiles/rsgain.dir/tag.cpp.o
cd /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/build/src && /opt/local/bin/ccache /opt/local/bin/g++-mp-14 -DBUILD_DATE=\"2024-09-12\" -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/build -isystem /opt/local/include -isystem /opt/local/include/taglib -isystem /opt/local/include/libfmt11 -pipe -Os -DNDEBUG -I/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -std=gnu++20 -arch ppc -mmacosx-version-min=10.6 -MD -MT src/CMakeFiles/rsgain.dir/tag.cpp.o -MF CMakeFiles/rsgain.dir/tag.cpp.o.d -o CMakeFiles/rsgain.dir/tag.cpp.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/rsgain-3.5.2/src/tag.cpp
In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/rsgain-3.5.2/src/output.hpp:66,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/rsgain-3.5.2/src/output.cpp:51:
/opt/local/include/libfmt11/fmt/chrono.h: In function 'tm fmt::v11::localtime(std::chrono::local_time<_Duration>)':
/opt/local/include/libfmt11/fmt/chrono.h:559:38: error: 'current_zone' is not a member of 'std::chrono'
  559 |       detail::to_time_t(std::chrono::current_zone()->to_sys(time)));
      |                                      ^~~~~~~~~~~~
make[2]: *** [src/CMakeFiles/rsgain.dir/output.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/rsgain-3.5.2/src/output.hpp:66,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/rsgain-3.5.2/src/tag.cpp:65:
/opt/local/include/libfmt11/fmt/chrono.h: In function 'tm fmt::v11::localtime(std::chrono::local_time<_Duration>)':
/opt/local/include/libfmt11/fmt/chrono.h:559:38: error: 'current_zone' is not a member of 'std::chrono'
  559 |       detail::to_time_t(std::chrono::current_zone()->to_sys(time)));
      |                                      ^~~~~~~~~~~~
make[2]: *** [src/CMakeFiles/rsgain.dir/tag.cpp.o] Error 1
In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/rsgain-3.5.2/src/output.hpp:66,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/rsgain-3.5.2/src/scan.cpp:55:
/opt/local/include/libfmt11/fmt/chrono.h: In function 'tm fmt::v11::localtime(std::chrono::local_time<_Duration>)':
/opt/local/include/libfmt11/fmt/chrono.h:559:38: error: 'current_zone' is not a member of 'std::chrono'
  559 |       detail::to_time_t(std::chrono::current_zone()->to_sys(time)));
      |                                      ^~~~~~~~~~~~
make[2]: *** [src/CMakeFiles/rsgain.dir/scan.cpp.o] Error 1
In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/rsgain-3.5.2/src/output.hpp:66,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/rsgain-3.5.2/src/rsgain.cpp:58:
/opt/local/include/libfmt11/fmt/chrono.h: In function 'tm fmt::v11::localtime(std::chrono::local_time<_Duration>)':
/opt/local/include/libfmt11/fmt/chrono.h:559:38: error: 'current_zone' is not a member of 'std::chrono'
  559 |       detail::to_time_t(std::chrono::current_zone()->to_sys(time)));
      |                                      ^~~~~~~~~~~~
make[2]: *** [src/CMakeFiles/rsgain.dir/rsgain.cpp.o] Error 1
In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/rsgain-3.5.2/src/output.hpp:66,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/rsgain-3.5.2/src/easymode.cpp:26:
/opt/local/include/libfmt11/fmt/chrono.h: In function 'tm fmt::v11::localtime(std::chrono::local_time<_Duration>)':
/opt/local/include/libfmt11/fmt/chrono.h:559:38: error: 'current_zone' is not a member of 'std::chrono'
  559 |       detail::to_time_t(std::chrono::current_zone()->to_sys(time)));
      |                                      ^~~~~~~~~~~~
make[2]: *** [src/CMakeFiles/rsgain.dir/easymode.cpp.o] Error 1
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/build'
make[1]: *** [src/CMakeFiles/rsgain.dir/all] Error 2
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_rsgain/rsgain/work/build'
make: *** [all] Error 2
@vitaut
Copy link
Contributor

vitaut commented Sep 13, 2024

@vitaut
Copy link
Contributor

vitaut commented Sep 13, 2024

This looks like a bug in libstdc++: the feature test macro is defined to 201907 but they don't implement current_zone. We could implement a workaround but please report to libstdc++ maintainers.

@vitaut
Copy link
Contributor

vitaut commented Sep 14, 2024

Worked around in 538d877.

@vitaut vitaut closed this as completed Sep 14, 2024
@barracuda156
Copy link
Author

@vitaut Thank you!

I can open an issue on GCC bugzilla, let’s see what upstream says.

@barracuda156
Copy link
Author

I have opened a ticket: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116777

@jwakely
Copy link
Contributor

jwakely commented Sep 19, 2024

This looks like a bug in libstdc++: the feature test macro is defined to 201907 but they don't implement current_zone. We could implement a workaround but please report to libstdc++ maintainers.

This is because OP is using -D_GLIBCXX_USE_CXX11_ABI=0 and time zones have never been supported for that configuration. The feature test macro should have depended on the use of the cxx11 ABI, which was fixed by gcc-mirror/gcc@f906b10 for trunk and gcc-mirror/gcc@c386665 for gcc-14

@jwakely
Copy link
Contributor

jwakely commented Sep 19, 2024

@barracuda156
Copy link
Author

And that's because macports selects the old ABI for old macOS versions: https://github.com/macports/macports-base/blob/a0c99ad1bf6363b556517a9b0ad91def3a812064/src/port1.0/portconfigure.tcl#L107

Yes, you are right. If it did not, ports which use C++11 or higher cannot be linked to dependencies which are built against Apple libstdc++.

@barracuda156
Copy link
Author

@iains Iain, do we have some solution to this? libfmt added a local workaround, but the same problem will inevitably resurface elsewhere.

@jwakely
Copy link
Contributor

jwakely commented Sep 19, 2024

Don't expect to use C++20 features on an OS from 2011 🤷

@barracuda156
Copy link
Author

@jwakely With a very few exceptions even C++23 works fine on the OS from 2011 :)

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

3 participants