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

[macOS] AsyncFdSocket.h: error: 'reinterpret_cast<char*>(15)' is not a constant expression and other related build errors #2099

Open
barracuda156 opened this issue Nov 16, 2023 · 0 comments · May be fixed by #2124

Comments

@barracuda156
Copy link

This bug has not been fixed since about v2023.05.15.00:

:info:build FAILED: CMakeFiles/folly_base.dir/folly/io/async/fdsock/AsyncFdSocket.cpp.o 
:info:build /opt/local/bin/g++-mp-13 -DFMT_SHARED -DFOLLY_XLOG_STRIP_PREFIXES=\"/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_folly/folly/work/folly-v2023.11.13.00:/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_folly/folly/work/build\" -DGFLAGS_IS_A_DLL=0 -D_GNU_SOURCE -D_REENTRANT -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_folly/folly/work/folly-v2023.11.13.00 -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_folly/folly/work/build -I/opt/local/libexec/boost/1.81/include -I/opt/local/include -I/opt/local/libexec/openssl3/include -I/opt/local/include/libfmt10 -pipe -I/opt/local/libexec/openssl3/include -I/opt/local/libexec/boost/1.81/include -Os -std=c++17 -DFOLLY_ALLOW_TFO=0 -fpermissive -DNDEBUG -I/opt/local/libexec/openssl3/include -isystem/opt/local/include/LegacySupport -I/opt/local/libexec/boost/1.81/include -isystem/opt/local/include -Wno-undef-prefix -D_GLIBCXX_USE_CXX11_ABI=0 -std=gnu++17 -arch ppc -mmacosx-version-min=10.6 -fPIC -fcoroutines -g -finput-charset=UTF-8 -fsigned-char -Wall -Wno-deprecated -Wno-deprecated-declarations -Wno-sign-compare -Wno-unused -Wuninitialized -Wunused-label -Wunused-result -Wshadow-compatible-local -Wno-noexcept-type -fopenmp -MD -MT CMakeFiles/folly_base.dir/folly/io/async/fdsock/AsyncFdSocket.cpp.o -MF CMakeFiles/folly_base.dir/folly/io/async/fdsock/AsyncFdSocket.cpp.o.d -o CMakeFiles/folly_base.dir/folly/io/async/fdsock/AsyncFdSocket.cpp.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_folly/folly/work/folly-v2023.11.13.00/folly/io/async/fdsock/AsyncFdSocket.cpp
:info:build In file included from /usr/include/machine/_param.h:29,
:info:build                  from /usr/include/sys/socket.h:77,
:info:build                  from /usr/include/netinet/in.h:85,
:info:build                  from /usr/include/netdb.h:87,
:info:build                  from /opt/local/include/LegacySupport/netdb.h:25,
:info:build                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_folly/folly/work/folly-v2023.11.13.00/folly/net/NetOps.h:91,
:info:build                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_folly/folly/work/folly-v2023.11.13.00/folly/portability/Sockets.h:19,
:info:build                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_folly/folly/work/folly-v2023.11.13.00/folly/detail/IPAddress.h:23,
:info:build                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_folly/folly/work/folly-v2023.11.13.00/folly/IPAddressException.h:31,
:info:build                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_folly/folly/work/folly-v2023.11.13.00/folly/IPAddress.h:37,
:info:build                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_folly/folly/work/folly-v2023.11.13.00/folly/SocketAddress.h:26,
:info:build                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_folly/folly/work/folly-v2023.11.13.00/folly/io/async/AsyncSocket.h:27,
:info:build                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_folly/folly/work/folly-v2023.11.13.00/folly/io/async/fdsock/AsyncFdSocket.h:19,
:info:build                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_folly/folly/work/folly-v2023.11.13.00/folly/io/async/fdsock/AsyncFdSocket.cpp:20:
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_folly/folly/work/folly-v2023.11.13.00/folly/io/async/fdsock/AsyncFdSocket.h:236:25: error: 'reinterpret_cast<char*>(15)' is not a constant expression
:info:build   236 |     std::array<uint8_t, CMSG_SPACE(sizeof(int) * kMaxFdsPerSocketMsg)>
:info:build       |                         ^~~~~~~~~~
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_folly/folly/work/folly-v2023.11.13.00/folly/io/async/fdsock/AsyncFdSocket.h:236:25: note: in template argument for type 'long unsigned int'
:info:build   236 |     std::array<uint8_t, CMSG_SPACE(sizeof(int) * kMaxFdsPerSocketMsg)>
:info:build       |                         ^~~~~~~~~~
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_folly/folly/work/folly-v2023.11.13.00/folly/io/async/fdsock/AsyncFdSocket.h: In member function 'virtual folly::MutableByteRange folly::AsyncFdSocket::FdReadAncillaryDataCallback::getAncillaryDataCtrlBuffer()':
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_folly/folly/work/folly-v2023.11.13.00/folly/io/async/fdsock/AsyncFdSocket.h:227:62: error: no matching function for call to 'folly::Range<unsigned char*>::Range(int&)'
:info:build   227 |       return folly::MutableByteRange(ancillaryDataCtrlBuffer_);
:info:build       |                                                              ^
. . .
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_folly/folly/work/folly-v2023.11.13.00/folly/Range.h:434:12: note:   template argument deduction/substitution failed:
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_folly/folly/work/folly-v2023.11.13.00/folly/Range.h:425:63: error: no type named 'const_type' in 'struct folly::detail::IsUnsignedCharPointer<unsigned char*>'
:info:build   425 |       typename detail::IsUnsignedCharPointer<T>::const_type = 0,
:info:build       |                                                               ^
. . .
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_folly/folly/work/folly-v2023.11.13.00/folly/Range.h:355:7: error: 'int' is not a class, struct, or union type
:info:build   355 |       class = typename std::enable_if<
:info:build       |       ^~~~~

Could someone advise how to fix this?

P. S. Notice that while I build with gcc on 10.6, this bug has broken builds with clangs on every macOS prior to darwin20. This is not a problem exclusive to gcc, old macOS or powerpc.
See discussion to the earlier update of folly in Macports here: macports/macports-ports@03289e4

We have fixed folly by reverting a few breaking commits then, but it is really troublesome to carry multiple complex patches. It is desirable to have it fixed properly in the source.

barracuda156 added a commit to barracuda156/folly that referenced this issue Jan 12, 2024
@barracuda156 barracuda156 linked a pull request Jan 12, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant