Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
barracuda156 opened this issue Oct 23, 2023 · 15 comments

Comments

@barracuda156
Copy link
Contributor

: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
Copy link

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:

if(RS_ANDROID)
# As of today Android NDK libc++ doesn't support std::filesystem properly,
# in a very confusing manner the headers have the function declarations but
# then the shared object file doesn't have the implementation.
# This fools the compiler which doesn't report any error but then at runtime
# we get a crash with this error:
# java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol
# "_ZNSt6__ndk14__fs10filesystem20__create_directoriesERKNS1_4pathEPNS_10error_codeE"
# referenced by "/data/app/==/lib/arm64/libretroshare.so
# So set maximum supported C++ version to 14 to workaround this Android bug
# https://github.com/android/ndk/issues/609
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14)
else()
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17)
endif()

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
Copy link
Contributor

defnax commented Nov 24, 2023

@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
Copy link
Contributor Author

barracuda156 commented Nov 24, 2023

@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
Copy link
Contributor Author

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
Copy link
Contributor

defnax commented Nov 24, 2023

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
Copy link
Contributor

csoler commented Nov 24, 2023

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
Copy link
Contributor Author

@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
Copy link
Contributor

defnax commented Dec 4, 2023

@csoler @G10h4ck can you disable libsam on cmakelist?

@defnax
Copy link
Contributor

defnax commented Dec 4, 2023

by default libsam is enabled in the cmakelist, it has no off feature
RetroShare/RetroShare@b3e6d96

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

@barracuda156
Copy link
Contributor Author

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

@defnax
Copy link
Contributor

defnax commented Dec 6, 2023

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
Copy link
Contributor Author

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

@defnax
Copy link
Contributor

defnax commented Dec 6, 2023

where is the fix? i see nothing on libsam repo

@barracuda156
Copy link
Contributor Author

@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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants