18.4 missing operator delete(void*, size_t) from c++14

On CentOS 7.4 and 7.5 with gcc 4.8.5, “void operator delete ( void* ptr, std::size_t sz );” from C++14 is missing an implementation in the runtime library and results in a linker error when trying to use unique_ptr with c++14 or greater:

// cm_cxx_unique_ptr.cxx
#include <memory>
int main()
{
  std::unique_ptr<int> u(new int(0));
  return *u;
}



$ /opt/pgi/linux86-64/18.4/bin/pgc++ --c++11 cm_cxx_unique_ptr.cxx -o cm_cxx_unique_ptr.bin
$



$ /opt/pgi/linux86-64/18.4/bin/pgc++ --c++14 cm_cxx_unique_ptr.cxx -o cm_cxx_unique_ptr.bin
/tmp/pgc++OAsv4wSxCtX2.o: In function `std::default_delete<int>::operator()(int*) const':
cm_cxx_unique_ptr.cxx:(.text._ZNKSt14default_deleteIiEclEPi[_ZNKSt14default_deleteIiEclEPi]+0xd): undefined reference to `operator delete(void*, unsigned long)'
$

Are you able to compile your example with g++? I can’t seem to replicate your issue on machines that have a more recent version of libstdc++

From this page C++ Standards Support in GCC - GNU Project it looks like 4.8.5 doesn’t fully support C++14

If you can, install gcc >5, re-run the example and let me know if pgc++ is still spitting out an error.

For reference, you can use -dryrun to see the exact invocation of the linker

Sorry for the delayed response. Yes, g++ builds the example fine. This is reproducible using the system compiler on any RHEL 7 / CentOS 7 system:

$ lsb_release -id
Distributor ID:	CentOS
Description:	CentOS Linux release 7.5.1804 (Core) 
$ which g++
/usr/bin/g++
$ g++ --version
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ $ ls -la /usr/lib64/libstdc++.so.6*
lrwxrwxrwx. 1 root root     19 May 31 11:00 /usr/lib64/libstdc++.so.6 -> libstdc++.so.6.0.19
-rwxr-xr-x. 1 root root 991616 May 15 17:52 /usr/lib64/libstdc++.so.6.0.19
$



$ g++ -std=c++11 cm_cxx_unique_ptr.cxx 
$ g++ -std=c++1y cm_cxx_unique_ptr.cxx 
$



$ /opt/pgi/linux86-64/18.4/bin/pgc++ -std=c++11 cm_cxx_unique_ptr.cxx 
$ /opt/pgi/linux86-64/18.4/bin/pgc++ -std=c++14 cm_cxx_unique_ptr.cxx 
/tmp/pgc++3S9DLIBUhmfW.o: In function `std::default_delete<int>::operator()(int*) const':
cm_cxx_unique_ptr.cxx:(.text._ZNKSt14default_deleteIiEclEPi[_ZNKSt14default_deleteIiEclEPi]+0xd): undefined reference to `operator delete(void*, unsigned long)'
$