facebook / facebook/folly

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

Open
#2,099 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
30.5k
Forks
5.9k
PR merge metrics
No merged PRs in 30d

Description

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(15)' is not a constant expression
:info:build 236 | std::array
: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
: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::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'
:info:build 425 | typename detail::IsUnsignedCharPointer::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: https://github.com/macports/macports-ports/commit/03289e4611ed4b387ce916214c7c6a6a105e25e0

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.