You are not logged in.
After updating my Arch Linux system on my laptop, I ran into a lot of compilation errors when trying to compile the c++ project I am working on. The same code compiles well on other Arch linux machines.
So, I tried a little hello world program, and it fails with the same error. My understanding is that the hello world program should be OK so the problem should be with my compiler, but I cannot figure out how to repair it. I have tried to rebuild base, base-devel, gcc and gcc-libs.
I have spent quite some time trying to figure out what is happening, but I get nowhere, so I would very much appreciate any hints.
The file I try to compile is very simple:
#include <iostream>
int main ()
{
std::cout << "Hello, world!\n";
return 0;
}
I compile it with:
$ g++ -Wall -Wfatal-errors hello.cpp -o hello
And the errors I get are:
In file included from /usr/include/c++/8.2.1/memory:74,
from /usr/local/include/format.h:36,
from /usr/local/include/time.h:11,
from /usr/include/pthread.h:24,
from /usr/include/c++/8.2.1/x86_64-pc-linux-gnu/bits/gthr-default.h:35,
from /usr/include/c++/8.2.1/x86_64-pc-linux-gnu/bits/gthr.h:148,
from /usr/include/c++/8.2.1/ext/atomicity.h:35,
from /usr/include/c++/8.2.1/bits/ios_base.h:39,
from /usr/include/c++/8.2.1/ios:42,
from /usr/include/c++/8.2.1/ostream:38,
from /usr/include/c++/8.2.1/iostream:39,
from hello.cpp:4:
/usr/include/c++/8.2.1/ext/concurrence.h:124:5: error:
'__gthread_mutex_t' does not name a type; did you mean
'__pthread_mutex_s'?
__gthread_mutex_t _M_mutex;
^~~~~~~~~~~~~~~~~
__pthread_mutex_s
compilation terminated due to -Wfatal-errors
Last edited by m_gustafsson (2018-11-25 15:34:21)
Offline
Rebuilding packages won't help when you're pulling things from /usr/local/. What are they and how did they get there?
Offline
My problem is that I cannot build a very simple c++ program, so I assumed that my building environment is broken. Thus, I would like to rebuild that environment. The build environment packages was installed by me with pacman. But, maybe my problem is not with those packages?
Offline
In file included from /usr/include/c++/8.2.1/memory:74,
from /usr/local/include/format.h:36,
from /usr/local/include/time.h:11,
Those things in /usr/local are breaking your system. Figure out how they got there and remove them.
Offline
@Allan: thanks! I removed the two header files in /usr/local/include and now it all compiles.
@Scimmia: now I also got your point, thanks!
Offline