Skip to content

error: cannot add 'abi_tag' attribute in a redeclaration #23413

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

Closed
stbergmann opened this issue Jan 15, 2025 · 2 comments · Fixed by #23414
Closed

error: cannot add 'abi_tag' attribute in a redeclaration #23413

stbergmann opened this issue Jan 15, 2025 · 2 comments · Fixed by #23414

Comments

@stbergmann
Copy link
Contributor

Please include the following in your bug report:

Version of emscripten/emsdk:

$ emcc -v
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 4.0.0-git (1fb631cdf803fd343b08179bc2b73ea6211487ce)
clang version 20.0.0git (/home/sberg/emsdk/4.0.0/sources//llvm-project 322eb1a92e6d4266184060346616fa0dbe39e731)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /home/sberg/emsdk/4.0.0/emsdk/llvm/git/build_main_64/bin

Failing command line in full:

$ cat test.cc
#include <xlocale.h>
#include <locale>
$ em++ -fsyntax-only test.cc
In file included from test.cc:2:
In file included from /home/sberg/emsdk/4.0.0/emsdk/emscripten/main/cache/sysroot/include/c++/v1/locale:205:
In file included from /home/sberg/emsdk/4.0.0/emsdk/emscripten/main/cache/sysroot/include/c++/v1/__locale:14:
In file included from /home/sberg/emsdk/4.0.0/emsdk/emscripten/main/cache/sysroot/include/c++/v1/__locale_dir/locale_base_api.h:27:
/home/sberg/emsdk/4.0.0/emsdk/emscripten/main/cache/sysroot/include/c++/v1/__locale_dir/locale_base_api/musl.h:23:8: error: cannot add 'abi_tag' attribute in a redeclaration
   23 | inline _LIBCPP_HIDE_FROM_ABI long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
      |        ^
/home/sberg/emsdk/4.0.0/emsdk/emscripten/main/cache/sysroot/include/c++/v1/__config:545:22: note: expanded from macro '_LIBCPP_HIDE_FROM_ABI'
  545 |       __attribute__((__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_ODR_SIGNATURE))))
      |                      ^
/home/sberg/emsdk/4.0.0/emsdk/emscripten/main/cache/sysroot/include/compat/xlocale.h:13:11: note: previous declaration is here
   13 | long long strtoll_l(const char *start, char **end, int base, locale_t loc);
      |           ^
In file included from test.cc:2:
In file included from /home/sberg/emsdk/4.0.0/emsdk/emscripten/main/cache/sysroot/include/c++/v1/locale:205:
In file included from /home/sberg/emsdk/4.0.0/emsdk/emscripten/main/cache/sysroot/include/c++/v1/__locale:14:
In file included from /home/sberg/emsdk/4.0.0/emsdk/emscripten/main/cache/sysroot/include/c++/v1/__locale_dir/locale_base_api.h:27:
/home/sberg/emsdk/4.0.0/emsdk/emscripten/main/cache/sysroot/include/c++/v1/__locale_dir/locale_base_api/musl.h:27:8: error: cannot add 'abi_tag' attribute in a redeclaration
   27 | inline _LIBCPP_HIDE_FROM_ABI unsigned long long strtoull_l(const char* __nptr, char** __endptr, int __base, locale_t) {
      |        ^
/home/sberg/emsdk/4.0.0/emsdk/emscripten/main/cache/sysroot/include/c++/v1/__config:545:22: note: expanded from macro '_LIBCPP_HIDE_FROM_ABI'
  545 |       __attribute__((__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_ODR_SIGNATURE))))
      |                      ^
/home/sberg/emsdk/4.0.0/emsdk/emscripten/main/cache/sysroot/include/compat/xlocale.h:14:20: note: previous declaration is here
   14 | unsigned long long strtoull_l(const char *start, char **end, int base, locale_t loc);
      |                    ^
2 errors generated.
sbc100 added a commit to sbc100/emscripten that referenced this issue Jan 15, 2025
libc++ was assuming that musl doesn't have `xlocale.h` which is true,
but emscripten adds xlocale.h for compatibility (I'm not sure we really
need to, but we do).

Fixes: emscripten-core#23413
sbc100 added a commit to sbc100/emscripten that referenced this issue Jan 15, 2025
libc++ was assuming that musl doesn't have `xlocale.h` which is true,
but emscripten adds xlocale.h for compatibility (I'm not sure we really
need to, but we do).

Fixes: emscripten-core#23413
@sbc100
Copy link
Collaborator

sbc100 commented Jan 15, 2025

Fix is in #23414.

This made me wonder if we really should be including xlocale.h in our SDK. Can I ask if/how/why you are depending on it? IIUC, this header doesn't exist on linux.

@stbergmann
Copy link
Contributor Author

Fix is in #23414.

thanks!

This made me wonder if we really should be including xlocale.h in our SDK. Can I ask if/how/why you are depending on it? IIUC, this header doesn't exist on linux.

I stumbled across this issue when building LibreOffice, which has its own bundled Harfbuzz, which in turn has an Autotools check for xlocale.h and in it's central src/hb.hh does

#include <locale.h>
#ifdef HAVE_XLOCALE_H
#include <xlocale.h> // Needed on BSD/OS X for uselocale
#endif

So that use case would probably be fine with no xlocale.h in Emscripten, and just happened to get caught up by it being present.

sbc100 added a commit to sbc100/emscripten that referenced this issue Jan 15, 2025
libc++ was assuming that musl doesn't have `xlocale.h` which is true,
but emscripten adds xlocale.h for compatibility (I'm not sure we really
need to, but we do).

Fixes: emscripten-core#23413
sbc100 added a commit to sbc100/emscripten that referenced this issue Jan 15, 2025
libc++ was assuming that musl doesn't have `xlocale.h` which is true,
but emscripten adds xlocale.h for compatibility (I'm not sure we really
need to, but we do).

Fixes: emscripten-core#23413
@sbc100 sbc100 closed this as completed in 4c14f1f Jan 15, 2025
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.

2 participants