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

Can't build as C++20 module since 10.1.0 #3587

Closed
GregTheMadMonk opened this issue Aug 13, 2023 · 3 comments · Fixed by #3605
Closed

Can't build as C++20 module since 10.1.0 #3587

GregTheMadMonk opened this issue Aug 13, 2023 · 3 comments · Fixed by #3605

Comments

@GregTheMadMonk
Copy link

Issue in the title. 10.0.0 builds successfully with -DFMT_MODULE=ON, 10.1.0 doesn't.

Compiler versions and build logs:

$ gcc --version
gcc (GCC) 13.2.1 20230801
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ cmake .. -DFMT_MODULE=ON && make
-- CMake version: 3.27.1
-- The CXX compiler identification is GNU 13.2.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Testing is incompatible with build mode 'module'.
-- Version: 10.1.0
-- Build type: Release
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Configuring done (1.9s)
-- Generating done (0.0s)
-- Build files have been written to: /home/greg/tmp/fmt/build
[ 12%] Building CXX object CMakeFiles/fmt.dir/src/fmt.cc.o
/home/greg/tmp/fmt/src/fmt.cc:75:20: error: ‘export’ may only occur once in an export declaration
   75 | #define FMT_EXPORT export
      |                    ^~~~~~
/home/greg/tmp/fmt/include/fmt/core.h:1665:1: note: in expansion of macro ‘FMT_EXPORT’
 1665 | FMT_EXPORT
      | ^~~~~~~~~~
In file included from /home/greg/tmp/fmt/include/fmt/chrono.h:21,
                 from /home/greg/tmp/fmt/src/fmt.cc:91:
/home/greg/tmp/fmt/include/fmt/format.h:1484:57: error: conflicting exporting declaration ‘fmt::v10::detail::uint128_fallback fmt::v10::detail::umul128(uint64_t, uint64_t)’
 1484 | inline uint128_fallback umul128(uint64_t x, uint64_t y) noexcept {
      |                                                         ^~~~~~~~
/home/greg/tmp/fmt/include/fmt/format.h:371:27: note: previous declaration ‘fmt::v10::detail::uint128_fallback fmt::v10::detail::umul128(uint64_t, uint64_t)’ here
  371 |   friend uint128_fallback umul128(uint64_t x, uint64_t y) noexcept;
      |                           ^~~~~~~
/home/greg/tmp/fmt/include/fmt/format.h:4319:71: error: conflicting exporting declaration ‘template<class Char> void fmt::v10::detail::vformat_to(buffer<T>&, fmt::v10::basic_string_view<Char>, typename vformat_args<Char>::type, locale_ref)’
 4319 |              typename vformat_args<Char>::type args, locale_ref loc) {
      |                                                                    ^

In file included from /home/greg/tmp/fmt/include/fmt/args.h:15,
                 from /home/greg/tmp/fmt/src/fmt.cc:90:
/home/greg/tmp/fmt/include/fmt/core.h:2676:6: note: previous declaration ‘template<class Char> void fmt::v10::detail::vformat_to(buffer<T>&, fmt::v10::basic_string_view<Char>, typename vformat_args<Char>::type, locale_ref)’ here
 2676 | void vformat_to(buffer<Char>& buf, basic_string_view<Char> fmt,
      |      ^~~~~~~~~~
/home/greg/tmp/fmt/src/fmt.cc:73:8: warning: not writing module ‘fmt’ due to errors
   73 | export module fmt;
      |        ^~~~~~
make[2]: *** [CMakeFiles/fmt.dir/build.make:76: CMakeFiles/fmt.dir/src/fmt.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:135: CMakeFiles/fmt.dir/all] Error 2
make: *** [Makefile:166: all] Error 2
$ clang --version
clang version 15.0.7
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
$ CXX=clang++ CC=clang cmake .. -DFMT_MODULE=ON && make
-- CMake version: 3.27.1
-- The CXX compiler identification is Clang 15.0.7
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Testing is incompatible with build mode 'module'.
-- Version: 10.1.0
-- Build type: Release
-- Performing Test HAS_NULLPTR_WARNING
-- Performing Test HAS_NULLPTR_WARNING - Success
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Configuring done (2.7s)
-- Generating done (0.0s)
-- Build files have been written to: /home/greg/tmp/fmt/build
[ 11%] Generating fmt.pcm
In file included from /home/greg/tmp/fmt/src/fmt.cc:90:
In file included from /home/greg/tmp/fmt/include/fmt/args.h:15:
/home/greg/tmp/fmt/include/fmt/core.h:1665:1: error: export declaration appears within another export declaration
FMT_EXPORT
^
/home/greg/tmp/fmt/src/fmt.cc:75:20: note: expanded from macro 'FMT_EXPORT'
#define FMT_EXPORT export
                   ^
/home/greg/tmp/fmt/include/fmt/core.h:1600:1: note: export block begins here
FMT_BEGIN_EXPORT
^
/home/greg/tmp/fmt/src/fmt.cc:76:26: note: expanded from macro 'FMT_BEGIN_EXPORT'
#define FMT_BEGIN_EXPORT export {
                         ^
In file included from /home/greg/tmp/fmt/src/fmt.cc:91:
In file included from /home/greg/tmp/fmt/include/fmt/chrono.h:21:
/home/greg/tmp/fmt/include/fmt/format.h:4318:6: error: cannot export redeclaration 'vformat_to' here since the previous declaration has module linkage
void vformat_to(buffer<Char>& buf, basic_string_view<Char> fmt,
     ^
/home/greg/tmp/fmt/include/fmt/core.h:2676:6: note: previous declaration is here
void vformat_to(buffer<Char>& buf, basic_string_view<Char> fmt,
     ^
In file included from /home/greg/tmp/fmt/src/fmt.cc:109:
In file included from /home/greg/tmp/fmt/src/format.cc:8:
/home/greg/tmp/fmt/include/fmt/format-inl.h:1424:11: error: explicit instantiation of undefined function template 'vformat_to'
  detail::vformat_to(buffer, fmt, args);
          ^
/home/greg/tmp/fmt/include/fmt/core.h:2676:6: note: explicit instantiation refers here
void vformat_to(buffer<Char>& buf, basic_string_view<Char> fmt,
     ^
3 errors generated.
make[2]: *** [CMakeFiles/fmt.dir/build.make:74: fmt.pcm] Error 1
make[1]: *** [CMakeFiles/Makefile2:134: CMakeFiles/fmt.dir/all] Error 2
make: *** [Makefile:166: all] Error 2
@vitaut
Copy link
Contributor

vitaut commented Aug 20, 2023

At least some of the module-related issues should be fixed by #3597.

@GregTheMadMonk
Copy link
Author

Checked: it builds with Clang now. umul128 error with GCC is still present though.

@GregTheMadMonk
Copy link
Author

Seems to compile fine now. Thank you!

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

Successfully merging a pull request may close this issue.

2 participants