Home › Forum › SOFA › Building SOFA › [SOLVED] Error configure SOFA in cmake-gui about lpthreads
Tagged: 64_bits, Linux_other, LLVM, SOFA_1712
- This topic has 29 replies, 4 voices, and was last updated 6 years, 6 months ago by jnbrunet.
-
AuthorPosts
-
18 May 2018 at 17:30 #11061adrienBlocked
Hello everyone,
I’m trying to build SOFA.
The first step, the configuration with cmake-gui, encounters an error with -lpthreads and therefore the configuration cannot be completed. Here is the CMakeError.log content :Determining if the function pthread_create exists in the pthreads failed with the following output: Change Dir: /home/stage/Documents/Adrien/sofa/build/build-v17.12/CMakeFiles/CMakeTmp Run Build Command:"/usr/bin/gmake" "cmTC_22e98/fast" /usr/bin/gmake -f CMakeFiles/cmTC_22e98.dir/build.make CMakeFiles/cmTC_22e98.dir/build gmake[1] : on entre dans le répertoire « /home/stage/Documents/Adrien/sofa/build/build-v17.12/CMakeFiles/CMakeTmp » Building C object CMakeFiles/cmTC_22e98.dir/CheckFunctionExists.c.o /usr/bin/clang -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_22e98.dir/CheckFunctionExists.c.o -c /usr/share/cmake/Modules/CheckFunctionExists.c Linking C executable cmTC_22e98 /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_22e98.dir/link.txt --verbose=1 /usr/bin/clang -DCHECK_FUNCTION_EXISTS=pthread_create -rdynamic CMakeFiles/cmTC_22e98.dir/CheckFunctionExists.c.o -o cmTC_22e98 -lpthreads /usr/bin/ld : ne peut trouver -lpthreads clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation) gmake[1]: *** [CMakeFiles/cmTC_22e98.dir/build.make:87: cmTC_22e98] Error 1 gmake[1] : on quitte le répertoire « /home/stage/Documents/Adrien/sofa/build/build-v17.12/CMakeFiles/CMakeTmp » gmake: *** [Makefile:126: cmTC_22e98/fast] Error 2
I tried to configure with clang and cc and each time the same error.
I’m working on Fedora 28 64-bit.
Thanks in advance for your help
18 May 2018 at 18:03 #11063GuillaumeKeymasterHi,
Did you install all SOFA dependencies? Unfortunately, our documentation is Ubuntu oriented but equivalences can be found easily.
I’d go for the Fedora equivalent ofbuild-essential
:dnf install @development-tools
Hope that helps,
Guillaume.18 May 2018 at 18:14 #11064adrienBlockedHello Guillaume,
Thanks for your answer. I just tried what you adviced. Here is the Konsole output:
[stage@port_poire usr]$ sudo dnf install @development-tools [sudo] Mot de passe de stage : Dernière vérification de l’expiration des métadonnées effectuée il y a 2:20:41 le ven. 18 mai 2018 15:49:34 CEST. Le groupe « Outils de développement » est déjà installé. Dépendances résolues. Rien à faire. Terminé !
It seems that it is not the problem.
22 May 2018 at 15:51 #11072adrienBlockedHi,
I found a post where mentioned the libpthread file:link
So I checked and found libpthread_nonshared.a which is a library for parallel execution model. It seems to be the dependency that I need to compile SOFA. Therefore, I installed glibc and I checked again the libpthread lib but I didn’t find it.Do you know if the lipthread is a known problem ? Would you have an idea to solve it ?
22 May 2018 at 15:56 #11073adrienBlockedsorry here is the link:
23 May 2018 at 09:59 #11075GuillaumeKeymasterHi,
No, never encountered this error before.
This thread may help.
Perhaps @jnbrunet could help, he knows Fedora well 🙂24 May 2018 at 15:48 #11101HugoKeymasterhey @adrien
did you take the time to look at Guillaume’s link? I am pretty sure clues in this thread may help you in solving you config problem. Are you able to find pthread somewhere on your system?
24 May 2018 at 16:16 #11102adrienBlockedHello Hugo,
Yes I looked at the links.
The lib libpthread is installed on my system under/usr/lib64/
.
I just tried to check if the function pthread is the file/usr/lib64/libpthread.so.0
and I obtainednm: /usr/lib64/libpthread.so.0: aucun symbole
which means that the function isn’t in the file.Could the version of the lib be the bug ?
Thanks for your help
25 May 2018 at 13:15 #11112adrienBlockedHello,
I tried to install older version of glibc (2.15) to change the libpthread version and when I run configure
sudo ../glibc-2.15/configure --prefix=/usr --disable-profile --enable-add-ons --enable-kernel=2.6.25 --libexecdir=/usr/lib/glibc
I obtained*** These critical programs are missing or too old: gcc make *** Check the INSTALL file for required versions.
witch version of glibc should I install?
Thanks
25 May 2018 at 17:16 #11114HugoKeymasterHi @adrien,
I don’t see in your above posts any reference to the link we sent you.
Have you checked Edit 1, 2 and 3 ?find /lib -name "*pthread*"
then test:
nm /lib/x86_64-linux-gnu/libpthread.so.0 | grep "pthread_create"
Use a minimal CMakeLists.txt to test:
cmake_minimum_required (VERSION 2.8.7) find_package(Threads)
Check whether there is any version mismatch.
Best,Hugo
25 May 2018 at 17:43 #11115adrienBlockedHi Hugo,
I did it and I obtained
nm: /usr/lib64/libpthread.so.0: aucun symbole
to test if pethread_create exists and I ran the CMakeLists.txt and it gave:-- Looking for include file pthread.h -- Looking for include file pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - not found -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE
Thanks for your help
25 May 2018 at 17:54 #11116HugoKeymasterWhat about the first command:
find /lib -name "*pthread*"
?25 May 2018 at 18:40 #11117adrienBlockedI used
locate libpthread
to found the file libpthread.so.0 and when I usedfind /lib -name "*pthread*"
it found nothing.
It seems that the lib is installed in /usr/lib64/ on my system and not in /lib/ but even in the /usr/lib64/ there isn’t the function pthread-create which raised the cmake error.28 May 2018 at 14:02 #11119jnbrunetModeratorHello,
I’m not sure about fedora 28, but with fedora 27 I have:
$ ldd bin/runSofa | grep -i pthread libpthread.so.0 => /lib64/libpthread.so.0 (0x00007ff9c41fb000)
$ rpm -qf /lib64/libpthread.so.0 glibc-2.26-28.fc27.x86_64
And
$ namei /lib64/libpthread.so.0 f: /lib64/libpthread.so.0 d / l lib64 -> usr/lib64 d usr d lib64 l libpthread.so.0 -> libpthread-2.26.so - libpthread-2.26.so
Which means my /lib64/libpthread.so.0 was imported by the glib-2.26 package. I find it very strange that nm didn’t found any symbol in your libpthread.so.0 file. Maybe try to reinstall the glib package?
28 May 2018 at 15:13 #11121adrienBlockedHello Jean-Nicolas,
I reinstalled the glib package as you adviced me and now I found:
[stage@port_poire ~]$ nm /lib64/libpthread.so.0 | grep "pthread_create" 0000000000007870 t __pthread_create_2_1 0000000000005bee t __pthread_create_2_1.cold.12 0000000000007870 T pthread_create@@GLIBC_2.2.5
Nevertheless I have again the same configuration error (CMakeError.log):
Determining if the function pthread_create exists in the pthreads failed with the following output: Change Dir: /home/stage/Documents/Adrien/sofa/build/build-v17.12/CMakeFiles/CMakeTmp Run Build Command:"/usr/bin/gmake" "cmTC_22e98/fast" /usr/bin/gmake -f CMakeFiles/cmTC_22e98.dir/build.make CMakeFiles/cmTC_22e98.dir/build gmake[1] : on entre dans le répertoire « /home/stage/Documents/Adrien/sofa/build/build-v17.12/CMakeFiles/CMakeTmp » Building C object CMakeFiles/cmTC_22e98.dir/CheckFunctionExists.c.o /usr/bin/clang -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_22e98.dir/CheckFunctionExists.c.o -c /usr/share/cmake/Modules/CheckFunctionExists.c Linking C executable cmTC_22e98 /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_22e98.dir/link.txt --verbose=1 /usr/bin/clang -DCHECK_FUNCTION_EXISTS=pthread_create -rdynamic CMakeFiles/cmTC_22e98.dir/CheckFunctionExists.c.o -o cmTC_22e98 -lpthreads /usr/bin/ld : ne peut trouver -lpthreads clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation) gmake[1]: *** [CMakeFiles/cmTC_22e98.dir/build.make:87: cmTC_22e98] Error 1 gmake[1] : on quitte le répertoire « /home/stage/Documents/Adrien/sofa/build/build-v17.12/CMakeFiles/CMakeTmp » gmake: *** [Makefile:126: cmTC_22e98/fast] Error 2
Could the clang package play a role in that problem ?
Thanks for your help.
28 May 2018 at 15:36 #11122jnbrunetModeratorMaybe, can you give me the output of the following commands:
1.
/usr/bin/clang --version
2./usr/bin/ld --verbose | grep SEARCH
3.CURDIR=$PWD; cd /tmp && cp /usr/share/cmake/Modules/CheckFunctionExists.c . && /usr/bin/clang -DCHECK_FUNCTION_EXISTS=pthread_create -o CheckFunctionExists.c.o -c CheckFunctionExists.c && /usr/bin/clang -DCHECK_FUNCTION_EXISTS=pthread_create -rdynamic CheckFunctionExists.c.o -o CheckFunctionExists -lpthread -v; rm CheckFunctionExists*; cd $CURDIR
Edit:
Also, the output of
4.ll /usr/lib64 | grep -i pthread
28 May 2018 at 15:55 #11123adrienBlockedyes, of course:
[stage@port_poire ~]$ /usr/bin/clang --version clang version 6.0.0 (tags/RELEASE_600/final) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /usr/bin
[stage@port_poire ~]$ /usr/bin/ld --verbose | grep SEARCH SEARCH_DIR("=/usr/x86_64-redhat-linux/lib64"); SEARCH_DIR("=/usr/lib64"); SEARCH_DIR("=/usr/local/lib64"); SEARCH_DIR("=/lib64"); SEARCH_DIR("=/usr/x86_64-redhat-linux/lib"); SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib");
[stage@port_poire ~]$ CURDIR=$PWD; cd /tmp && cp /usr/share/cmake/Modules/CheckFunctionExists.c . && /usr/bin/clang -DCHECK_FUNCTION_EXISTS=pthread_create -o CheckFunctionExists.c.o -c CheckFunctionExists.c && /usr/bin/clang -DCHECK_FUNCTION_EXISTS=pthread_create -rdynamic CheckFunctionExists.c.o -o CheckFunctionExists -lpthread -v; rm CheckFunctionExists*; cd $CURDIR clang version 6.0.0 (tags/RELEASE_600/final) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /usr/bin Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/8 Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/8 Selected GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/8 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Selected multilib: .;@m64 "/usr/bin/ld" -export-dynamic --hash-style=gnu --no-add-needed --build-id --eh-frame-hdr -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o CheckFunctionExists /usr/bin/../lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crt1.o /usr/bin/../lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crti.o /usr/bin/../lib/gcc/x86_64-redhat-linux/8/crtbegin.o -L/usr/bin/../lib/gcc/x86_64-redhat-linux/8 -L/usr/bin/../lib/gcc/x86_64-redhat-linux/8/../../../../lib64 -L/usr/bin/../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/bin/../lib/gcc/x86_64-redhat-linux/8/../../.. -L/usr/bin/../lib -L/lib -L/usr/lib CheckFunctionExists.c.o -lpthread -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/bin/../lib/gcc/x86_64-redhat-linux/8/crtend.o /usr/bin/../lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crtn.o
28 May 2018 at 16:00 #11124jnbrunetModeratorAlso, the output of
ll /usr/lib64 | grep -i pthread
28 May 2018 at 16:04 #11125adrienBlocked[stage@port_poire ~]$ ll /usr/lib64 | grep -i pthread lrwxrwxrwx. 1 root root 30 15 févr. 17:28 libevent_pthreads-2.1.so.6 -> libevent_pthreads-2.1.so.6.0.2 -rwxr-xr-x. 1 root root 11416 15 févr. 17:28 libevent_pthreads-2.1.so.6.0.2 lrwxrwxrwx. 1 root root 27 8 févr. 03:53 libgpgme++-pthread.so.2 -> libgpgme++-pthread.so.2.8.0 -rwxr-xr-x. 1 root root 354104 8 févr. 03:54 libgpgme++-pthread.so.2.8.0 lrwxrwxrwx. 1 root root 37 8 févr. 11:00 liblttng-ust-pthread-wrapper.so.0 -> liblttng-ust-pthread-wrapper.so.0.0.0 -rwxr-xr-x. 1 root root 24824 8 févr. 11:00 liblttng-ust-pthread-wrapper.so.0.0.0 -rwxr-xr-x. 1 root root 154128 24 mai 17:38 libpthread-2.27.so -rw-r--r--. 1 root root 164048 24 mai 17:38 libpthread.a -rw-r--r--. 1 root root 1724 24 mai 17:38 libpthread_nonshared.a -rw-r--r--. 1 root root 222 24 mai 17:36 libpthread.so lrwxrwxrwx. 1 root root 18 24 mai 17:36 libpthread.so.0 -> libpthread-2.27.so lrwxrwxrwx. 1 root root 25 10 mars 2017 libpthread-stubs.so.0 -> libpthread-stubs.so.0.0.0 -rwxr-xr-x. 1 root root 6768 10 mars 2017 libpthread-stubs.so.0.0.0
28 May 2018 at 16:13 #11126jnbrunetModeratorNot sure where you got those libpthread stubs files and the static static library.
Did you installed
glibc-devel
package?Can you give me the output of
1.rpm -qf /usr/lib64/libpthread-stubs.so.0
2.rpm -qf /usr/lib64/libpthread.a
3.cat /usr/lib64/libpthread.so
28 May 2018 at 16:25 #11127adrienBlockedI installed
glibc-static
package andglibc-devel
package was already installed
1. `[stage@port_poire ~]$ rpm -qf /usr/lib64/libpthread-stubs.so.0
libpthread-stubs-0.2-5.2.x86_64`2. `[stage@port_poire ~]$ rpm -qf /usr/lib64/libpthread.a
glibc-static-2.27-15.fc28.x86_64`3. `[stage@port_poire ~]$ cat /usr/lib64/libpthread.so
/* GNU ld script
Use the shared library, but some functions are only in
the static library, so try that secondarily. */
OUTPUT_FORMAT(elf64-x86-64)
GROUP ( /lib64/libpthread.so.0 /usr/lib64/libpthread_nonshared.a )`28 May 2018 at 16:40 #11128jnbrunetModeratorThen I’m not really sure where your problem comes from. From your results, everything seems fine, you even linked the same test program from cmake without the linked error…
The only difference I have with you is that I don’t have that static package installed, but this should not make a difference since the linker should use the dynamic library by default, unless you manually imposed static linking, which I don’t even think it’s possible with sofa.
Can you try again the compilation with an empty build directory of sofa? Try to put the least cmake options as possible (plugins, etc). Maybe add the -DCMAKE_VERBOSE_MAKEFILE=ON to the cmake command to get more hints.
28 May 2018 at 17:24 #11130adrienBlockedI tried the compilation with an empty build directory and with any options for cmake and it seems that nothing has changed.
Determining if the function pthread_create exists in the pthreads failed with the following output: Change Dir: /home/stage/Documents/Adrien/sofa/build/build-v17.12/CMakeFiles/CMakeTmp Run Build Command:"/usr/bin/gmake" "cmTC_2accb/fast" /usr/bin/gmake -f CMakeFiles/cmTC_2accb.dir/build.make CMakeFiles/cmTC_2accb.dir/build gmake[1] : on entre dans le répertoire « /home/stage/Documents/Adrien/sofa/build/build-v17.12/CMakeFiles/CMakeTmp » Building C object CMakeFiles/cmTC_2accb.dir/CheckFunctionExists.c.o /usr/bin/clang -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_2accb.dir/CheckFunctionExists.c.o -c /usr/share/cmake/Modules/CheckFunctionExists.c Linking C executable cmTC_2accb /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_2accb.dir/link.txt --verbose=1 /usr/bin/clang -DCHECK_FUNCTION_EXISTS=pthread_create -rdynamic CMakeFiles/cmTC_2accb.dir/CheckFunctionExists.c.o -o cmTC_2accb -lpthreads /usr/bin/ld : ne peut trouver -lpthreads clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation) gmake[1]: *** [CMakeFiles/cmTC_2accb.dir/build.make:87: cmTC_2accb] Error 1 gmake[1] : on quitte le répertoire « /home/stage/Documents/Adrien/sofa/build/build-v17.12/CMakeFiles/CMakeTmp » gmake: *** [Makefile:126: cmTC_2accb/fast] Error 2
29 May 2018 at 11:06 #11135jnbrunetModeratorWell, I’ve just tested with a clean fedora 28 vm. I saved the exact commands used from the freshly installed OS to the compilation of Sofa:
$ sudo dnf update -y
$ sudo dnf install -y gcc-c++ clang cmake cmake-gui git qt5-devel boost-devel python2-devel libpng-devel libjpeg-turbo-devel libtiff-devel zlib-devel glew-devel
$ git clone https://github.com/sofa-framework/sofa.git
$ cd sofa
$ mkdir build
$ cd build
$ cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ..
$ make
I’ve compiled successfully with both v17.12 and master branches. I’ve also tried with glibc-static and glibc-devel to see if there is a confusion in the dependencies, and everything built fine. Here is the versions of the tool installed:
cmake: 3.11.2
clang: 6.0.0
glibc: 2.27Maybe you could try reinstall the cmake and clang packages… Make sure that you only use the tools from the fedora repositories, and not the ones you compiled yourself.
30 May 2018 at 10:37 #11140adrienBlockedI used your command line
$ sudo dnf install -y gcc-c++ clang cmake cmake-gui git qt5-devel boost-devel python2-devel libpng-devel libjpeg-turbo-devel libtiff-devel zlib-devel glew-devel
it installed the package qt5-devel ( I already installed qt thanks to the link that is given in SOFA documentation) then the cmake configuration worked.Thanks that helped me.
However, there is still an error when I tried to compile with ninja or make (after generation of Makefile) :
/home/stage/Documents/Adrien/sofa/src/SofaGeneral/../modules/SofaBoundaryCondition/FixedPlaneConstraint.inl:173:31: requis par « void sofa::component::projectiveconstraintset::FixedPlaneConstraint<DataTypes>::projectResponse(const sofa::core::MechanicalParams*, sofa::component::projectiveconstraintset::FixedPlaneConstraint<DataTypes>::DataVecDeriv&) [avec DataTypes = sofa::defaulttype::StdRigidTypes<3, double>; sofa::component::projectiveconstraintset::FixedPlaneConstraint<DataTypes>::DataVecDeriv = sofa::core::objectmodel::Data<sofa::helper::vector<sofa::defaulttype::RigidDeriv<3, double>, sofa::helper::CPUMemoryManager<sofa::defaulttype::RigidDeriv<3, double> > > >; typename DataTypes::VecDeriv = sofa::helper::vector<sofa::defaulttype::RigidDeriv<3, double>, sofa::helper::CPUMemoryManager<sofa::defaulttype::RigidDeriv<3, double> > >] » /home/stage/Documents/Adrien/sofa/src/modules/SofaBoundaryCondition/FixedPlaneConstraint.cpp:58:44: requis depuis ici /home/stage/Documents/Adrien/sofa/src/modules/SofaBoundaryCondition/FixedPlaneConstraint.cpp:74:100: erreur interne du compilateur: dans type_dependent_expression_p, à cp/pt.c:25100 for (helper::vector< unsigned int > ::const_iterator it = this->indices.getValue().begin(); it != this->indices.getValue().end(); ++it) ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Veuillez soumettre un rapport d’anomalies complet, avec la sortie du préprocesseur si nécessaire. Voir <http://bugzilla.redhat.com/bugzilla> pour les instructions. La source convertie par le préprocesseur a été stockée dans le fichier /tmp/ccVMjYoh.out, veuillez l'attacher à votre rapport d'anomalie. make[2]: *** [SofaGeneral/SofaBoundaryCondition/CMakeFiles/SofaBoundaryCondition.dir/build.make:167: SofaGeneral/SofaBoundaryCondition/CMakeFiles/SofaBoundaryCondition.dir/FixedPlaneConstraint.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:3112: SofaGeneral/SofaBoundaryCondition/CMakeFiles/SofaBoundaryCondition.dir/all] Error 2 make: *** [Makefile:163: all] Error 2
I don’t understand what it means precisely. Do you have an idea about it ?
-
AuthorPosts
- You must be logged in to reply to this topic.