pocoproject / poco

The POCO C++ Libraries are powerful cross-platform C++ libraries for building network- and internet-based applications that run on desktop, server, mobile, IoT, and embedded systems.
https://pocoproject.org
Other
8.33k stars 2.15k forks source link

Build Error in gcc 8 with POCO 1.13.0 Release. #4532

Closed navinagaraj closed 5 months ago

navinagaraj commented 5 months ago

When attempting to build POCO 1.13.0 with gcc 8, we encountered errors during the compilation process. Interestingly, the same version of POCO built successfully with gcc 9.

Error:

In file included from poco-poco-1.13.0-release/Foundation/src/Thread.cpp:28:
poco-poco-1.13.0-release/Foundation/src/Thread_POSIX.cpp: In member function 'void Poco::ThreadImpl::setNameImpl(const string&)':
poco-poco-1.13.0-release/Foundation/src/Thread_POSIX.cpp:156:56: error: no matching function for call to 'std::__cxx11::basic_string<char>::append(const string&, std::__cxx11::basic_string<char>::size_type)'
   truncName.append(threadName, threadName.size() - half);

platform Info:

Kernel Architecture   -> arm  (Linux)           
Kernel Version        -> 4.19 
gcc                   -> 8.1.0           
glibc                 -> 2.19
matejk commented 5 months ago

std::string::append function was introduced in C++20.

andrewauclair commented 5 months ago

std::string::append has existed long before C++20. This appears to be a regression in GCC 8.1 and the below program compiles just fine in 7.5 and 8.2+. I would recommend upgrading your compiler. GCC 8 is rather old at this point.

#include <string>

int main()
{
    std::string a,b = "test";

    a.append(b, 1);
}
matejk commented 5 months ago

I misread the documentation.

Closing the issue.