0

I want to use densepose, and according to the installation I need to install gcc4.9.2. I have downloaded the gcc-4.9.2.tar.gz and prerequisites. And then run configure

../gcc-4.9.2/configure --enable-checking=release --enable-languages=c,c++ --disable-multilib

here is the configure result

checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /usr/bin/sed
checking for gawk... gawk
checking for libatomic support... yes
checking for libcilkrts support... yes
checking for libitm support... yes
checking for libsanitizer support... yes
checking for libvtv support... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether g++ accepts -static-libstdc++ -static-libgcc... no
checking for gnatbind... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for objdir... .libs
configure: WARNING: using in-tree ISL, disabling version check
configure: WARNING: using in-tree CLooG, disabling version check
*** This configuration is not supported in the following subdirectories:
     gnattools target-libada target-libgfortran target-libgo target-libffi target-libbacktrace target-zlib target-libjava target-libobjc target-boehm-gc
    (Any other directories should still work fine.)
checking for default BUILD_CONFIG... bootstrap-debug
checking for --enable-vtable-verify... no
checking for bison... bison -y
checking for bison... bison
checking for gm4... no
checking for gnum4... no
checking for m4... m4
checking for flex... flex
checking for flex... flex
checking for makeinfo... no
checking for expect... no
checking for runtest... no
checking for ar... ar
checking for as... as
checking for dlltool... no
checking for ld... ld
checking for lipo... no
checking for nm... nm
checking for ranlib... ranlib
checking for strip... strip
checking for windres... no
checking for windmc... no
checking for objcopy... objcopy
checking for objdump... objdump
checking for readelf... readelf
checking for cc... cc
checking for c++... c++
checking for gcc... gcc
checking for gcj... no
checking for gfortran... gfortran
checking for gccgo... no
checking for ar... no
checking for ar... ar
checking for as... no
checking for as... as
checking for dlltool... no
checking for dlltool... no
checking for ld... no
checking for ld... ld
checking for lipo... no
checking for lipo... no
checking for nm... no
checking for nm... nm
checking for objdump... no
checking for objdump... objdump
checking for ranlib... no
checking for ranlib... ranlib
checking for readelf... no
checking for readelf... readelf
checking for strip... no
checking for strip... strip
checking for windres... no
checking for windres... no
checking for windmc... no
checking for windmc... no
checking where to find the target ar... host tool
checking where to find the target as... host tool
checking where to find the target cc... just compiled
checking where to find the target c++... just compiled
checking where to find the target c++ for libstdc++... just compiled
checking where to find the target dlltool... host tool
checking where to find the target gcc... just compiled
checking where to find the target gcj... host tool
checking where to find the target gfortran... host tool
checking where to find the target gccgo... host tool
checking where to find the target ld... host tool
checking where to find the target lipo... host tool
checking where to find the target nm... host tool
checking where to find the target objdump... host tool
checking where to find the target ranlib... host tool
checking where to find the target readelf... host tool
checking where to find the target strip... host tool
checking where to find the target windres... host tool
checking where to find the target windmc... host tool
checking whether to enable maintainer-specific portions of Makefiles... no
configure: creating ./config.status
config.status: creating Makefile

And then I run make:

make -j8

and here is the last error massage:

