Subject: [minimal reproducer included] libstdc++ mutex references cause clang builds to fail

From: Carl Dong <[email-masked]>
Date: Mon, 04 Nov 2019 20:29:46 +0000

Hi all,

I'm having another issue with the clang toolchain right now and I've come up
with a minimal reproducer:

Given the following manifest.scm:
--8<---------------cut here---------------start------------->8---
(use-modules (gnu packages gcc)
             (gnu packages linux)
             (gnu packages llvm))

(packages->manifest
 (list clang
       (make-libstdc++ gcc)
       linux-libre-headers))
--8<---------------cut here---------------end--------------->8---

And test.cpp:
--8<---------------cut here---------------start------------->8---
#include <mutex>
#include <iostream>

typedef std::once_flag once_flag;

int
main()
{
    std::cout << "Hello, World\n";
}
--8<---------------cut here---------------end--------------->8---

If you invoke:
--8<---------------cut here---------------start------------->8---
guix environment --manifest=manifest.scm --container --pure -- clang++ test.cpp
--8<---------------cut here---------------end--------------->8---

The output looks like:
--8<---------------cut here---------------start------------->8---
test.cpp:4:14: error: no type named 'once_flag' in namespace 'std'
typedef std::once_flag once_flag;
        ~~~~~^
1 error generated.
--8<---------------cut here---------------end--------------->8---

In my original non-minimal build, other things in <mutex> also cause compilation
errors, which seem odd to me.

Any help would be very much appreciated!

Cheers,
Carl Dong
[email-masked]
"I fight for the users"