[Bug] Failed To Build Rocketmq-clients-cpp On MSVC-19.43.34810

by ADMIN 63 views

Introduction

RocketMQ is a popular open-source messaging and streaming platform developed by Apache. The RocketMQ-Client-CPP is a C++ client library for interacting with the RocketMQ server. However, users have reported issues building the library on certain versions of the Microsoft Visual C++ (MSVC) compiler. In this article, we will investigate a specific issue where the library fails to build on MSVC-19.43.34810.

Before Creating the Bug Report

Before creating a bug report, it is essential to ensure that the issue is not a duplicate and that the bug belongs to the current repository. In this case, the user has confirmed that the issue is not a duplicate and that it belongs to the RocketMQ-Client-CPP repository.

Programming Language and Runtime Platform Environment

The programming language used in this issue is C++. The runtime platform environment is Windows 11 24H2.

RocketMQ Version and Run or Compiler Version

The RocketMQ version used is rocketmq-clients-cpp-5.0.2. The run or compiler version used is MSVC-19.43.34810, CMake-4.0.1, abseil-cpp-20250127.1, protobuf-6.30.2, grpc-1.70.2, and openssl-3.5.0.

Describe the Bug

The user reported an error when building the library. The error message is:

error C3646: 'LOCKS_EXCLUDED': unknown override specifier

This error occurs in the UniqueIdGenerator.h file at line 34.

Steps to Reproduce

To reproduce the issue, the user executed the following commands:

C:\Program Files\CMake\bin\cmake.exe -G Ninja -D CMAKE_CXX_STANDARD=17 -D BUILD_EXAMPLES=OFF -D CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded{{content}}lt;{{content}}lt;CONFIG:Debug>:Debug> -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=C:\Users\admin\libraries\MSVC-19.43.34810\Release\rocketmq-clients-cpp-5.0.2 -D CMAKE_PREFIX_PATH=C:\Users\admin\libraries\MSVC-19.43.34810\Release\abseil-cpp-20250127.1;C:\Users\admin\libraries\MSVC-19.43.34810\Release\argparse-3.2;C:\Users\admin\libraries\MSVC-19.43.34810\Release\boost-1.88.0;C:\Users\admin\libraries\MSVC-19.43.34810\Release\bzip2-1.1.0;C:\Users\admin\libraries\MSVC-19.43.34810\Release\c-ares-1.34.5;C:\Users\admin\libraries\MSVC-19.43.34810\Release\eigen-3.4;C:\Users\admin\libraries\MSVC-19.43.34810\Release\grpc-1.70.2;C:\Users\admin\libraries\MSVC-19.43.34810\Release\hdf5-1.14.6;C:\Users\admin\libraries\MSVC-19.43.34810\Release\HighFive-2.10.1;C:\\admin\libraries\MSVC-19.43.34810\Release\json-3.12.0;C:\Users\admin\libraries\MSVC-19.43.34810\Release\libpng-1.6.47;C:\Users\admin\libraries\MSVC-19.43.34810\Release\lz4-1.10.0;C:\Users\admin\libraries\MSVC-19.43.34810\Release\nlopt-2.10.0;C:\Users\admin\libraries\MSVC-19.43.34810\Release\opencv-4.11.0;C:\Users\admin\libraries\MSVC-19.43.34810\Release\openssl-3.5.0;C:\Users\admin\libraries\MSVC-19.43.34810\Release\protobuf-6.30.2;C:\Users\admin\libraries\MSVC-19.43.34810\Release\re2-2024-07-02;C:\Users\admin\libraries\MSVC-19.43.34810\Release\spdlog-1.15.2;C:\Users\admin\libraries\MSVC-19.43.34810\Release\taskflow-3.9.0;C:\Users\admin\libraries\MSVC-19.43.34810\Release\zlib-1.3.1;C:\Users\admin\libraries\MSVC-19.43.34810\Release\zstd-1.5.7;C:\Users\admin\Desktop\projects\scripts\tools\strawberry-perl-5.40.0.1-64bit-portable\perl\bin;C:\Users\admin\Desktop\projects\scripts\tools\nasm-2.16.03 -B C:\Users\admin\Desktop\projects\scripts\pack\rocketmq-clients-cpp-5.0.2\build_MSVC-19.43.34810_Release -S C:\Users\admin\Desktop\projects\scripts\pack\rocketmq-clients-cpp-5.0.2
C:\Program Files\CMake\bin\cmake.exe --build C:\Users\admin\Desktop\projects\scripts\pack\rocketmq-clients-cpp-5.0.2\build_MSVC-19.43.34810_Release -j 32 --config Release --clean-first

What Did You Expect to See?

The user expected to see a successful build.

What Did You See Instead?

The user saw a failed build with the following error message:

error C3646: 'LOCKS_EXCLUDED': unknown override specifier

Additional Context

The user provided a full log of the build process, which can be found in the attachment.

Conclusion