make[3]: Entering directory `/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3'
make "AR_FLAGS=rc" "CC_FOR_BUILD=gcc" "CC_FOR_TARGET=/home/hushichen/DensePose-main/gcc-build/./gcc/xgcc -B/home/hushichen/DensePose-main/gcc-build/./gcc/" "CFLAGS=-g -O2" "CXXFLAGS=-g -O2 -D_GNU_SOURCE" "CFLAGS_FOR_BUILD=-g -O2" "CFLAGS_FOR_TARGET=-g -O2" "INSTALL=/usr/bin/install -c" "INSTALL_DATA=/usr/bin/install -c -m 644" "INSTALL_PROGRAM=/usr/bin/install -c" "INSTALL_SCRIPT=/usr/bin/install -c" "LDFLAGS=" "LIBCFLAGS=-g -O2" "LIBCFLAGS_FOR_TARGET=-g -O2" "MAKE=make" "MAKEINFO=/home/hushichen/DensePose-main/gcc-4.9.2/missing makeinfo --split-size=5000000 --split-size=5000000 --split-size=5000000 " "SHELL=/bin/sh" "RUNTESTFLAGS=" "exec_prefix=/usr/local" "infodir=/usr/local/share/info" "libdir=/usr/local/lib" "includedir=/usr/local/include" "prefix=/usr/local" "tooldir=/usr/local/x86_64-unknown-linux-gnu" "gxx_include_dir=/usr/local/include/c++/4.9.2" "AR=ar" "AS=/home/hushichen/DensePose-main/gcc-build/./gcc/as" "LD=/home/hushichen/DensePose-main/gcc-build/./gcc/collect-ld" "RANLIB=ranlib" "NM=/home/hushichen/DensePose-main/gcc-build/./gcc/nm" "NM_FOR_BUILD=" "NM_FOR_TARGET=nm" "DESTDIR=" "WERROR=" all-recursive
make[4]: Entering directory `/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3'
Making all in include
make[5]: Entering directory `/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include'
mkdir -p ./x86_64-unknown-linux-gnu/bits/stdc++.h.gch
mkdir -p ./x86_64-unknown-linux-gnu/bits/stdc++.h.gch
/home/hushichen/DensePose-main/gcc-build/./gcc/xgcc -shared-libgcc -B/home/hushichen/DensePose-main/gcc-build/./gcc -nostdinc++ -L/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/src -L/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs -L/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs -B/usr/local/x86_64-unknown-linux-gnu/bin/ -B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/x86_64-unknown-linux-gnu/include -isystem /usr/local/x86_64-unknown-linux-gnu/sys-include    -x c++-header -nostdinc++ -g -O2 -D_GNU_SOURCE  -I/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu -I/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include -I/home/hushichen/DensePose-main/gcc-4.9.2/libstdc++-v3/libsupc++ -O2 -g -std=gnu++0x /home/hushichen/DensePose-main/gcc-4.9.2/libstdc++-v3/include/precompiled/stdc++.h \
-o x86_64-unknown-linux-gnu/bits/stdc++.h.gch/O2ggnu++0x.gch
/home/hushichen/DensePose-main/gcc-build/./gcc/xgcc -shared-libgcc -B/home/hushichen/DensePose-main/gcc-build/./gcc -nostdinc++ -L/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/src -L/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs -L/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs -B/usr/local/x86_64-unknown-linux-gnu/bin/ -B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/x86_64-unknown-linux-gnu/include -isystem /usr/local/x86_64-unknown-linux-gnu/sys-include    -x c++-header -nostdinc++ -g -O2 -D_GNU_SOURCE  -I/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu -I/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include -I/home/hushichen/DensePose-main/gcc-4.9.2/libstdc++-v3/libsupc++ -O2 -g /home/hushichen/DensePose-main/gcc-4.9.2/libstdc++-v3/include/precompiled/stdc++.h -o x86_64-unknown-linux-gnu/bits/stdc++.h.gch/O2g.gch
In file included from /home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu/bits/gthr-default.h:35:0,
                 from /home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu/bits/gthr.h:148,
                 from /home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/ext/atomicity.h:35,
                 from /home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/ios_base.h:39,
                 from /home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/ios:42,
                 from /home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/istream:38,
                 from /home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/sstream:38,
                 from /home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/complex:45,
                 from /home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/ccomplex:38,
                 from /home/hushichen/DensePose-main/gcc-4.9.2/libstdc++-v3/include/precompiled/stdc++.h:52:
/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/ext/concurrence.h:122:34: error: cannot convert ‘<brace-enclosed initializer list>’ to ‘short int’ in initialization
     __gthread_mutex_t _M_mutex = __GTHREAD_MUTEX_INIT;
                                  ^
/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/ext/concurrence.h:177:44: error: cannot convert ‘<brace-enclosed initializer list>’ to ‘short int’ in initialization
     __gthread_recursive_mutex_t _M_mutex = __GTHREAD_RECURSIVE_MUTEX_INIT;
                                            ^
/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/ext/concurrence.h:255:32: error: could not convert ‘0’ from ‘int’ to ‘__pthread_cond_s::<anonymous union>’
     __gthread_cond_t _M_cond = __GTHREAD_COND_INIT;
                                ^
/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/ext/concurrence.h:255:32: error: could not convert ‘0’ from ‘int’ to ‘__pthread_cond_s::<anonymous union>’
/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/ext/concurrence.h:255:32: error: array must be initialized with a brace-enclosed initializer
/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/ext/concurrence.h:255:32: error: array must be initialized with a brace-enclosed initializer
/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/ext/concurrence.h:255:32: error: invalid conversion from ‘void*’ to ‘unsigned int’ [-fpermissive]
/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/ext/concurrence.h:255:32: error: array must be initialized with a brace-enclosed initializer
/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/ext/concurrence.h:255:32: error: too many initializers for ‘__pthread_cond_s’
/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/mutex:63:31: error: cannot convert ‘<brace-enclosed initializer list>’ to ‘short int’ in initialization
     __native_type  _M_mutex = __GTHREAD_MUTEX_INIT;
                               ^
/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/mutex:92:31: error: cannot convert ‘<brace-enclosed initializer list>’ to ‘short int’ in initialization
     __native_type  _M_mutex = __GTHREAD_RECURSIVE_MUTEX_INIT;
                               ^
/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/condition_variable:70:31: error: could not convert ‘0’ from ‘int’ to ‘__pthread_cond_s::<anonymous union>’
     __native_type   _M_cond = __GTHREAD_COND_INIT;
                               ^
/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/condition_variable:70:31: error: could not convert ‘0’ from ‘int’ to ‘__pthread_cond_s::<anonymous union>’
/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/condition_variable:70:31: error: array must be initialized with a brace-enclosed initializer
/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/condition_variable:70:31: error: array must be initialized with a brace-enclosed initializer
/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/condition_variable:70:31: error: invalid conversion from ‘void*’ to ‘unsigned int’ [-fpermissive]
/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/condition_variable:70:31: error: array must be initialized with a brace-enclosed initializer
/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/condition_variable:70:31: error: too many initializers for ‘__pthread_cond_s’
make[5]: *** [x86_64-unknown-linux-gnu/bits/stdc++.h.gch/O2ggnu++0x.gch] Error 1
make[5]: Leaving directory `/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3'
make[3]: *** [all] Error 2
make[3]: Leaving directory `/home/hushichen/DensePose-main/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3'
make[2]: *** [all-stage1-target-libstdc++-v3] Error 2
make[2]: Leaving directory `/home/hushichen/DensePose-main/gcc-build'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/hushichen/DensePose-main/gcc-build'
make: *** [all] Error 2

