Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 563208 - cross-x86_64-linux-musl/gcc-4.9.3-r99 fails to build due to missing ctype.h include
Summary: cross-x86_64-linux-musl/gcc-4.9.3-r99 fails to build due to missing ctype.h i...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Gentoo musl team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-16 09:32 UTC by Ingo Krabbe
Modified: 2016-01-09 19:04 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ingo Krabbe 2015-10-16 09:32:33 UTC
The failing compiler step is this one:

/var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/./gcc/xgcc -shared-libgcc -B/var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/./gcc -nostdinc++ -L/var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/src -L/var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/src/.libs -L/var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/libsupc++/.libs -B/usr/x86_64-linux-musl/bin/ -B/usr/x86_64-linux-musl/lib/ -isystem /usr/x86_64-linux-musl/include -isystem /usr/x86_64-linux-musl/sys-include    -x c++-header -nostdinc++ -D_GNU_SOURCE  -I/var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/include/x86_64-linux-musl -I/var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/include -I/var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/gcc-4.9.3/libstdc++-v3/libsupc++ -O2 -g -std=gnu++0x /var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/gcc-4.9.3/libstdc++-v3/include/precompiled/stdc++.h \
> -o x86_64-linux-musl/bits/stdc++.h.gch/O2ggnu++0x.gch
In file included from /var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/include/x86_64-linux-musl/bits/c++config.h:430:0,
                 from /var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/include/cctype:41,
                 from /var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/gcc-4.9.3/libstdc++-v3/include/precompiled/stdc++.h:35:
/var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/include/x86_64-linux-musl/bits/os_defines.h:44:19: Fehler: missing binary operator before token "("
 #if __GLIBC_PREREQ(2,15) && defined(_GNU_SOURCE)
                   ^
In file included from /var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/include/bits/locale_facets.h:41:0,
                 from /var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/include/bits/basic_ios.h:37,
                 from /var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/include/ios:44,
                 from /var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/include/istream:38,
                 from /var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/include/sstream:38,
                 from /var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/include/complex:45,
                 from /var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/include/ccomplex:38,
                 from /var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/gcc-4.9.3/libstdc++-v3/include/precompiled/stdc++.h:52:
/var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/include/x86_64-linux-musl/bits/ctype_base.h:49:35: Fehler: »_ISupper« wurde in diesem Gültigkeitsbereich nicht definiert
     static const mask upper     = _ISupper;
                                   ^
/var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/include/x86_64-linux-musl/bits/ctype_base.h:50:32: Fehler: »_ISlower« wurde in diesem Gültigkeitsbereich nicht definiert
     static const mask lower  = _ISlower;
                                ^
/var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/include/x86_64-linux-musl/bits/ctype_base.h:51:32: Fehler: »_ISalpha« wurde in diesem Gültigkeitsbereich nicht definiert
     static const mask alpha  = _ISalpha;
                                ^
/var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/include/x86_64-linux-musl/bits/ctype_base.h:52:32: Fehler: »_ISdigit« wurde in diesem Gültigkeitsbereich nicht definiert
     static const mask digit  = _ISdigit;
                                ^
/var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/include/x86_64-linux-musl/bits/ctype_base.h:53:33: Fehler: »_ISxdigit« wurde in diesem Gültigkeitsbereich nicht definiert
     static const mask xdigit  = _ISxdigit;
                                 ^
/var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/include/x86_64-linux-musl/bits/ctype_base.h:54:32: Fehler: »_ISspace« wurde in diesem Gültigkeitsbereich nicht definiert
     static const mask space  = _ISspace;
                                ^
/var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/include/x86_64-linux-musl/bits/ctype_base.h:55:32: Fehler: »_ISprint« wurde in diesem Gültigkeitsbereich nicht definiert
     static const mask print  = _ISprint;
                                ^
/var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/include/x86_64-linux-musl/bits/ctype_base.h:56:32: Fehler: »_ISalpha« wurde in diesem Gültigkeitsbereich nicht definiert
     static const mask graph  = _ISalpha | _ISdigit | _ISpunct;
                                ^
/var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/include/x86_64-linux-musl/bits/ctype_base.h:56:43: Fehler: »_ISdigit« wurde in diesem Gültigkeitsbereich nicht definiert
     static const mask graph  = _ISalpha | _ISdigit | _ISpunct;
                                           ^
