crosstool-NG icon indicating copy to clipboard operation
crosstool-NG copied to clipboard

Can't compile branch lx106-g++-1.21.0 with GCC6

Open Mforcen opened this issue 6 years ago • 1 comments

Hi all. I tried to compile this github repo, using the lx106-g++-1.21.0 branch, but at the end of the compilation process, an error is shown, and the installation process is not finished. The error is the following:

[ERROR]    cfns.gperf:101:1: error: 'const char* libc_name_p(const char*, unsigned int)' redeclared inline with 'gnu_inline' attribute
[ERROR]    make[2]: *** [cp/except.o] Error 1
[ERROR]    make[1]: *** [all-gcc] Error 2
[ERROR]   
[ERROR]  >>
[ERROR]  >>  Build failed in step 'Installing final compiler'
[ERROR]  >>        called in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: CT_DoExecLog[scripts/functions@257]
[ERROR]  >>        called from: do_cc_core_backend[scripts/build/cc/gcc.sh@482]
[ERROR]  >>        called from: do_cc_for_host[scripts/build/cc/gcc.sh@596]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@638]
[ERROR]  >>
[ERROR]  >>  For more info on this error, look at the file: 'build.log'
[ERROR]  >>  There is a list of known issues, some with workarounds, in:
[ERROR]  >>      'share/doc/crosstool-ng/ct-ng.1.21.0/B - Known issues.txt'
[ERROR]   
[ERROR]  (elapsed: 12:49.04)
[12:50] / ct-ng:147: fallo en las instrucciones para el objetivo 'build'
make: *** [build] Error 2

After some research, I found out that the error is common in others versions of GCC, and its solution is easy (in fact, I think this error is solved in other branches of this repo). I managed to solve this error by adding the following lines in cfns.h (which is downloaded by ./ct-ng build)

#ifdef __GNUC_STDC_INLINE__
__attribute__ ((__gnu_inline__))
#endif

I think that this fix should be pushed to the branch (but I'm not sure how this works). Thanks for the effort and sorry for the bad english.

EDIT: I tried right now by erasing all the files and cloning them, but original file cfns.h already has this:

#ifdef __GNUC__
__inline
#ifdef __GNUC_STDC_INLINE__
__attribute__ ((__gnu_inline__))
#endif
#endif

This also does not work, but it can't be fixed like that anymore. Any help would be appreciated. Thanks in advance.

Mforcen avatar Jul 13 '17 23:07 Mforcen

Hello, I managed to fix this part. The problem is that this code (cfns.h:125):

#ifdef __GNUC__
__inline
#ifdef __GNUC_STDC_INLINE__
__attribute__ ((__gnu_inline__))
#endif
#endif

probably applies both __inline and __gnu_inline__ attributes. You can see in the function above in that file that this code should look like this:

#ifdef __GNUC__
__inline
#else // this makes only one attribute applied
#ifdef __GNUC_STDC_INLINE__
__attribute__ ((__gnu_inline__))
#endif
#endif

Hope it helps

apokrovskyi avatar Oct 04 '17 16:10 apokrovskyi