Issue |
148280
|
Summary |
[libc++] const overload errors with musl
|
Labels |
libc++
|
Assignees |
|
Reporter |
tbwLcFm5uXcAeQ
|
Building [elfutils v0.193](https://sourceware.org/elfutils/ftp/0.193) with LLVM 20.1.7 (libcxx, libcxxabi, compiler-rt and libunwind are enabled by default) and musl (fresh build from master head) fails with a bunch of `wchar.h` and `string.h` const overload errors:
```
/pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/string.h:77:69: error: functions that differ only in their return type cannot be overloaded
77 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const char* strchr(const char* __s, int __c) {
| ~~~~~ ^
/pkg/musl/include/string.h:45:7: note: previous declaration is here
45 | char *strchr (const char *, int);
| ~~~~~~^
```
I couldn't find any reports about this matter; and considering the fact that these const overloads have been in place for 10 years, I wouldn't be surprised if there is an issue with my environment.
Full error:
```
clang++ -std=c++11 -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"/pkg/.elfutils/v/0.193-1/share/locale"' -DDEBUGPRED=0
-DSRCDIR=\"/pkg/.elfutils/src/src\" -DOBJDIR=\"/pkg/.elfutils/src/build/src\" -iquote . -I../../src -I../../lib -I..
-I../../src/../libelf -I../../src/../libebl -I../../src/../libdw -I../../src/../libdwelf -I../../src/../libdwfl
-I../../src/../libdwfl_stacktrace -I../../src/../libasm -I../debuginfod -std=c++11 -Wall -Wshadow -Werror -Wunused
-Wextra -v -march=native -O3 -Wno-error -I/pkg/zlib/include -I/pkg/uargp/include -I/pkg/fts/include -I/pkg/obstack/include
-L/pkg/zlib/lib -L/pkg/uargp/lib -L/pkg/fts/lib -L/pkg/obstack/lib -MT srcfiles.o -MD -MP -MF .deps/srcfiles.Tpo
-c -o srcfiles.o ../../src/srcfiles.cxx
clang version 20.1.7
Target: x86_64-x-linux-musl
Thread model: posix
InstalledDir: /pkg/.llvm/v/20.1.7-3/bin
System configuration file directory: /pkg/.llvm/v/20.1.7-3/cfg
/pkg/.llvm/v/20.1.7-3/bin/clang-20 -cc1 -triple x86_64-x-linux-musl -emit-obj -disable-free -clear-ast-before-backend
-disable-llvm-verifier -discard-value-names -main-file-name srcfiles.cxx -mrelocation-model pic -pic-level 2 -pic-is-pie
-mframe-pointer=none -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu skylake
-target-feature +prfchw -target-feature -cldemote -target-feature +avx -target-feature +aes -target-feature +sahf -target-feature +pclmul [...]
-debugger-tuning=gdb -fdebug-compilation-dir=/pkg/.elfutils/src/build/src -v -fcoverage-compilation-dir=/pkg/.elfutils/src/build/src
-resource-dir /pkg/.llvm/v/20.1.7-3/lib/clang/20 -dependency-file .deps/srcfiles.Tpo -MT srcfiles.o -sys-header-deps -MP
-iquote . -D _GNU_SOURCE -D HAVE_CONFIG_H -D "LOCALEDIR=\"/pkg/.elfutils/v/0.193-1/share/locale\"" -D DEBUGPRED=0
-D "SRCDIR=\"/pkg/.elfutils/src/src\"" -D "OBJDIR=\"/pkg/.elfutils/src/build/src\"" -I ../../src -I ../../lib -I ..
-I ../../src/../libelf -I ../../src/../libebl -I ../../src/../libdw -I ../../src/../libdwelf -I ../../src/../libdwfl
-I ../../src/../libdwfl_stacktrace -I ../../src/../libasm -I ../debuginfod -I /pkg/zlib/include -I /pkg/uargp/include
-I /pkg/fts/include -I /pkg/obstack/include -c-isystem /pkg/linux/include -cxx-isystem /pkg/linux/include
-internal-isystem /pkg/.llvm/v/20.1.7-3/bin/../include/x86_64-x-linux-musl/c++/v1 -internal-isystem /pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1
-internal-isystem /pkg/musl/include -internal-isystem /pkg/.llvm/v/20.1.7-3/lib/clang/20/include -O3 -Wall -Wshadow -Werror -Wunused
-Wextra -Wno-error -std=c++11 -fdeprecated-macro -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions
-vectorize-loops -vectorize-slp -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o srcfiles.o -x c++ ../../src/srcfiles.cxx
clang -cc1 version 20.1.7 based upon LLVM 20.1.7 default target x86_64-x-linux-musl
#include "..." search starts here:
.
#include <...> search starts here:
../../src
../../lib
..
../../src/../libelf
../../src/../libebl
../../src/../libdw
../../src/../libdwelf
../../src/../libdwfl
../../src/../libdwfl_stacktrace
../../src/../libasm
../debuginfod
/pkg/zlib/include
/pkg/uargp/include
/pkg/fts/include
/pkg/obstack/include
/pkg/linux/include
/pkg/.llvm/v/20.1.7-3/bin/../include/x86_64-x-linux-musl/c++/v1
/pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1
/pkg/musl/include
/pkg/.llvm/v/20.1.7-3/lib/clang/20/include
End of search list.
In file included from ../../src/srcfiles.cxx:37:
In file included from /pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/cstring:66:
/pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/string.h:77:69: error: functions that differ only in their return type cannot be overloaded
77 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const char* strchr(const char* __s, int __c) {
| ~~~~~ ^
/pkg/musl/include/string.h:45:7: note: previous declaration is here
45 | char *strchr (const char *, int);
| ~~~~~~^
In file included from ../../src/srcfiles.cxx:37:
In file included from /pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/cstring:66:
/pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/string.h:84:69: error: functions that differ only in their return type cannot be overloaded
84 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const char* strpbrk(const char* __s1, const char* __s2) {
| ~~~~~ ^
/pkg/musl/include/string.h:50:7: note: previous declaration is here
50 | char *strpbrk (const char *, const char *);
| ~~~~~~^
In file included from ../../src/srcfiles.cxx:37:
In file included from /pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/cstring:66:
/pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/string.h:91:69: error: functions that differ only in their return type cannot be overloaded
91 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const char* strrchr(const char* __s, int __c) {
| ~~~~~ ^
/pkg/musl/include/string.h:46:7: note: previous declaration is here
46 | char *strrchr (const char *, int);
| ~~~~~~^
In file included from ../../src/srcfiles.cxx:37:
In file included from /pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/cstring:66:
/pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/string.h:98:69: error: functions that differ only in their return type cannot be overloaded
98 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const void* memchr(const void* __s, int __c, size_t __n) {
| ~~~~~ ^
/pkg/musl/include/string.h:31:7: note: previous declaration is here
31 | void *memchr (const void *, int, size_t);
| ~~~~~~^
In file included from ../../src/srcfiles.cxx:37:
In file included from /pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/cstring:66:
/pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/string.h:105:69: error: functions that differ only in their return type cannot be overloaded
105 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const char* strstr(const char* __s1, const char* __s2) {
| ~~~~~ ^
/pkg/musl/include/string.h:51:7: note: previous declaration is here
51 | char *strstr (const char *, const char *);
| ~~~~~~^
In file included from ../../src/srcfiles.cxx:38:
In file included from /pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/set:519:
In file included from /pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/__algorithm/lexicographical_compare.h:30:
In file included from /pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/cwchar:117:
/pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/wchar.h:144:72: error: functions that differ only in their return type cannot be overloaded
144 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {
| ~~~~~~~~ ^
/pkg/musl/include/wchar.h:64:10: note: previous declaration is here
64 | wchar_t *wcschr (const wchar_t *, wchar_t);
| ~~~~~~~~~^
In file included from ../../src/srcfiles.cxx:38:
In file included from /pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/set:519:
In file included from /pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/__algorithm/lexicographical_compare.h:30:
In file included from /pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/cwchar:117:
/pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/wchar.h:155:1: error: functions that differ only in their return type cannot be overloaded
154 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const wchar_t*
| ~~~~~~~~
155 | wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {
| ^
/pkg/musl/include/wchar.h:69:10: note: previous declaration is here
69 | wchar_t *wcspbrk (const wchar_t *, const wchar_t *);
| ~~~~~~~~~^
In file included from ../../src/srcfiles.cxx:38:
In file included from /pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/set:519:
In file included from /pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/__algorithm/lexicographical_compare.h:30:
In file included from /pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/cwchar:117:
/pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/wchar.h:165:72: error: functions that differ only in their return type cannot be overloaded
165 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const wchar_t* wcsrchr(const wchar_t* __s, wchar_t __c) {
| ~~~~~~~~ ^
/pkg/musl/include/wchar.h:65:10: note: previous declaration is here
65 | wchar_t *wcsrchr (const wchar_t *, wchar_t);
| ~~~~~~~~~^
In file included from ../../src/srcfiles.cxx:38:
In file included from /pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/set:519:
In file included from /pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/__algorithm/lexicographical_compare.h:30:
In file included from /pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/cwchar:117:
/pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/wchar.h:176:1: error: functions that differ only in their return type cannot be overloaded
175 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const wchar_t*
| ~~~~~~~~
176 | wcsstr(const wchar_t* __s1, const wchar_t* __s2) {
| ^
/pkg/musl/include/wchar.h:75:10: note: previous declaration is here
75 | wchar_t *wcsstr (const wchar_t *__restrict, const wchar_t *__restrict);
| ~~~~~~~~~^
In file included from ../../src/srcfiles.cxx:38:
In file included from /pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/set:519:
In file included from /pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/__algorithm/lexicographical_compare.h:30:
In file included from /pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/cwchar:117:
/pkg/.llvm/v/20.1.7-3/bin/../include/c++/v1/wchar.h:187:1: error: functions that differ only in their return type cannot be overloaded
186 | inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const wchar_t*
| ~~~~~~~~
187 | wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {
| ^
/pkg/musl/include/wchar.h:78:10: note: previous declaration is here
78 | wchar_t *wmemchr (const wchar_t *, wchar_t, size_t);
| ~~~~~~~~~^
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs