Undefined references to std::thread::*

2,943 views
Skip to first unread message

Alexander Lindsay

unread,
Sep 22, 2016, 11:05:42 AM9/22/16
to moose...@googlegroups.com
Anyone off the top of their head have an idea what the root cause of
this error might be? I'm suspicious that it's gcc-6, but I don't know
for sure.

clang-3.8: warning: argument unused during compilation: '-pthread'
Linking Executable /home/lindsayad/moltres-submodule/moltres-opt...
/home/lindsayad/moltres-submodule/moose/framework/contrib/ice_updater/libice_updater-opt.so:
undefined reference to `typeinfo for std::thread::_State'
/home/lindsayad/moltres-submodule/moose/framework/contrib/ice_updater/libice_updater-opt.so:
undefined reference to
`std::thread::_M_start_thread(std::unique_ptr<std::thread::_State,
std::default_delete<std::thread::_State> >, void (*)())'
/home/lindsayad/moltres-submodule/moose/framework/contrib/ice_updater/libice_updater-opt.so:
undefined reference to `std::thread::_State::~_State()'
clang-3.8: error: linker command failed with exit code 1 (use -v to see
invocation)

Cody Permann

unread,
Sep 22, 2016, 11:15:21 AM9/22/16
to moose...@googlegroups.com
ICE Updater...

I'm just about ready to delete that thing. It has been buggy since the day it was added. We don't have any unprotected threading in MOOSE with the notable exception of that package. Feel free to delete it completely from your checkout :) There's probably some extra library that needs to be linked for threading which we don't have here because it's not our package. 

--
You received this message because you are subscribed to the Google Groups "moose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to moose-users...@googlegroups.com.
Visit this group at https://groups.google.com/group/moose-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/moose-users/2a81dfdb-15ff-e328-bf5a-6aea8b75226c%40ncsu.edu.
For more options, visit https://groups.google.com/d/optout.

Alexander Lindsay

unread,
Sep 22, 2016, 11:50:57 AM9/22/16
to moose...@googlegroups.com
Removing it did the trick. Thanks Cody

Peterson, JW

unread,
Sep 22, 2016, 11:54:14 AM9/22/16
to moose-users
I see two things here:

1.) Your clang-3.8 build apparently doesn't support the -pthread flag... this means that our ax_pthread.m4 test is detecting that this flag is supported when it actually doesn't do anything.

2.) Can you look at $LIBMESH_DIR/include/libmesh/libmesh_config.h, and see what it says for HAVE_CXX11_THREAD or LIBMESH_HAVE_CXX11_THREAD?

It looks like configure detected that your compiler supported std::thread, but when the ice updater actually tried to compile and link code that used std::thread, it failed.  This means we might need to update our configure test a bit...

--
John

Alexander Lindsay

unread,
Sep 22, 2016, 1:04:06 PM9/22/16
to moose...@googlegroups.com
I have this:

/* Flag indicating whether compiler supports std::thread */
#ifndef LIBMESH_HAVE_CXX11_THREAD
#define LIBMESH_HAVE_CXX11_THREAD 1
#endif

/* Compiler supports std::thread, but it is disabled in libmesh */
/* #undef HAVE_CXX11_THREAD_BUT_DISABLED */
--
You received this message because you are subscribed to the Google Groups "moose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to moose-users...@googlegroups.com.
Visit this group at https://groups.google.com/group/moose-users.

Peterson, JW

unread,
Sep 22, 2016, 2:03:17 PM9/22/16
to moose-users
On Thu, Sep 22, 2016 at 11:04 AM, Alexander Lindsay <adli...@ncsu.edu> wrote:
I have this:

/* Flag indicating whether compiler supports std::thread */
#ifndef LIBMESH_HAVE_CXX11_THREAD
#define LIBMESH_HAVE_CXX11_THREAD 1
#endif

/* Compiler supports std::thread, but it is disabled in libmesh */
/* #undef HAVE_CXX11_THREAD_BUT_DISABLED */

OK, that's what I would have expected in this case.  I'm also wondering if you've mixed up compilers at some point, since you're getting warnings from clang-3.8, but in your email you mentioned gcc-6.  Also, where are you getting these compilers from, since we don't yet provide MOOSE packages with them?  Are you sure they are installed correctly? 

--
John

Alexander Lindsay

unread,
Sep 22, 2016, 6:16:23 PM9/22/16
to moose...@googlegroups.com
I have build 5 of the Ubuntu 16.04 package, and here are the relevant lines from my .bashrc:

# Source MOOSE Environment
if [ -f /opt/moose/environments/moose_profile ]; then
  . /opt/moose/environments/moose_profile
fi

module purge
module load moose-dev-clang
module load ccache

If I execute `$CXX -v compile_test.cpp` on a simple hello world program, here's the output:

clang version 3.8.1 (https://github.com/llvm-mirror/clang.git 2cb088be9c6a3d1ef9a050d44e1b01393983fc4d) (https://github.com/llvm-mirror/llvm.git 97f51395da2614cd35c7e57e399faedaf5fbdcb9)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/moose/llvm-3.8.0/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.4.1
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6.2.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.2.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.2.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
 "/opt/moose/llvm-3.8.0/bin/clang-3.8" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name compile_test.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -v -dwarf-column-info -debugger-tuning=gdb -resource-dir /opt/moose/llvm-3.8.0/bin/../lib/clang/3.8.1 -I/opt/moose/tbb/include -c-isystem /opt/moose/mpich/mpich-3.2/clang-opt/include -cxx-isystem /opt/moose/mpich/mpich-3.2/clang-opt/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.2.0/../../../../include/c++/6.2.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.2.0/../../../../include/x86_64-linux-gnu/c++/6.2.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.2.0/../../../../include/x86_64-linux-gnu/c++/6.2.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.2.0/../../../../include/c++/6.2.0/backward -internal-isystem /usr/local/include -internal-isystem /opt/moose/llvm-3.8.0/bin/../lib/clang/3.8.1/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -fdebug-compilation-dir /home/lindsayad/gdrive/programming/cpp -ferror-limit 19 -fmessage-length 137 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/compile_test-2043b1.o -x c++ compile_test.cpp
clang -cc1 version 3.8.1 based upon LLVM 3.8.1 default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
ignoring duplicate directory "/usr/lib/gcc/x86_64-linux-gnu/6.2.0/../../../../include/x86_64-linux-gnu/c++/6.2.0"
#include "..." search starts here:
#include <...> search starts here:
 /opt/moose/tbb/include
 /opt/moose/mpich/mpich-3.2/clang-opt/include
 /usr/lib/gcc/x86_64-linux-gnu/6.2.0/../../../../include/c++/6.2.0
 /usr/lib/gcc/x86_64-linux-gnu/6.2.0/../../../../include/x86_64-linux-gnu/c++/6.2.0
 /usr/lib/gcc/x86_64-linux-gnu/6.2.0/../../../../include/c++/6.2.0/backward
 /usr/local/include
 /opt/moose/llvm-3.8.0/bin/../lib/clang/3.8.1/include
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
 "/usr/bin/ld" -z relro --hash-style=gnu --build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /usr/lib/gcc/x86_64-linux-gnu/6.2.0/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/6.2.0/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/6.2.0/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/6.2.0 -L/usr/lib/gcc/x86_64-linux-gnu/6.2.0/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/6.2.0/../../../../lib64 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -L/usr/lib/x86_64-linux-gnu/../../lib64 -L/usr/lib/gcc/x86_64-linux-gnu/6.2.0/../../.. -L/opt/moose/llvm-3.8.0/bin/../lib -L/lib -L/usr/lib /tmp/compile_test-2043b1.o -L/opt/moose/tbb/lib -L/opt/moose/llvm-3.8.0/lib -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/6.2.0/crtend.o /usr/lib/gcc/x86_64-linux-gnu/6.2.0/../../../x86_64-linux-gnu/crtn.o

In a previous post (https://groups.google.com/forum/#!topic/moose-users/NF603icWMy0), I was having the issue `/usr/bin/ld: cannot find -lstdc++`. I discovered that this was because clang was looking for gcc-6 when it didn't exist. I fixed this issue by apt-get installing gcc-6 and g++-6 from the ubuntu-toolchain repository. All of my system gcc installations are installed via apt-get.
--
You received this message because you are subscribed to the Google Groups "moose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to moose-users...@googlegroups.com.
Visit this group at https://groups.google.com/group/moose-users.

Peterson, JW

unread,
Sep 22, 2016, 6:26:20 PM9/22/16
to moose-users
On Thu, Sep 22, 2016 at 4:16 PM, Alexander Lindsay <adli...@ncsu.edu> wrote:
I have build 5 of the Ubuntu 16.04 package, and here are the relevant lines from my .bashrc:

# Source MOOSE Environment
if [ -f /opt/moose/environments/moose_profile ]; then
  . /opt/moose/environments/moose_profile
fi

module purge
module load moose-dev-clang
module load ccache

If I execute `$CXX -v compile_test.cpp` on a simple hello world program, here's the output:

clang version 3.8.1 (https://github.com/llvm-mirror/clang.git 2cb088be9c6a3d1ef9a050d44e1b01393983fc4d) (https://github.com/llvm-mirror/llvm.git 97f51395da2614cd35c7e57e399faedaf5fbdcb9)

 
In a previous post (https://groups.google.com/forum/#!topic/moose-users/NF603icWMy0), I was having the issue `/usr/bin/ld: cannot find -lstdc++`. I discovered that this was because clang was looking for gcc-6 when it didn't exist. I fixed this issue by apt-get installing gcc-6 and g++-6 from the ubuntu-toolchain repository. All of my system gcc installations are installed via apt-get.

I'm pretty sure you cannot mix a GCC from Ubuntu with the Clang from the MOOSE package.  Jason builds the MOOSE package clang with a specific GCC and you have to use that same GCC when compiling with it.

It sounds like build 5 of the Ubuntu 16.04 package may just have been a bad build... you might want to try build 6.

--
John

Miller, Jason M

unread,
Sep 22, 2016, 6:36:45 PM9/22/16
to moose...@googlegroups.com
The failed build in question was also continuing to be distributed accidentally. The web site stated Version 6 since August 22. But was in fact still serving version 5 :(  sorry about that. That was fixed this morning.

Jason

--
You received this message because you are subscribed to the Google Groups "moose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to moose-users+unsubscribe@googlegroups.com.

Alexander Lindsay

unread,
Sep 22, 2016, 7:08:13 PM9/22/16
to moose...@googlegroups.com
Yea, I mean I can see a gcc installation in /opt/moose/gcc-5.3.0/lib/gcc/x86_64-unknown-linux-gnu/5.3.0, but this:


Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.4.1
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6.2.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.2.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.2.0

makes me think clang never finds it, which confuses me because `echo $LD_LIBRARY_PATH` shows:

/opt/moose/cppunit-1.12.1/clang-opt/lib:/opt/moose/tbb/lib:/opt/moose/mpich/mpich-3.2/clang-opt/lib:/opt/moose/llvm-3.8.0/lib:/opt/moose/gcc-5.3.0/lib64:/opt/moose/gcc-5.3.0/lib:/opt/moose/gcc-5.3.0/lib/i386

I'm working on trying to understand include and library paths better because by preliminary inspection all the pieces appear to be there, at least to me.
--
You received this message because you are subscribed to the Google Groups "moose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to moose-users...@googlegroups.com.
Visit this group at https://groups.google.com/group/moose-users.

Alexander Lindsay

unread,
Sep 22, 2016, 7:11:16 PM9/22/16
to moose...@googlegroups.com
Yea I mean I can definitely go to the new build, but I guess I want to understand what's happening here; you guys don't have to be responsible for that, but I won't turn down any proffered pieces of wisdom. The current build I have on my machine worked great for months.
To unsubscribe from this group and stop receiving emails from it, send an email to moose-users...@googlegroups.com.

Alexander Lindsay

unread,
Nov 28, 2016, 4:52:23 PM11/28/16
to moose-users
I'm returning to this old thread because I'm getting sick of always stacking a `remove_ice` commit on top of any development work I'm doing.

Jason, John (or others) do you think I'll continue have this pthread warning as long as I have a version 6 gcc installed on my system? I've read in the past that clang always looks for the most recent gcc version and I know that my current  moose environment is supposed to be using gcc 5.3.

Cody Permann

unread,
Nov 28, 2016, 5:04:47 PM11/28/16
to moose-users
I'm supportive of "fixing the glitch"... 

I won't be the surgeon that removes it from the MOOSE, but I'll be the administrator that approves such a request. Any takers?

To unsubscribe from this group and stop receiving emails from it, send an email to moose-users...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "moose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to moose-users...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "moose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to moose-users...@googlegroups.com.

Peterson, JW

unread,
Nov 28, 2016, 5:34:46 PM11/28/16
to moose-users
On Mon, Nov 28, 2016 at 3:04 PM, Cody Permann <codyp...@gmail.com> wrote:
I'm supportive of "fixing the glitch"... 

I won't be the surgeon that removes it from the MOOSE, but I'll be the administrator that approves such a request. Any takers?

Sure, I will take a look...

--
John

Andrs, David

unread,
Nov 29, 2016, 10:27:15 AM11/29/16
to moose...@googlegroups.com
​:+1:

--
David​

 

--
John

--
You received this message because you are subscribed to the Google Groups "moose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to moose-users+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages