[GH-ISSUE #1292] src/lib/ipc/IpcServerProxy.cpp:98:29: error: ‘static void ProtocolUtil::writef(void*, const char*, va_list)’ is private within this context #1030

Open
opened 2026-05-05 07:23:53 -06:00 by gitea-mirror · 3 comments
Owner

Originally created by @stintel on GitHub (Sep 18, 2021).
Original GitHub issue: https://github.com/debauchee/barrier/issues/1292

What happened?

Barrier does not compile on a RISC-V system.

Version

v2.3.3

Git commit hash (if applicable)

No response

If applicable, where did you install Barrier from?

Gentoo ebuild.

What OSes are you seeing the problem on? (Check all that apply)

Linux

What OS versions are you using?

Gentoo Base System release 2.7

Relevant log output

[49/182] /usr/bin/riscv64-unknown-linux-gnu-g++ -DBARRIER_BUILD_DATE=\"20210918\" -DBARRIER_BUILD_NUMBER=1 -DBARRIER_REVISION=\"00000000\" -DBARRIER_VERSION=\"2.3.3-release\" -DBARRIER_VERSION_STRING=\"2.3.3-release-release\" -DHAVE_CON
FIG_H -DNDEBUG -DSYSAPI_UNIX=1 -DWINAPI_XWINDOWS=1 -I/var/tmp/portage/x11-misc/barrier-2.3.3/work/barrier-2.3.3/src/./lib -I/var/tmp/portage/x11-misc/barrier-2.3.3/work/barrier-2.3.3_build/src/lib -isystem /usr/include/avahi-compat-libd
ns_sd  -march=rv64imafdc -mcpu=sifive-u74 -O2 -pipe -fPIC -pthread -std=c++14 -MD -MT src/lib/ipc/CMakeFiles/ipc.dir/IpcServerProxy.cpp.o -MF src/lib/ipc/CMakeFiles/ipc.dir/IpcServerProxy.cpp.o.d -o src/lib/ipc/CMakeFiles/ipc.dir/IpcSer
verProxy.cpp.o -c /var/tmp/portage/x11-misc/barrier-2.3.3/work/barrier-2.3.3/src/lib/ipc/IpcServerProxy.cpp
FAILED: src/lib/ipc/CMakeFiles/ipc.dir/IpcServerProxy.cpp.o
/usr/bin/riscv64-unknown-linux-gnu-g++ -DBARRIER_BUILD_DATE=\"20210918\" -DBARRIER_BUILD_NUMBER=1 -DBARRIER_REVISION=\"00000000\" -DBARRIER_VERSION=\"2.3.3-release\" -DBARRIER_VERSION_STRING=\"2.3.3-release-release\" -DHAVE_CONFIG_H -DN
DEBUG -DSYSAPI_UNIX=1 -DWINAPI_XWINDOWS=1 -I/var/tmp/portage/x11-misc/barrier-2.3.3/work/barrier-2.3.3/src/./lib -I/var/tmp/portage/x11-misc/barrier-2.3.3/work/barrier-2.3.3_build/src/lib -isystem /usr/include/avahi-compat-libdns_sd  -m
arch=rv64imafdc -mcpu=sifive-u74 -O2 -pipe -fPIC -pthread -std=c++14 -MD -MT src/lib/ipc/CMakeFiles/ipc.dir/IpcServerProxy.cpp.o -MF src/lib/ipc/CMakeFiles/ipc.dir/IpcServerProxy.cpp.o.d -o src/lib/ipc/CMakeFiles/ipc.dir/IpcServerProxy.
cpp.o -c /var/tmp/portage/x11-misc/barrier-2.3.3/work/barrier-2.3.3/src/lib/ipc/IpcServerProxy.cpp
/var/tmp/portage/x11-misc/barrier-2.3.3/work/barrier-2.3.3/src/lib/ipc/IpcServerProxy.cpp: In member function ‘void IpcServerProxy::send(const IpcMessage&)’:
/var/tmp/portage/x11-misc/barrier-2.3.3/work/barrier-2.3.3/src/lib/ipc/IpcServerProxy.cpp:98:29: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the
second:
   98 |         ProtocolUtil::writef(&m_stream, kIpcMsgCommand, &command);
      |         ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /var/tmp/portage/x11-misc/barrier-2.3.3/work/barrier-2.3.3/src/lib/ipc/IpcServerProxy.cpp:23:
/var/tmp/portage/x11-misc/barrier-2.3.3/work/barrier-2.3.3/src/./lib/barrier/ProtocolUtil.h:82:28: note: candidate 1: ‘static void ProtocolUtil::writef(void*, const char*, va_list)82 |     static void            writef(void*, const char* fmt, va_list);
      |                            ^~~~~~
/var/tmp/portage/x11-misc/barrier-2.3.3/work/barrier-2.3.3/src/./lib/barrier/ProtocolUtil.h:53:28: note: candidate 2: ‘static void ProtocolUtil::writef(barrier::IStream*, const char*, ...)53 |     static void            writef(barrier::IStream*,
      |                            ^~~~~~
/var/tmp/portage/x11-misc/barrier-2.3.3/work/barrier-2.3.3/src/lib/ipc/IpcServerProxy.cpp:98:29: error: ‘static void ProtocolUtil::writef(void*, const char*, va_list)’ is private within this context
   98 |         ProtocolUtil::writef(&m_stream, kIpcMsgCommand, &command);
      |         ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /var/tmp/portage/x11-misc/barrier-2.3.3/work/barrier-2.3.3/src/lib/ipc/IpcServerProxy.cpp:23:
/var/tmp/portage/x11-misc/barrier-2.3.3/work/barrier-2.3.3/src/./lib/barrier/ProtocolUtil.h:82:28: note: declared private here
   82 |     static void            writef(void*, const char* fmt, va_list);
      |                            ^~~~~~
ninja: build stopped: subcommand failed.

Any other information

No response

Originally created by @stintel on GitHub (Sep 18, 2021). Original GitHub issue: https://github.com/debauchee/barrier/issues/1292 ### What happened? Barrier does not compile on a RISC-V system. ### Version v2.3.3 ### Git commit hash (if applicable) _No response_ ### If applicable, where did you install Barrier from? Gentoo ebuild. ### What OSes are you seeing the problem on? (Check all that apply) Linux ### What OS versions are you using? Gentoo Base System release 2.7 ### Relevant log output ```shell [49/182] /usr/bin/riscv64-unknown-linux-gnu-g++ -DBARRIER_BUILD_DATE=\"20210918\" -DBARRIER_BUILD_NUMBER=1 -DBARRIER_REVISION=\"00000000\" -DBARRIER_VERSION=\"2.3.3-release\" -DBARRIER_VERSION_STRING=\"2.3.3-release-release\" -DHAVE_CON FIG_H -DNDEBUG -DSYSAPI_UNIX=1 -DWINAPI_XWINDOWS=1 -I/var/tmp/portage/x11-misc/barrier-2.3.3/work/barrier-2.3.3/src/./lib -I/var/tmp/portage/x11-misc/barrier-2.3.3/work/barrier-2.3.3_build/src/lib -isystem /usr/include/avahi-compat-libd ns_sd -march=rv64imafdc -mcpu=sifive-u74 -O2 -pipe -fPIC -pthread -std=c++14 -MD -MT src/lib/ipc/CMakeFiles/ipc.dir/IpcServerProxy.cpp.o -MF src/lib/ipc/CMakeFiles/ipc.dir/IpcServerProxy.cpp.o.d -o src/lib/ipc/CMakeFiles/ipc.dir/IpcSer verProxy.cpp.o -c /var/tmp/portage/x11-misc/barrier-2.3.3/work/barrier-2.3.3/src/lib/ipc/IpcServerProxy.cpp FAILED: src/lib/ipc/CMakeFiles/ipc.dir/IpcServerProxy.cpp.o /usr/bin/riscv64-unknown-linux-gnu-g++ -DBARRIER_BUILD_DATE=\"20210918\" -DBARRIER_BUILD_NUMBER=1 -DBARRIER_REVISION=\"00000000\" -DBARRIER_VERSION=\"2.3.3-release\" -DBARRIER_VERSION_STRING=\"2.3.3-release-release\" -DHAVE_CONFIG_H -DN DEBUG -DSYSAPI_UNIX=1 -DWINAPI_XWINDOWS=1 -I/var/tmp/portage/x11-misc/barrier-2.3.3/work/barrier-2.3.3/src/./lib -I/var/tmp/portage/x11-misc/barrier-2.3.3/work/barrier-2.3.3_build/src/lib -isystem /usr/include/avahi-compat-libdns_sd -m arch=rv64imafdc -mcpu=sifive-u74 -O2 -pipe -fPIC -pthread -std=c++14 -MD -MT src/lib/ipc/CMakeFiles/ipc.dir/IpcServerProxy.cpp.o -MF src/lib/ipc/CMakeFiles/ipc.dir/IpcServerProxy.cpp.o.d -o src/lib/ipc/CMakeFiles/ipc.dir/IpcServerProxy. cpp.o -c /var/tmp/portage/x11-misc/barrier-2.3.3/work/barrier-2.3.3/src/lib/ipc/IpcServerProxy.cpp /var/tmp/portage/x11-misc/barrier-2.3.3/work/barrier-2.3.3/src/lib/ipc/IpcServerProxy.cpp: In member function ‘void IpcServerProxy::send(const IpcMessage&)’: /var/tmp/portage/x11-misc/barrier-2.3.3/work/barrier-2.3.3/src/lib/ipc/IpcServerProxy.cpp:98:29: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: 98 | ProtocolUtil::writef(&m_stream, kIpcMsgCommand, &command); | ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /var/tmp/portage/x11-misc/barrier-2.3.3/work/barrier-2.3.3/src/lib/ipc/IpcServerProxy.cpp:23: /var/tmp/portage/x11-misc/barrier-2.3.3/work/barrier-2.3.3/src/./lib/barrier/ProtocolUtil.h:82:28: note: candidate 1: ‘static void ProtocolUtil::writef(void*, const char*, va_list)’ 82 | static void writef(void*, const char* fmt, va_list); | ^~~~~~ /var/tmp/portage/x11-misc/barrier-2.3.3/work/barrier-2.3.3/src/./lib/barrier/ProtocolUtil.h:53:28: note: candidate 2: ‘static void ProtocolUtil::writef(barrier::IStream*, const char*, ...)’ 53 | static void writef(barrier::IStream*, | ^~~~~~ /var/tmp/portage/x11-misc/barrier-2.3.3/work/barrier-2.3.3/src/lib/ipc/IpcServerProxy.cpp:98:29: error: ‘static void ProtocolUtil::writef(void*, const char*, va_list)’ is private within this context 98 | ProtocolUtil::writef(&m_stream, kIpcMsgCommand, &command); | ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /var/tmp/portage/x11-misc/barrier-2.3.3/work/barrier-2.3.3/src/lib/ipc/IpcServerProxy.cpp:23: /var/tmp/portage/x11-misc/barrier-2.3.3/work/barrier-2.3.3/src/./lib/barrier/ProtocolUtil.h:82:28: note: declared private here 82 | static void writef(void*, const char* fmt, va_list); | ^~~~~~ ninja: build stopped: subcommand failed. ``` ### Any other information _No response_
gitea-mirror added the
bug
label 2026-05-05 07:23:53 -06:00
Author
Owner

@asheplyakov commented on GitHub (Mar 21, 2024):

Could you please check if this patch helps?

<!-- gh-comment-id:2011208414 --> @asheplyakov commented on GitHub (Mar 21, 2024): Could you please check if [this patch](https://git.altlinux.org/gears/b/barrier.git?p=barrier.git;a=blob_plain;f=.gear/0001-ProtocolUtil-fixed-FTBFS-with-GCC-13.patch;h=0183da47aab04ab5e4f96bb0123dcb67cd4e9612;hb=00b10bdff63d4ca336d356d6a394c80879d20c1d) helps?
Author
Owner

@asheplyakov commented on GitHub (Mar 21, 2024):

Explanation: va_list is void * on risc-v (and a few other architectures, such as LoongArch).
Thus

ProtocolUtil::writef(&m_stream, kIpcMsgCommand, &command);

is indeed ambiguous:

  • it's OK to implicitly convert both &m_stream and &command to void *, so ProtocolUtil::writef(void*, const char*, va_list) matches
  • ProtocolUtil::writef(barrier::IStream*, const char*, ...) obviously matches

To avoid the above ambiguity one could change the type of the 1st argument of ProtocolUtil::writef(void*, const char*, va_list) from void * to std::uint8_t* (or something similar). Implicit conversion from barrier::IStream* to std::uint8_t* is not OK, hence the compiler has no problem picking the right overload (that is, ProtocolUtil::writef(barrier::IStream*, const char*, ...))

<!-- gh-comment-id:2011221104 --> @asheplyakov commented on GitHub (Mar 21, 2024): Explanation: `va_list` is `void *` on risc-v (and a few other architectures, such as LoongArch). Thus ```c++ ProtocolUtil::writef(&m_stream, kIpcMsgCommand, &command); ``` is indeed ambiguous: - it's OK to **implicitly** convert both `&m_stream` and `&command` to `void *`, so `ProtocolUtil::writef(void*, const char*, va_list)` matches - `ProtocolUtil::writef(barrier::IStream*, const char*, ...)` obviously matches To avoid the above ambiguity one could change the type of the 1st argument of `ProtocolUtil::writef(void*, const char*, va_list)` from `void *` to `std::uint8_t*` (or something similar). Implicit conversion from `barrier::IStream*` to `std::uint8_t*` is not OK, hence the compiler has no problem picking the right overload (that is, `ProtocolUtil::writef(barrier::IStream*, const char*, ...)`)
Author
Owner

@stintel commented on GitHub (Mar 21, 2024):

Apparently barrier 2.4.0 builds fine on RISC-V using gcc version 13.2.1 20240210 (Gentoo 13.2.1_p20240210 p13).

<!-- gh-comment-id:2013779739 --> @stintel commented on GitHub (Mar 21, 2024): Apparently barrier 2.4.0 builds fine on RISC-V using gcc version 13.2.1 20240210 (Gentoo 13.2.1_p20240210 p13).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/barrier#1030
No description provided.