canonical / multipass

Multipass orchestrates virtual Ubuntu instances
https://multipass.run
GNU General Public License v3.0
7.86k stars 650 forks source link

Build issues #1199

Closed fortizc closed 4 years ago

fortizc commented 4 years ago

Hi, I have some issues with the submodules in Multipass. I try to follow the README.md instructions but 2 problems appear:

The first problem is with {fmt} the problem is the -pedantic flag in Multipass CMakeLists.txt, it seems {fmt} doesn't support it. If you try to compile you will something like this:

Scanning dependencies of target utils
[ 30%] Building CXX object src/utils/CMakeFiles/utils.dir/memory_size.cpp.o
In file included from /home/felipe/dev/multipass/include/multipass/exceptions/invalid_memory_size_exception.h:21,
                 from /home/felipe/dev/multipass/src/utils/memory_size.cpp:18:
/home/felipe/dev/multipass/3rd-party/fmt/include/fmt/format.h:3621:55: error: ISO C++ did not adopt string literal operator templates taking an argument pack of characters [-Werror=pedantic]
 3621 | FMT_CONSTEXPR internal::udl_formatter<Char, CHARS...> operator""_format() {
      |                                                       ^~~~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [src/utils/CMakeFiles/utils.dir/build.make:63: src/utils/CMakeFiles/utils.dir/memory_size.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:9400: src/utils/CMakeFiles/utils.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

All works if I remove -pendantic flag from CMakeList.txt

The second problem is with gRPC, if you try to compile you will see this:

[ 30%] Building CXX object 3rd-party/grpc/CMakeFiles/gpr.dir/src/core/lib/gpr/log_linux.cc.o
/home/felipe/dev/multipass/3rd-party/grpc/src/core/lib/gpr/log_linux.cc:43:13: error: ambiguating new declaration of ‘long int gettid()’
   43 | static long gettid(void) { return syscall(__NR_gettid); }
      |             ^~~~~~
In file included from /usr/include/unistd.h:1170,
                 from /home/felipe/dev/multipass/3rd-party/grpc/src/core/lib/gpr/log_linux.cc:41:
/usr/include/x86_64-linux-gnu/bits/unistd_ext.h:34:16: note: old declaration ‘__pid_t gettid()’
   34 | extern __pid_t gettid (void) __THROW;
      |                ^~~~~~
make[2]: *** [3rd-party/grpc/CMakeFiles/gpr.dir/build.make:232: 3rd-party/grpc/CMakeFiles/gpr.dir/src/core/lib/gpr/log_linux.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:510: 3rd-party/grpc/CMakeFiles/gpr.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

This problem was fixed by this PR if you apply those changes to the gRPC in Multipass all works again.

I try with both GCC 9.2.1 and Clang 9.0.0-2

ricab commented 4 years ago

Hi @fortizc, thanks for reporting this. Until recently we were stuck with older compilers, for other reasons (#947). We are catching up now and there are PRs up to update grpc and fix compilation issues.

fortizc commented 4 years ago

@ricab thank you for the quick reply! I was testing some fix and add -DFMT_USE_USER_DEFINED_LITERALS=0 as compile option solves the problem with {fmt}

ricab commented 4 years ago

@fortizc Interesting, thanks for letting us know!

townsend2010 commented 4 years ago

I believe this is fixed now after updating the submodules. I'm closing this, but please reopen if it still occurs with the latest master.