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
g++ complains with multiple definition of static constexpr in mqtt::message #442
Comments
🤦 |
When changing to shared library the problem does not happen. |
There have been similar issues popping up over the years as the language and compilers evolve, often without clear guidelines or improper implementations. It just gets tricky trying to implement something that works for one target that doesn't break another. Which version(s) of g++ are you seeing this in? I will try to recreate it. |
Ubuntu 20.4 (Jetson) |
OK. Nice. I have a pile of NVidia boards right in front of me. I'll give it a try. |
Any Updates on this topic? I am still having the same issue with 1.2.0 |
Exactly the same issue here unfortunately. Also using 1.2.0 with Conan and CMake and g++ (Debian 10.2.1-6) 10.2.1 20210110. Is there a workaround? |
Same here using VCPKG, CMake and g++, Ubuntu 22.04 |
I have created my own conan package where I have fixed the issue and made it available in my local cache. You could also write your own patch for version 1.2.0. This is the patch file i have created to fix the issue for me. |
Thank you, this helps! |
OK. I see the problem... @xkszlti posted the underlying problem in #216 with the gcc issue that is causing this problem. I will put the full issue here, so that I will remember all this in six months. The problem is that the library is being built to the C++11 spec with gcc and the applications are being built to the C++17 spec. It is the mixing of the standards that is causing the problem. If both the library and app were compiled to C++11 or to C++17, then there would not be a linker issue. If the library were compiled to C++17, it looks like everything forward might be fine? I can compile the app as C++20 with the C++17 library and it works. This blurb from the gcc bug report explains:
In the short term I think @PlaZm0 's patch is the best solution... just don't use The upcoming release (v1.3) will keep with C++11, so that would work for now (I hope!) The following release (v1.4?) will make the jump to C++17, and then we can make use of |
OK, I think I got all occurrences of this problem. The same pattern was present in the classes The I pushed it all the way up to master. Let me know if there are still any problems with this version. |
I'm assuming this is fixed now. Please re-open if not. |
Me too. But got no error with clang. |
@itfanr What version of the library are you using? |
I installed paho.mqtt.cpp with vcpkg. |
It looks like vcpkg is still using v1.2 of this library? Unfortunately, we don't maintain any of the packages distributed by the different managers. Perhaps ask them to update their package? |
@fpagliughi Thank you. The later released vcpkg have updated the version of paho.mqtt.cpp . I will try to update my vcpkg baseline. |
I keep having the same problem that was described in issue #216.
Apparently the change to cmake compiling with c++17 has been reverted.
I'm using version 1.2.0.
I saw that this only happens if you use it as a static library
The text was updated successfully, but these errors were encountered: