RetroShare / libretroshare

Other
15 stars 28 forks source link

Build fail on Sonoma with Clang: `error: no template named 'binary_function' in namespace 'std'; did you mean '__binary_function'?` #122

Open barracuda156 opened 12 months ago

barracuda156 commented 12 months ago
:info:build In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_net_libretroshare/libretroshare/work/libretroshare-a10087b27a804d0a43745aa39e7515dd691740f3/src/file_sharing/directory_updater.cc:28:
:info:build In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_net_libretroshare/libretroshare/work/libretroshare-a10087b27a804d0a43745aa39e7515dd691740f3/src/rsserver/p3face.h:27:
:info:build In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_net_libretroshare/libretroshare/work/libretroshare-a10087b27a804d0a43745aa39e7515dd691740f3/src/ft/ftserver.h:46:
:info:build In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_net_libretroshare/libretroshare/work/libretroshare-a10087b27a804d0a43745aa39e7515dd691740f3/src/turtle/turtleclientservice.h:28:
:info:build In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_net_libretroshare/libretroshare/work/libretroshare-a10087b27a804d0a43745aa39e7515dd691740f3/src/turtle/rsturtleitem.h:33:
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_net_libretroshare/libretroshare/work/libretroshare-a10087b27a804d0a43745aa39e7515dd691740f3/src/retroshare/rsexpr.h:259:21: error: no template named 'binary_function' in namespace 'std'; did you mean '__binary_function'?
:info:build         public std::binary_function< char , char , bool> {
:info:build                ~~~~~^~~~~~~~~~~~~~~
:info:build                     __binary_function
ryandesign commented 12 months ago

std::binary_function was deprecated in C++11 and removed in C++17. The workaround would presumably be to put the compiler into a pre-C++17 mode. However, CMakeLists.txt currently specifies that at least C++17 is required:

https://github.com/RetroShare/libretroshare/blob/a10087b27a804d0a43745aa39e7515dd691740f3/CMakeLists.txt#L215-L229

However, there is an exception made when building for Android which uses C++14 in that case, so maybe the code doesn't actually need C++17 and using C++14 would work.

defnax commented 10 months ago

@ryandesign can you help little bit fix compile issues for macos? when you has time.

cmakelists added by @G10h4ck , since cmakelist added i has more issue to compile retroshare on macos. example i cant disable libsam more, maybe cmakelist ignore stuff from retroshare.pri file?

barracuda156 commented 10 months ago

@ryandesign By the way, maybe -D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION gonna work. Let me try.

UPD. It actually works:

svacchanda@Sergeys-MacBook-Air ~ % port -v installed libretroshare
The following ports are currently installed:
  libretroshare @2023.11.07_0 (active) requested_variants='' platform='darwin 23' archs='arm64' date='2023-11-24T18:06:21+0800'

However passing it from the portfile does not. Perhaps CMakeLists somewhere reset flags, so it gets lost and the build remains broken. I added the flag into CMakeLists, it fixed it. Gonna make a PR tonight.

barracuda156 commented 10 months ago

maybe cmakelist ignore stuff from retroshare.pri file?

@defnax I do not think this should be used at all here: we do not need Qt for libretroshare.

defnax commented 10 months ago

i speak only for disable libsam feature, im thinking cmake project file has no feature to disable libsam on compile, you know what i mean? im not sure, im only thinking.
for cli compile when i delete libsam folder it gets automaticly downloaded via git

You need to join rs dev network,there you can meet all rs devs there and you can share your macos builds when get success :)

csoler commented 10 months ago

maybe cmakelist ignore stuff from retroshare.pri file?

@defnax I do not think this should be used at all here: we do not need Qt for libretroshare.

Qt is not needed to compile the source files, but qmake can be used to create the makefiles. It's the simplest way to go imo.

If you find some missing flags, libs, etc, we can add them to the .pro for MacOS.

barracuda156 commented 10 months ago

@defnax Let’s give a few days to libsam developer, hopefully the issue gets resolved. Otherwise I will look into how to get rid of it in a way it works.

defnax commented 10 months ago

@csoler @G10h4ck can you disable libsam on cmakelist?

defnax commented 10 months ago

by default libsam is enabled in the cmakelist, it has no off feature https://github.com/RetroShare/RetroShare/commit/b3e6d96f3ba4d353e1767508ed75784fc0878247

on maco is compile from terminal broken not possible to disable libsam3 check

barracuda156 commented 10 months ago

@defnax We rather have it fixed than disabled, perhaps. (I did not investigate what specifically it is used for though.)

defnax commented 10 months ago

sounds great, i started to buld rs on a macos catalina(virtualbox) with a newer qt, not yet done. But i build success full on qtreator with macos 10.13.6

You can test & help if you can compile webui & retroshare-service too? there get compile issues i think

barracuda156 commented 10 months ago

@defnax I should have some time next week for this. Will update then.

defnax commented 10 months ago

where is the fix? i see nothing on libsam repo

barracuda156 commented 10 months ago

@defnax I am expecting @eyedeekay to address libsam issue, then I can do testing on my end and implements fix-ups, be any needed, for specific macOS versions.

eyedeekay commented 10 months ago

Expect a fix sometime near the beginning of next week, shortly after we publish the main release of Java I2P.