4

I'm currently trying to install gcc41 using the AUR and I'm experiencing an issue.

Everytime it goes through the compiling process the build fails because it cannot complete compilation of the toplev object because there is a redefinition error.

Here is the error. I don't really know where to go from here.

In file included from ../../gcc/toplev.c:31:0:
../../gcc/gcov-io.h: In function ‘gcov_position’:
../../gcc/system.h:575:55: warning: ISO C does not support ‘__FUNCTION__’ predefined identifier [-Wpedantic]
((void)(!(EXPR) ? fancy_abort (__FILE__, __LINE__, __FUNCTION__), 0 : 0))
                                                   ^
../../gcc/gcov-io.h:572:3: note: in expansion of macro ‘gcc_assert’
   gcc_assert (gcov_var.mode > 0);
   ^
../../gcc/toplev.c: At top level:
../../gcc/toplev.c:524:1: error: redefinition of ‘floor_log2’
 floor_log2 (unsigned HOST_WIDE_INT x)
 ^
In file included from ../../gcc/toplev.c:59:0:
../../gcc/toplev.h:175:1: note: previous definition of ‘floor_log2’ was here
 floor_log2 (unsigned HOST_WIDE_INT x)
 ^
../../gcc/toplev.c:559:1: error: redefinition of ‘exact_log2’
 exact_log2 (unsigned HOST_WIDE_INT x)
 ^
In file included from ../../gcc/toplev.c:59:0:
../../gcc/toplev.h:181:1: note: previous definition of ‘exact_log2’ was here
 exact_log2 (unsigned HOST_WIDE_INT x)
 ^
Makefile:2064: recipe for target 'toplev.o' failed
make[2]: *** [toplev.o] Error 1
make[2]: Leaving directory '/tmp/yaourt-tmp-michael/aur-gcc41/src/gcc-4.1.2/build/gcc'
Makefile:3907: recipe for target 'all-gcc' failed
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory '/tmp/yaourt-tmp-michael/aur-gcc41/src/gcc-4.1.2/build'
Makefile:617: recipe for target 'all' failed
make: *** [all] Error 2
2

I ran into something like this before. I think the issue is that you're trying to compile gcc41 from AUR, using GCC 5.2.0-1 (latest arch version.) GCC adds new errors as versions go on, so the source code of older versions of GCC isn't always considered valid under newer versions of GCC. If you can find a way to disable this warning that might do the trick. If you can use the Arch wayback machine to get a gcc 4.2 binary, you could compile gcc 4.2 source with itself in binary form.

3

I tried to install gcc 4.4.7, too, with a newer gcc version. I've seen the same errors as you. According to this bug report, the problem comes from the flag -fno-gn89-inline, which became the default flag for handling inline functions on newer gcc versions. As of gcc 4.3, the default was -fgnu89-inline. So all you need to do, is set the -fgnu89-inline flag when compiling.

I tried this with

CFLAGS='-fgnu89-inline -g -O2' CXXFLAGS='-fgnu89-inline -g -O2' ./configure
make

but I still get the same error. I assume the flags do not get properly forwarded, but I don't know. Then I tried a normal

./configure

and changed the two lines in the Makefile from

CC = gcc
CXX = g++

to

CC = gcc -fgnu89-inline
CXX = g++ -fgnu89-inline

With this, I didn't see the errors any more.

However, I ran into other errors:

@itemx must follow @item

They are caused by a newer version of texinfo, so what you could do is using an older version of texinfo. Maybe you could also fix them by hand, I tried it for one case, but I don't know what I'm doing so I didn't follow this path.

Long story short, I guess you are better off by running a virtual machine or a docker image.

2
  • 1
    to avoid the texinfo errors you can simply add MAKEINFO=true to i.e. make -j 2 ... MAKEINFO=true bootstrap - and all the commands that try to build texinfo will just return true.. effectively disabling that part of the build.
    – ejb
    Mar 1 at 1:18
  • 1
    also - STAGE1_CFLAGS='-fgnu89-inline'
    – ejb
    Mar 1 at 5:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.