Skip to content

Using std::locale fails to link fmt 12 on Arch Linux with clang #4573

Description

@jordan-woyak

The follow program fails to link on Arch Linux with clang++.
g++ links as expected.

I think this is somewhat similar to issue #2794.

// Enabling this allows the program to always link.
//#define FMT_HEADER_ONLY

#include <cstdio>
#include <ctime>
#include <locale>

#include <fmt/chrono.h>
#include <fmt/format.h>

int main()
{
    std::puts(fmt::format(std::locale(""), "{:L%c}", fmt::gmtime(std::time_t{})).c_str());
}

clang++ fmt-link-fail.cpp -lfmt

fmt-link-fail.cpp:(.text+0x41): undefined reference to `_ZN3fmt3v1210locale_refC1ISt6localeTnNSt9enable_ifIXneszsrT_7collateLi0EEiE4typeELi0EEERKS5_'

I'm reaching the limits of my linker understanding here.

Is this supposed to work?
If the ABI is not compatible can I somehow detect this and automatically define FMT_HEADER_ONLY ?

Activity

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