dockerzhang opened a new issue #975: URL: https://github.com/apache/incubator-inlong/issues/975
<p>We encountered tube cpp client link error when we migrate build tools from CMake to Bazel.</p> <p>The error message is as below:</p> <p>client_connection.cc: (.text+0xff0): undefined reference to `tubemq::ClientConnection::kConnnectMaxTimeMs'</p> <p>client_service.cc: <br/> (.text._ZN6tubemq14ConnectionPoolC2ERSt10shared_ptrINS_12ExecutorPoolEE<span class="error">[_ZN6tubemq14ConnectionPoolC5ERSt10shared_ptrINS_12ExecutorPoolEE]</span>+0xbe): undefined reference to `tubemq::ConnectionPool::kRegularTimerSecond'</p> <p><span class="image-wrap" style=""><img src="https://issues.apache.org/jira/secure/attachment/13013968/13013968_image-2020-10-22-17-38-01-225.png" height="218" width="1119" style="border: 0px solid black" /></span></p> <p>This link error can be reproduced in CMake environment when you remove "-O2" in CMAKE_CXX_FLAGS</p> <p><span class="image-wrap" style=""><img src="https://issues.apache.org/jira/secure/attachment/13013967/13013967_image-2020-10-22-17-41-13-790.png" height="213" width="823" style="border: 0px solid black" /></span></p> <p>According to cpp standard(<a href="https://en.cppreference.com/w/cpp/language/static)," class="external-link" rel="nofollow">https://en.cppreference.com/w/cpp/language/static),</a> </p> <p>"If a const non-inline (since C+<ins>17) static data member or a constexpr static data member (since C</ins><ins>11)(until C</ins><ins>17) is odr-used, <font color="#FF0000">a definition at namespace scope is still required</font>, but it cannot have an initializer. A definition may be provided even though redundant (since C</ins>+17)."</p> <p> </p> <p>Possible fix:</p> <ol> <li>Add static const variable definition in src/client_connection.cc and src/client_service.cc</li> <li>Or change static const variable to enum</li> </ol> <p> </p> <p>Further consideration:</p> <p>Turn off compiler optimization in CI to make sure the compiler optimization will not shadow the compile error or link error</p> <i>JIRA link - <a href="https://issues.apache.org/jira/browse/INLONG-380">[INLONG-380]</a> created by sheepke</i> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