In conclusion, the issue of failed building of RocketMQ-Client-CPP on MSVC-19.43.34810 is a complex one. The error message error C3646: 'LOCKS_EXCLUDED': unknown override specifier suggests that there is an issue with the LOCKS_EXCLUDED macro. Further investigation is required to determine the root cause of the issue and to provide a solution.

Possible Solutions

  1. Update the LOCKS_EXCLUDED macro: The LOCKS_EXCLUDED macro may be outdated or incorrect. Updating it to the latest version or correcting it may resolve the issue.
  2. Use a different compiler: The issue may be specific to the MSVC-19.43.34810 compiler. Using a different compiler, such as GCC or Clang, may resolve the issue.
  3. Update the C++ standard: The C++ standard used by the library may be outdated or incorrect. Updating it to the latest version may resolve the issue.
  4. Use a different version of the library: The issue may be specific to the rocketmq-clients-cpp-5.0.2 library. Using a different version of the library may resolve the issue.

Future Work

Further investigation is required to determine the root cause of the issue and to provide a solution. The following steps can be taken:

  1. Investigate the LOCKS_EXCLUDED macro: Further investigation is required to determine the correct usage of the LOCKS_EXCLUDED macro.
  2. Test with different compilers: Testing the library with different compilers, such as GCC or Clang, may help determine if the issue is specific to the MSVC-19.43.34810 compiler.
  3. Update the C++ standard: Updating the C++ standard used by the library may resolve the issue.
  4. Use a different version of the library: Using a different version of the library may resolve the issue.

References

License

This article is licensed under the Apache License, Version 2.0.

Introduction

In our previous article, we discussed a bug where the RocketMQ-Client-CPP failed to build on MSVC-19.43.34810. In this article, we will provide a Q&A section to address some of the common questions and concerns related to this issue.

Q: What is the cause of the error error C3646: 'LOCKS_EXCLUDED': unknown override specifier?

A: The error error C3646: 'LOCKS_EXCLUDED': unknown override specifier is caused by an issue with the LOCKS_EXCLUDED macro. The macro is used to exclude locks from certain functions, but it is not correctly defined in the current version of the library.

Q: How can I fix the error error C3646: 'LOCKS_EXCLUDED': unknown override specifier?

A: To fix the error error C3646: 'LOCKS_EXCLUDED': unknown override specifier, you can try the following:

  1. Update the LOCKS_EXCLUDED macro to the latest version or correct it.
  2. Use a different compiler, such as GCC or Clang, to see if the issue is specific to the MSVC-19.43.34810 compiler.
  3. Update the C++ standard used by the library to the latest version.
  4. Use a different version of the library to see if the issue is specific to the rocketmq-clients-cpp-5.0.2 library.

Q: What are the possible solutions to this issue?

A: The possible solutions to this issue are:

  1. Update the LOCKS_EXCLUDED macro.
  2. Use a different compiler.
  3. Update the C++ standard.
  4. Use a different version of the library.

Q: How can I determine the root cause of the issue?

A: To determine the root cause of the issue, you can try the following:

  1. Investigate the LOCKS_EXCLUDED macro to determine the correct usage.
  2. Test with different compilers to see if the issue is specific to the MSVC-19.43.34810 compiler.
  3. Update the C++ standard used by the library to the latest version.
  4. Use a different version of the library to see if the issue is specific to the rocketmq-clients-cpp-5.0.2 library.

Q: What are the next steps to resolve this issue?

A: The next steps to resolve this issue are:

  1. Investigate the LOCKS_EXCLUDED macro further.
  2. Test with different compilers.
  3. Update the C++ standard used by the library.
  4. Use a different version of the library.

Q: What are the potential risks of using a different compiler or library version?

A: The potential risks of using a different compiler or library version are:

  1. Incompatibility with the current codebase.
  2. Potential for new bugs or issues.
  3. Inability to reproduce the issue with the new compiler or library version.

Q: How can I mitigate the risks of using a different compiler or library version?

A: To mitigate the risks of using a different compiler or library version, you can try the following:

  1. Test the new compiler or library version thoroughly.
  2. that the new compiler or library version is compatible with the current codebase.
  3. Update the codebase to use the new compiler or library version.

Q: What are the best practices for resolving this issue?

A: The best practices for resolving this issue are:

  1. Investigate the issue thoroughly.
  2. Test with different compilers and library versions.
  3. Update the C++ standard used by the library.
  4. Use a different version of the library.

Q: What are the potential benefits of resolving this issue?

A: The potential benefits of resolving this issue are:

  1. Improved code quality.
  2. Increased compatibility with different compilers and library versions.
  3. Reduced risk of bugs and issues.
  4. Improved maintainability of the codebase.

Q: How can I ensure that the issue is resolved?

A: To ensure that the issue is resolved, you can try the following:

  1. Verify that the issue is fixed with the new compiler or library version.
  2. Test the codebase thoroughly with the new compiler or library version.
  3. Update the codebase to use the new compiler or library version.
  4. Verify that the issue is not reintroduced with future updates or changes.