/var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/include/x86_64-linux-musl/bits/ctype_base.h:56:54: Fehler: »_ISpunct« wurde in diesem Gültigkeitsbereich nicht definiert
     static const mask graph  = _ISalpha | _ISdigit | _ISpunct;
                                                      ^
/var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/include/x86_64-linux-musl/bits/ctype_base.h:57:32: Fehler: »_IScntrl« wurde in diesem Gültigkeitsbereich nicht definiert
     static const mask cntrl  = _IScntrl;
                                ^
/var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/include/x86_64-linux-musl/bits/ctype_base.h:58:32: Fehler: »_ISpunct« wurde in diesem Gültigkeitsbereich nicht definiert
     static const mask punct  = _ISpunct;
                                ^
/var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/include/x86_64-linux-musl/bits/ctype_base.h:59:32: Fehler: »_ISalpha« wurde in diesem Gültigkeitsbereich nicht definiert
     static const mask alnum  = _ISalpha | _ISdigit;
                                ^
/var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/include/x86_64-linux-musl/bits/ctype_base.h:59:43: Fehler: »_ISdigit« wurde in diesem Gültigkeitsbereich nicht definiert
     static const mask alnum  = _ISalpha | _ISdigit;
                                           ^

I assume the failing part is:

    -nostdinc++ -D_GNU_SOURCE \
    -I/var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/include/x86_64-linux-musl \
    -I/var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/build/x86_64-linux-musl/libstdc++-v3/include \
    -I/var/tmp/portage/cross-x86_64-linux-musl/gcc-4.9.3-r99/work/gcc-4.9.3/libstdc++-v3/libsupc++ 


the preprocessor error can be fixed quite simple, but the missing ctype.h is a bit strange. The build process seems to be broken, as usual with gnu autotools.



Reproducible: Always
Comment 1 Ingo Krabbe 2015-10-19 13:17:00 UTC
I found that there are unused patches for gcc, that where not used. Actually these patches are referenced in /var/lib/layman/musl/sys-devel/gcc:

#       if use elibc_musl; then
                cd "${S}"
                sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
                mv libstdc\+\+-v3/config/os/gnu-linux libstdc\+\+-v3/config/os/gnu-linux.org
                cp -r libstdc\+\+-v3/config/os/generic libstdc\+\+-v3/config/os/gnu-linux
                cp libstdc++-v3/config/os/gnu-linux.org/arm-eabi-extra.ver libstdc++-v3/config/os/gnu-linux/
                mv libitm/config/linux/x86 libitm/config/linux/x86_glibc
                cp -r libitm/config/generic libitm/config/linux/x86
                epatch "${FILESDIR}"/${PN}-4.9.3-musl-linker-path.patch
                epatch "${FILESDIR}"/${PN}-4.9.3-secure-plt.patch
                epatch "${FILESDIR}"/${PN}-4.9.3-musl-res_state.patch
                epatch "${FILESDIR}"/${PN}-4.8.3-musl-fix-libc5-assumption.patch
                epatch "${FILESDIR}"/${PN}-4.8.5-posix_memalign.patch
#       fi

I commented out the if statement, as I don't know why the use elibc_musl does not seem to work and in this portage branch I want to use the patches anyway.

What is the mechanism that should result in `use elibc_musl`=true? I even tried to manually set the use flag, but this does not help.
Comment 2 Felix Janda 2016-01-01 10:34:32 UTC
"use elibc_musl" evaluates to true only on systems on a musl profile.
As we can see from this report, the patches should also be applied when
creating a cross-compiler targetting musl from a glibc system.

Some of the patches against gcc are not clean, so we don't want to
apply them always. Instead, we could add a check for
"[[ ${CATEGORY} = cross-* ]]".
Comment 3 Ingo Krabbe 2016-01-09 14:11:35 UTC
Adding the if branch "[[ ${CATEGORY} = cross-* ]]" and feeding it with the same block as the "use elibc_musl" branch enables the right patches, that this error is vanished.
Comment 4 Anthony Basile gentoo-dev 2016-01-09 19:04:41 UTC
(In reply to Ingo Krabbe from comment #3)
> Adding the if branch "[[ ${CATEGORY} = cross-* ]]" and feeding it with the
> same block as the "use elibc_musl" branch enables the right patches, that
> this error is vanished.

i've pushed this fix, thanks for Felix for the patch.