2.5.33 does not compile on FreeBSD 13.3p1

Hello,
I find that v2.5.33 does not compile on FreeBSD 13.3p1. Error is below, any advice to fix appreciated.

Thank you.

c++ -DHAVE_CONFIG_H -I.   -I/usr/local/include   -fstack-protector-strong --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIE -DSQLITE_PREPARE_RETRIES=5  -DNDEBUG    -Iexternal/zstd -Iexternal/zstd/common -DXXH_NAMESPACE=ZSTD_ -I/usr/include -I/usr/include -D_THREAD_SAFE -pthread -DLINUX -DSTATIC_PLUGIN   -DVARDIR='"/usr/local/var"'  -DBINDIR='"/usr/local/bin"' -DDATADIR='"/usr/local/share"'  -DCRYPTOPP_INCLUDE_PREFIX='cryptoplugin/src'  -DZSTD_STATIC_LINKING_ONLY    -g -O2 -MT urbackupsrv-AcceptThread.o -MD -MP -MF .deps/urbackupsrv-AcceptThread.Tpo -c -o urbackupsrv-AcceptThread.o `test -f 'AcceptThread.cpp' || echo './'`AcceptThread.cpp
In file included from AcceptThread.cpp:22:
./Server.h:48:7: error: no template named 'auto_ptr' in namespace 'std'
   48 |         std::auto_ptr<ISharedMutex> single_user_mutex;
      |         ~~~~~^
./Server.h:49:7: error: no template named 'auto_ptr' in namespace 'std'
   49 |         std::auto_ptr<IMutex> lock_mutex;
      |         ~~~~~^
./Server.h:50:7: error: no template named 'auto_ptr' in namespace 'std'
   50 |         std::auto_ptr<int> lock_count;
      |         ~~~~~^
./Server.h:51:7: error: no template named 'auto_ptr' in namespace 'std'
   51 |         std::auto_ptr<ICondition> unlock_cond;
      |         ~~~~~^
4 errors generated.
*** Error code 1

Stop.
make[2]: stopped in /root/urbackup/src/urbackup-server-2.5.33
*** Error code 1

Stop.
make[1]: stopped in /root/urbackup/src/urbackup-server-2.5.33
*** Error code 1

Stop.

To answer my own question and help others long the way, the issue is that c++ has moved on and urbackup is somewhat stuck in its time. The std::auto_ptr function has been removed from clang/c++ versions >=17. To reenable, you must configure as follows:

./configure --enable-embedded-cryptopp --enable-embedded-zstd CXXFLAGS=-D_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR

The better solution would be to replace std:auto_ptr with std:unique_ptr, but I did not want to go that route because this has not been tested, and I would be worried about the integrity of my backups. The replacement would affect many source files. Good luck!

1 Like