I have no experience in C++/C compiling, hope somebody can help me. My original gcc version is 4.8.5; cmake version 3.6.2.

hsc
  • 1
  • 2
  • Don't install anything from source. Find a package. You may want to look here https://stackoverflow.com/questions/47175706/how-to-install-gcc-4-9-2-on-rhel-7-4 – n. m. could be an AI Feb 17 '22 at 08:20
  • @n.1.8e9-where's-my-sharem. Thank you. I have found the devtoolset-3 for centos7, and I installed it successfully. But I still want to find out why I have this weird error when I compile from source. I have searched a lot but it seems nobody had the same error as me. Thank you again. – hsc Feb 18 '22 at 03:07

1 Answers1

0

I have searched a lot for this error. Since no one answer, I answer myself, in case someone else has the same error. In conclusion, this is an error related to a variable called pthread_mutex_t. The definition and the initialization of this variable are incompatible.

First, check the location of pthread.h and pthreadtypes.h

locate pthread.h
locate pthreadtypes.h

In my case, I have two pthread.h files in different locations. Usually, the one under /usr/include is the file used during the compiling process. check the definition of PTHREAD_MUTEX_INITIALIZER. It should be like:

{{0, 0, 0, 0, 0, 0, {0, 0}}}

or a definition with #ifdef, but they are almost the same thing.

Then check the pthreadtypes.h. Usually, it is under /usr/include/bits. Find the definition of pthread_mutex_t. One version (ver1.0) maybe looks like this:

typedef union

{

  struct __pthread_mutex_s __data;

  char __size[__SIZEOF_PTHREAD_MUTEX_T];

  long int __align;

} pthread_mutex_t;

Another version (ver2.0):

typedef union

{

  struct __pthread_mutex_s

  {

    int __lock;

    unsigned int __count;

    int __owner;

#if __WORDSIZE == 64

    unsigned int __nusers;

#endif

    /* KIND must stay at this position in the structure to maintain

       binary compatibility.  */

    int __kind;

#if __WORDSIZE == 64

    int __spins;

    __pthread_list_t __list;

# define __PTHREAD_MUTEX_HAVE_PREV 1

#else

    unsigned int __nusers;

    __extension__ union

    {

      int __spins;

      __pthread_slist_t __list;

    };

#endif

  } __data;

  char __size[__SIZEOF_PTHREAD_MUTEX_T];

  long int __align;

} pthread_mutex_t;

You can see that the second one is much longer, and define a struct with '{}' in the union. That's why the error information keep saying cannot convert ‘’ to ‘short int’ in initialization. The reason is that the PTHREAD_MUTEX_INITIALIZER initialized the pthread_mutex_t with {} in the union. However, if you have the definition that looks like ver1.0, then here is the conflict. Then you may just replace the definition with ver2.0.

This may also be related to your GNU version. The ver1.0 definition seems for a newer version.

Dharman
  • 30,962
  • 25
  • 85
  • 135
hsc
  • 1
  • 2