Skip to content

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

Closed

Description

@stbergmann

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.

Activity

  1. added 2 commits that reference this issue on Jan 15, 2025
    72cfbcc
    c8ab5ce
  2. sbc100 commented on Jan 15, 2025

    @sbc100
    Collaborator

    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.

  3. stbergmann commented on Jan 15, 2025

    @stbergmann
    ContributorAuthor

    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.

  4. added 2 commits that reference this issue on Jan 15, 2025
    46b4986
    944f297
  5. added a commit that references this issue on Jan 15, 2025
    4c14f1f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions