-
Notifications
You must be signed in to change notification settings - Fork 370
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
Unable to compile on windows Msys gcc 11.2.0/msvc 2022 pagination_range.h template overload #9111
Comments
Thanks for the detailed bug report. I will try to repro this locally. When you say MSVC 2021, is that a typo and you meant MSVC 2022? |
No problem.
Yes sorry - its the Microsoft visual studio community 2022 edition.
… On 31 May 2022, at 14:43, coryan ***@***.***> wrote:
Thanks for the detailed bug report. I will try to repro this locally. When you say MSVC 2021, is that a typo and you meant MSVC 2022?
—
Reply to this email directly, view it on GitHub <#9111 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AZNJTWCOTZLQVQO6OLHLLA3VMYJOZANCNFSM5XNRMHYQ>.
You are receiving this because you authored the thread.
|
These are mostly notes for myself:
|
A Note about Msys installing Grpc should install all its dependent libs - this should include absl. To build using the msys Cmake package [mingw-w64-x86_64-cmake] - I had to ad the mingw64/bin to the PATH environment variable (would also have to add lib if building statically). (Also have to call cmake from and admin command line as msys terminal will set paths incorrectly) I'll look into using the vcpkg I had built each MSVC package independently using Cmake so far which may be causing the issue. |
Just finished a successful build with MSVC 2022 and vcpkg. |
I figured out why |
I got further along, but the builds failing with very strange errors (see below). I expect I somehow destroyed my dev environment for msys2. I am going to reinstall everything, and try to keep better notes this time. cmake --build cmake-out/mingw
# Output:
# [2/1222] Building CXX object google/cloud/CMakeFiles/google_cloud_cpp_common.dir/internal/build_info.cc.obj
# FAILED: google/cloud/CMakeFiles/google_cloud_cpp_common.dir/internal/build_info.cc.obj
# /mingw64/bin/g++.exe -Dgoogle_cloud_cpp_common_EXPORTS -I/c/src/cpp-develop -isystem /c/src/cpp-develop/cmake-out/mingw -isystem /mingw64/include -O3 -DNDEBUG -fPIC -Wall -Wextra -Wconversion -Wno-sign-conversion -Werror -MD -MT google/cloud/CMakeFiles/google_cloud_cpp_common.dir/internal/build_info.cc.obj -MF google/cloud/CMakeFiles/google_cloud_cpp_common.dir/internal/build_info.cc.obj.d -o google/cloud/CMakeFiles/google_cloud_cpp_common.dir/internal/build_info.cc.obj -c /c/src/cpp-develop/cmake-out/mingw/google/cloud/internal/build_info.cc
# In file included from C:/msys64/mingw64/include/c++/12.1.0/ext/string_conversions.h:41,
# from C:/msys64/mingw64/include/c++/12.1.0/bits/basic_string.h:3960,
# from C:/msys64/mingw64/include/c++/12.1.0/string:53,
# from C:/src/cpp-develop/google/cloud/version.h:21,
# from C:/src/cpp-develop/google/cloud/internal/build_info.h:18,
# from C:/src/cpp-develop/cmake-out/mingw/google/cloud/internal/build_info.cc:15:
# C:/msys64/mingw64/include/c++/12.1.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
# 75 | #include_next <stdlib.h>
# | ^~~~~~~~~~
# compilation terminated. |
Okay, I removed msys2. These are the new notes: Install msys2 from https://www.msys2.org/
Running that program will download and install msys2, and start a Update the base packagesThe instructions say this should be done twice. Run this command in the shell automatically launched by the install wizard. At the end it will ask for confirmation to close the shell (to upgrade it): pacman -Syu Open a new "msys2" shell to run the command again (sigh): pacman -Syu Install development toolsLaunch a "MSYS MinGW 64-bit" shell. Run commands to update / install development tools: pacman -S --needed --noconfirm base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja Install the dependencies from binary packagespacman -S --needed --noconfirm mingw-w64-x86_64-protobuf mingw-w64-x86_64-grpc mingw-w64-x86_64-curl mingw-w64-x86_64-gtest mingw-w64-x86_64-benchmark mingw-w64-x86_64-nlohmann-json |
Compile additional dependencies from sourcemkdir -p /var/tmp/build/crc32c && cd /var/tmp/build/crc32c
curl -sSL https://github.com/google/crc32c/archive/1.1.2.tar.gz | \
tar -xzf - --strip-components=1
cmake -S . -B build-output -G Ninja -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCMAKE_CXX_STANDARD=17 -DCRC32C_BUILD_TESTS=OFF -DCRC32C_BUILD_BENCHMARKS=OFF -DCRC32C_USE_GLOG=OFF
cmake --build build-output
cmake --install build-output --prefix /usr/local |
Compile
|
And finally I was able to repro:
|
To compile most libraries the protobuf headers need a patch: diff --git a/port_def.inc b/port_def.inc
index 7bfcfa9..3605ec1 100644
--- a/port_def.inc
+++ b/port_def.inc
@@ -433,7 +433,7 @@
// Windows declares several inconvenient macro names. We #undef them and then
// restore them in port_undef.inc.
-#ifdef _MSC_VER
+#ifdef _WIN32
#pragma push_macro("CREATE_NEW")
#undef CREATE_NEW
#pragma push_macro("DOUBLE_CLICK")
@@ -476,7 +476,7 @@
#undef STRICT
#pragma push_macro("timezone")
#undef timezone
-#endif // _MSC_VER
+#endif // _WIN32
#if defined(__clang__) || defined(__GNUC__) || defined(_MSC_VER)
// Don't let Objective-C Macros interfere with proto identifiers with the same
diff --git a/port_undef.inc b/port_undef.inc
index 8591762..2504020 100644
--- a/port_undef.inc
+++ b/port_undef.inc
@@ -84,7 +84,7 @@
#endif
// Restore macro that may have been #undef'd in port_def.inc.
-#ifdef _MSC_VER
+#ifdef _WIN32
#pragma pop_macro("CREATE_NEW")
#pragma pop_macro("DOUBLE_CLICK")
#pragma pop_macro("ERROR") |
FWIW, the code compiles fine under GCC 11 and GCC 12 with godbolt: https://godbolt.org/z/3MaT7GoaK I suspect this is a problem specific to MinGW/MSYS2, thought I cannot imagine how that would be the case (a weird macro getting in the way? I would expect different errors. Some patches in the platform? I looked and nothing obvious). In any case, I have a workaround, I will be sending a PR later today. It is a bit ugly, but not unbearable. |
FWIW, I merged a fix to the "ambiguous" call problem. I also sent a fix for the protobuf Please keep in mind that this platform (Msys2) is not something we currently test on. We will be happy to fix bugs if you take the time to report them, and gladly accept fixes too. If you think we should include this in the test matrix, it would help us to have some evidence that this is an important market. |
Cheers ill try downloading the new branch and try it on the test system. |
When compiling on either on MSYS gcc 11.2 or with Msvc make run into over load template issue with the code in pagination_range.h - this is a bug with the msvc / gcc compiler being unable to resolve which template function to use for various classes.
The code was changed in version 1.21 and has not compiled since then.
For current environment - used Msys Pacman to get Grpc / nlohmann/json and libcurl
Built crc32c
C:/msys64/mingw64/bin/cmake.exe -H. -Bbuild-output -G "MinGW Makefiles" -DCMAKE_MAKE_PROGRAM=C:/msys64/mingw64/bin/mingw32-make.exe -DCMAKE_C_COMPILER=C:/msys64/mingw64/bin/gcc.exe -DCMAKE_CXX_COMPILER=C:/msys64/mingw64/bin/g++.exe -DCMAKE_INSTALL_MESSAGE=NEVER -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCMAKE_CXX_STANDARD=17 -DCRC32C_BUILD_TESTS=OFF -DCRC32C_BUILD_BENCHMARKS=OFF -DCRC32C_USE_GLOG=OFF
built google-cloud-cpp via
C:/msys64/mingw64/bin/cmake.exe -H. -Bbuild-output -G "MinGW Makefiles" -DCMAKE_MAKE_PROGRAM=C:/msys64/mingw64/bin/mingw32-make.exe -DCMAKE_C_COMPILER=C:/msys64/mingw64/bin/gcc.exe -DCMAKE_CXX_COMPILER=C:/msys64/mingw64/bin/g++.exe -DCMAKE_INSTALL_MESSAGE=NEVER -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCMAKE_CXX_STANDARD=17 -DBUILD_TESTING=OFF -DGOOGLE_CLOUD_CPP_ENABLE_EXAMPLES=OFF
The text was updated successfully, but these errors were encountered: