[PATCH, libstdc++] Fix missing gthr-default.h issue on libstdc++ configure
I can't configure libstdc++ separately. To reproduce: mkdir BUILD cd BUILD ../libstdc++-v3/configure Error: make: *** No rule to make target `/users/pvchupin/android/toolchain/gcc/gcc-4.8/BUILD/../libgcc/gthr-default.h', needed by `bits/gthr-default.h'. Stop. See fix attached. Ok for trunk and 4.7? 2012-10-05 Pavel Chupin Fix missing gthr-default.h issue on separate libstdc++ configure * libstdc++-v3/acinclude.m4: Define glibcxx_thread_h. * libstdc++-v3/include/Makefile.am: Use glibcxx_thread_h. * libstdc++-v3/Makefile.in: Regenerate. * libstdc++-v3/configure: Regenerate. * libstdc++-v3/doc/Makefile.in: Regenerate. * libstdc++-v3/include/Makefile.in: Regenerate. * libstdc++-v3/libsupc++/Makefile.in: Regenerate. * libstdc++-v3/po/Makefile.in: Regenerate. * libstdc++-v3/python/Makefile.in: Regenerate. * libstdc++-v3/src/Makefile.in: Regenerate. * libstdc++-v3/src/c++11/Makefile.in: Regenerate. * libstdc++-v3/src/c++98/Makefile.in: Regenerate. * libstdc++-v3/testsuite/Makefile.in: Regenerate. -- Pavel Chupin Intel Corporation Fix-missing-gthr-default.h.patch Description: Binary data
Re: [PATCH, libstdc++] Fix missing gthr-default.h issue on libstdc++ configure
On Android NDK libstdc++ is configured, built and packaged separately. The problem is not dependency on libgcc sources but rather dependency on the symlink which is generated during libgcc build and cannot be found if libstdc++ is configured and built separately. It was working fine for 4.4 and 4.6. This issue has been introduced in 4.7. Do you think libstdc++ should not be built separately? 2012/10/6 Andrew Pinski : > On Fri, Oct 5, 2012 at 12:13 PM, Andrew Pinski wrote: >> On Fri, Oct 5, 2012 at 7:32 AM, Pavel Chupin >> wrote: >>> I can't configure libstdc++ separately. To reproduce: >>> >>> mkdir BUILD >>> cd BUILD >>> ../libstdc++-v3/configure >>> >>> Error: >>> make: *** No rule to make target >>> `/users/pvchupin/android/toolchain/gcc/gcc-4.8/BUILD/../libgcc/gthr-default.h', >>> needed by `bits/gthr-default.h'. Stop. >>> >>> See fix attached. >>> >>> Ok for trunk and 4.7? >> >> Why do you want to compile libstdc++ separately from GCC? I think you >> need to explain why you want to do that. In fact libstdc++ depends on >> libgcc internals is not a bug but rather a feature. > > One more thing is that for cases where target==host!=build, you can > just use the libraries which are produced by the cross compiler and > use "make all-host" and "make install-host" for the programs. > > This should simplify how Yocto builds the "native" GCC and not > worrying about building libstdc++ separately. > > Thanks, > Andrew Pinski > >> >> Thanks, >> Andrew Pinski >> >> >> >>> >>> 2012-10-05 Pavel Chupin >>> >>> Fix missing gthr-default.h issue on separate libstdc++ configure >>> * libstdc++-v3/acinclude.m4: Define glibcxx_thread_h. >>> * libstdc++-v3/include/Makefile.am: Use glibcxx_thread_h. >>> * libstdc++-v3/Makefile.in: Regenerate. >>> * libstdc++-v3/configure: Regenerate. >>> * libstdc++-v3/doc/Makefile.in: Regenerate. >>> * libstdc++-v3/include/Makefile.in: Regenerate. >>> * libstdc++-v3/libsupc++/Makefile.in: Regenerate. >>> * libstdc++-v3/po/Makefile.in: Regenerate. >>> * libstdc++-v3/python/Makefile.in: Regenerate. >>> * libstdc++-v3/src/Makefile.in: Regenerate. >>> * libstdc++-v3/src/c++11/Makefile.in: Regenerate. >>> * libstdc++-v3/src/c++98/Makefile.in: Regenerate. >>> * libstdc++-v3/testsuite/Makefile.in: Regenerate. >>> >>> -- >>> Pavel Chupin >>> Intel Corporation -- Pavel Chupin Software Engineer Intel Corporation
Re: [PATCH, libstdc++] Fix missing gthr-default.h issue on libstdc++ configure
It has been changed here: http://gcc.gnu.org/git/?p=gcc.git;a=commit;h=630d52ca0a88d173f89634a5d7dd8aee07d04d80 subj:"Move gthr to toplevel libgcc" Here is the change (builddir is used as the directory for gthr_default.h): -${host_builddir}/gthr-default.h: ${toplevel_srcdir}/gcc/${glibcxx_thread_h} \ +${host_builddir}/gthr-default.h: ${toplevel_builddir}/libgcc/gthr-default.h \ All other changes are fine since continue to look into srcdir: -${host_builddir}/gthr-posix.h: ${toplevel_srcdir}/gcc/gthr-posix.h \ +${host_builddir}/gthr-posix.h: ${toplevel_srcdir}/libgcc/config/gthr-posix.h \ 2012/10/8 Paolo Carlini : > On 10/08/2012 03:43 PM, Pavel Chupin wrote: >> >> This issue has been introduced in 4.7. > > Irrespective of what we are eventually going to do from a practical point of > view, I think it would be important to understand when/what introduced the > issue: did you analyze that in any detail? > > Thanks, > Paolo. -- Pavel Chupin Software Engineer Intel Corporation
Re: [PATCH, libstdc++] Fix missing gthr-default.h issue on libstdc++ configure
I'd like to know if my direction is ok. I can look into other issues releated to this and fix them, but it doesn't make much sense if separate build is not supported and can be easily broken in the future. This patch is enough for 4.7 to have build working (at least in Android environment). Is it ok for release it into trunk and 4.7? I'll take care of remaining trunk issues with other patches if necessary. 2012/10/9 Benjamin De Kosnik : > >> On Android NDK libstdc++ is configured, built and packaged separately. >> The problem is not dependency on libgcc sources but rather dependency >> on the symlink which is generated during libgcc build and cannot be >> found if libstdc++ is configured and built separately. >> It was working fine for 4.4 and 4.6. This issue has been introduced >> in 4.7. > > I can verify that building this way works for 4.6. > > This style of build, building separately, has not been known to work > before. In fact, it was explicitly broken for years. I am quite > surprised (but delighted) to see it working in 4.6. > > Separate builds not mentioned here: > http://gcc.gnu.org/onlinedocs/libstdc++/manual/configure.html > > This patch is fine. Alone, it's not enough to get you were you want to > go, as the build then dies in AC_OUTPUT, and libtool is not generated. > > > -benjamin -- Pavel Chupin Software Engineer Intel Corporation
Re: [PATCH, libstdc++] Fix missing gthr-default.h issue on libstdc++ configure
Could you try this fix? -- Pavel Chupin Intel Corporation Fix-missing-gthr-aix.h.patch Description: Binary data
Re: [PATCH, libstdc++] Fix missing gthr-default.h issue on libstdc++ configure
How about this patch? 2012/10/11 Rainer Orth : > Pavel Chupin writes: > >> Could you try this fix? > > Duplicating this much info from libgcc is certainly the wrong (read: > unmaintainable) approach. > > Rainer > > -- > - > Rainer Orth, Center for Biotechnology, Bielefeld University -- Pavel Chupin Software Engineer Intel Corporation Fix-missing-gthr-aix.h.2.patch Description: Binary data
Re: [PATCH, libstdc++] Fix missing gthr-default.h issue on libstdc++ configure
Please see attached patch (applicable after revert). I've moved libgcc libstdc++ common configure thread header chunk into separate gthr.m4. Could you please try it on AIX? Is it OK for trunk? Is it OK for 4.7 after a week testing in trunk? Fix-missing-gthr-default.h.2.patch Description: Binary data
Re: [PATCH] Redesign pthread in LIB_SPEC for systems without libpthread
On Mon, Apr 29, 2013 at 5:36 PM, Alexander Ivchenko wrote: > *ping* > > thank you, > Alexander > > 2013/4/15 Pavel Chupin : >> On Tue, Apr 2, 2013 at 1:59 PM, Pavel Chupin >> wrote: >>> On Mon, Apr 1, 2013 at 7:07 PM, Pavel Chupin >>> wrote: >>>> On Android pthread is integrated into libc. >>>> Attached patch fixes configures for this case by trying to build test >>>> without -pthread -lpthread. >>>> >>>> 2013-04-01 Pavel Chupin >>>> >>>> Fix libatomic and libgomp configure for systems without libpthread >>>> * libatomic/configure.ac: Add test without -pthread -lpthread. >>>> * libgomp/configure.ac: Ditto. >>>> * libatomic/configure: Regenerate. >>>> * libgomp/configure: Regenerate. >>>> >>>> OK for trunk? >>>> >>> >>> I think I made a better fix: >>> >>> 2013-04-02 Pavel Chupin >>> >>> Redesign pthread in LIB_SPEC for systems without libpthread >>> * gcc/config/gnu-user.h: Remove pthread from >>> GNU_USER_TARGET_LIB_SPEC >>> but keep in default LIB_SPEC >>> * gcc/config/linux-android.h: Add pthread to ANDROID_LIB_SPEC >>> >>> Is it OK for trunk? >> >> Ping >> >> -- >> Pavel Chupin >> Intel Corporation Ping. -- Pavel Chupin Intel Corporation
Re: [PATCH] Redesign pthread in LIB_SPEC for systems without libpthread
On Thu, May 16, 2013 at 10:49 AM, Pavel Chupin wrote: > On Mon, Apr 29, 2013 at 5:36 PM, Alexander Ivchenko > wrote: >> *ping* >> >> thank you, >> Alexander >> >> 2013/4/15 Pavel Chupin : >>> On Tue, Apr 2, 2013 at 1:59 PM, Pavel Chupin >>> wrote: >>>> On Mon, Apr 1, 2013 at 7:07 PM, Pavel Chupin >>>> wrote: >>>>> On Android pthread is integrated into libc. >>>>> Attached patch fixes configures for this case by trying to build test >>>>> without -pthread -lpthread. >>>>> >>>>> 2013-04-01 Pavel Chupin >>>>> >>>>> Fix libatomic and libgomp configure for systems without libpthread >>>>> * libatomic/configure.ac: Add test without -pthread -lpthread. >>>>> * libgomp/configure.ac: Ditto. >>>>> * libatomic/configure: Regenerate. >>>>> * libgomp/configure: Regenerate. >>>>> >>>>> OK for trunk? >>>>> >>>> >>>> I think I made a better fix: >>>> >>>> 2013-04-02 Pavel Chupin >>>> >>>> Redesign pthread in LIB_SPEC for systems without libpthread >>>> * gcc/config/gnu-user.h: Remove pthread from >>>> GNU_USER_TARGET_LIB_SPEC >>>> but keep in default LIB_SPEC >>>> * gcc/config/linux-android.h: Add pthread to ANDROID_LIB_SPEC >>>> >>>> Is it OK for trunk? >>> >>> Ping >>> > > Ping. > Ping. -- Pavel Chupin Intel Corporation
Re: [PATCH] Redesign pthread in LIB_SPEC for systems without libpthread
On Fri, Aug 16, 2013 at 3:21 AM, Maxim Kuvyrkov wrote: > On 15/08/2013, at 10:49 PM, Alexander Ivchenko wrote: > >> Could anybody please take a look? This is important for building gcc for >> android. >> >> ping^4 > > [Sorry for being cranky] > > There is a reason why people are ignoring your patch -- the submission is not > very well structured. > > First, the subject -- it is not accurate. "Redesign" implies a big change, > you would be better off with a heading like "Fix LIB_SPEC for Android". > > Second, you do not fully describe the problem that you are trying to fix. > > Third, you do not say how your patch fixes the problem. > > Lastly, you do not mention which targets you have encountered the problem on > and tested the fix on. Since you are from Intel, I can guess that you use > x86. > > >> >>>> 2013-04-02 Pavel Chupin >> >>>> >> >>>> Redesign pthread in LIB_SPEC for systems without libpthread >> >>>> * gcc/config/gnu-user.h: Remove pthread from >> >>>> GNU_USER_TARGET_LIB_SPEC >> >>>> but keep in default LIB_SPEC >> >>>> * gcc/config/linux-android.h: Add pthread to ANDROID_LIB_SPEC >> >>>> >> >>>> Is it OK for trunk? > > >> --- a/gcc/config/gnu-user.h >> +++ b/gcc/config/gnu-user.h >> @@ -74,11 +74,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. >> If not, see >> #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)" >> >> #define GNU_USER_TARGET_LIB_SPEC \ >> - "%{pthread:-lpthread} \ >> - %{shared:-lc} \ >> + "%{shared:-lc} \ > > Indentation seems off here, please double-check. > >> %{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}" >> #undef LIB_SPEC >> -#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC >> +#define LIB_SPEC "%{pthread:-lpthread} " GNU_USER_TARGET_LIB_SPEC > > You need to similarly add "%{pthread:-lpthread} " to LIB_SPEC in > gcc/config/mips/gnu-user.h. > >> >> #if defined(HAVE_LD_EH_FRAME_HDR) >> #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " >> diff --git a/gcc/config/linux-android.h b/gcc/config/linux-android.h >> index 831a19c..aaf1d34 100644 >> --- a/gcc/config/linux-android.h >> +++ b/gcc/config/linux-android.h >> @@ -49,7 +49,8 @@ >>"%{!frtti:%{!fno-rtti: -fno-rtti}}" >> >> #define ANDROID_LIB_SPEC \ >> - "%{!static: -ldl}" >> + "%{!static: -ldl}" \ >> + "%{pthread: -lc}" > > Add a comment to explain why -pthread option triggers -lc for Android. > > Please post the updated patch along with notes on which targets you have > tested it. Test coverage should include at least x86_64-linux-gnu and one of > android targets. > > Thank you, > > -- > Maxim Kuvyrkov > www.kugelworks.com > > Sorry for not being clear. Thanks for review. It's late to change subj I think to avoid producing new thread but I got your point. Problem is that all 3 Android compilers (arm, x86, mips) are failed to build on trunk due to libgomp and libatomic configure errors like (arm example): configure:14403: /tmp/ndk-pvchupin/build/host-gcc/i686-linux-gnu/build-gcc-4.9-arm-linux-androideabi/./gcc/xgcc -B/tmp/ndk-pvchupin/build/host-gcc/i686-linux-gnu/build-gcc-4.9-arm-linux-androideabi/./gcc/ -B/tmp/ndk-pvchupin/build/host-gcc/i686-linux-gnu/temp-arm-linux-androideabi-4.9/arm-linux-androideabi/bin/ -B/tmp/ndk-pvchupin/build/host-gcc/i686-linux-gnu/temp-arm-linux-androideabi-4.9/arm-linux-androideabi/lib/ -isystem /tmp/ndk-pvchupin/build/host-gcc/i686-linux-gnu/temp-arm-linux-androideabi-4.9/arm-linux-androideabi/include -isystem /tmp/ndk-pvchupin/build/host-gcc/i686-linux-gnu/temp-arm-linux-androideabi-4.9/arm-linux-androideabi/sys-include -o conftest -g -Os -fno-sync-libcalls -pthread conftest.c >&5 /tmp/ndk-pvchupin/build/host-gcc/i686-linux-gnu/temp-binutils-2.23-arm-linux-androideabi/bin/arm-linux-androideabi-ld: error: cannot find -lpthread There is no libpthread library in Bionic, pthreads is integrated into libc. My fix removes -lpthread from GNU_USER_TARGET_LIB_SPEC definition which is included in both bionic and linux but keeping it in linux LIB_SPEC. Please see modified patch attached. I've built all 3 Android compilers, x86_64 and i686 and ran simple test with -pthread. Updated ChangeLog: 2013-08-16 Pavel Chupin Fix LIB_SPEC for systems without libpthread * config/gnu-user.h: Remove pthread from GNU_USER_TARGET_LIB_SPEC but keep at LIB_SPEC. * config/arm/linux-eabi.h: Add pthread to linux LIB_SPEC. * config/i386/linux-common.h: Likewise. * config/mips/gnu-user.h: Likewise. * config/mips/linux-common.h: Likewise. Is it OK now? -- Pavel Chupin Intel Corporation 0001-Fix-LIB_SPEC-for-systems-without-libpthread.patch Description: Binary data
Re: [PATCH] Redesign pthread in LIB_SPEC for systems without libpthread
> 1. In config/gnu-user.h you define GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC to > the main part of GNU_USER_TARGET_LIB_SPEC. GNU_USER_TARGET_LIB_SPEC now > becomes '"%{pthread:-lpthread} " GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC'. > 2. In occurrences of LINUX_OR_ANDROID_LD you continue to use > GNU_USER_TARGET_LIB_SPEC for the first argument and > 'GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC " " ANDROID_LIB_SPEC' for the second > argument. > > This way you are operating with named macros instead of verbatim > "%{pthread:-lpthread}", and, hopefully, this will be more clear to an outside > observer. > Done. >> >> Please see modified patch attached. >> I've built all 3 Android compilers, x86_64 and i686 and ran simple >> test with -pthread. > > Thanks for good test coverage. I assume you have also tested a non-android > Linux target? Yes. By x86_64 and i686 above I meant Linux non-android target. And I built successfully all 3 Android compilers. > > The patch is OK if adjusted to the comments above (or good arguments provided > why your current patch is more straigh-forward). > Thanks. I'm OK with your suggestions. Please see adjusted patch attached. Updated ChangeLog: 2013-08-19 Pavel Chupin Fix LIB_SPEC for systems without libpthread * config/gnu-user.h: Introduce GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC. * config/arm/linux-eabi.h: Use GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC for Android. * config/i386/linux-common.h: Likewise. * config/mips/linux-common.h: Likewise. -- Pavel Chupin Intel Corporation 0001-Fix-LIB_SPEC-for-systems-without-libpthread.patch Description: Binary data
[PATCH, libgomp, libatomic] Fix configure for systems without libpthread
On Android pthread is integrated into libc. Attached patch fixes configures for this case by trying to build test without -pthread -lpthread. 2013-04-01 Pavel Chupin Fix libatomic and libgomp configure for systems without libpthread * libatomic/configure.ac: Add test without -pthread -lpthread. * libgomp/configure.ac: Ditto. * libatomic/configure: Regenerate. * libgomp/configure: Regenerate. OK for trunk? -- Pavel Chupin Intel Corporation 0001-Fix-libatomic-and-libgomp-configure-for-systems-with.patch Description: Binary data
[PATCH] Redesign pthread in LIB_SPEC for systems without libpthread (was: [PATCH, libgomp, libatomic] Fix configure for systems without libpthread)
On Mon, Apr 1, 2013 at 7:07 PM, Pavel Chupin wrote: > On Android pthread is integrated into libc. > Attached patch fixes configures for this case by trying to build test > without -pthread -lpthread. > > 2013-04-01 Pavel Chupin > > Fix libatomic and libgomp configure for systems without libpthread > * libatomic/configure.ac: Add test without -pthread -lpthread. > * libgomp/configure.ac: Ditto. > * libatomic/configure: Regenerate. > * libgomp/configure: Regenerate. > > OK for trunk? > I think I made a better fix: 2013-04-02 Pavel Chupin Redesign pthread in LIB_SPEC for systems without libpthread * gcc/config/gnu-user.h: Remove pthread from GNU_USER_TARGET_LIB_SPEC but keep in default LIB_SPEC * gcc/config/linux-android.h: Add pthread to ANDROID_LIB_SPEC Is it OK for trunk? -- Pavel Chupin Intel Corporation 0001-Redesign-pthread-in-LIB_SPEC-for-systems-without-lib.patch Description: Binary data
Re: [PATCH] Redesign pthread in LIB_SPEC for systems without libpthread
On Tue, Apr 2, 2013 at 1:59 PM, Pavel Chupin wrote: > On Mon, Apr 1, 2013 at 7:07 PM, Pavel Chupin wrote: >> On Android pthread is integrated into libc. >> Attached patch fixes configures for this case by trying to build test >> without -pthread -lpthread. >> >> 2013-04-01 Pavel Chupin >> >> Fix libatomic and libgomp configure for systems without libpthread >> * libatomic/configure.ac: Add test without -pthread -lpthread. >> * libgomp/configure.ac: Ditto. >> * libatomic/configure: Regenerate. >> * libgomp/configure: Regenerate. >> >> OK for trunk? >> > > I think I made a better fix: > > 2013-04-02 Pavel Chupin > > Redesign pthread in LIB_SPEC for systems without libpthread > * gcc/config/gnu-user.h: Remove pthread from GNU_USER_TARGET_LIB_SPEC > but keep in default LIB_SPEC > * gcc/config/linux-android.h: Add pthread to ANDROID_LIB_SPEC > > Is it OK for trunk? Ping -- Pavel Chupin Intel Corporation 0001-Redesign-pthread-in-LIB_SPEC-for-systems-without-lib.patch Description: Binary data
Re: [PATCH, Android] Stack protector enabling for Android target
Hi all, First hunk is not needed indeed. Testing is ok. Thanks!!! Here is the final patch: diff --git a/gcc/configure.ac b/gcc/configure.ac index 2c17736..43e760b 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -4566,6 +4566,11 @@ AC_CACHE_CHECK(__stack_chk_fail in target C library, $target_header_dir/bits/uClibc_config.h > /dev/null; then gcc_cv_libc_provides_ssp=yes fi + # all versions of Bionic support stack protector + elif test -f $target_header_dir/sys/cdefs.h \ +&& $EGREP '^[ ]*#[]*define[ ]+__BIONIC__[ ]+1' \ + $target_header_dir/sys/cdefs.h > /dev/null; then + gcc_cv_libc_provides_ssp=yes fi] ;; *-*-gnu*) 2012/5/15 Maxim Kuvyrkov : > On 12/05/2012, at 9:03 AM, Igor Zamyatin wrote: > >> Hi! >> >> Please look at the modified patch in the attachment. ChangeLog remains the >> same. >> >> Tested in android environment(x86_64-*-linux-android), also >> bootstrapped on x86_64-unknown-linux-gnu. >> I also started regtesting on linux. Is it ok after successfull regtesting? > > diff --git a/gcc/configure.ac b/gcc/configure.ac > index 2c17736..43e760b 100644 > --- a/gcc/configure.ac > +++ b/gcc/configure.ac > @@ -4545,7 +4545,7 @@ AC_CACHE_CHECK(__stack_chk_fail in target C library, > gcc_cv_libc_provides_ssp, > [gcc_cv_libc_provides_ssp=no > case "$target" in > - *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu) > + *-*-linux* | *-android* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu) > > You should not need this change. Android target triplets are of form > *-*-linux-android*, which matches *-*-linux*. > > [# glibc 2.4 and later provides __stack_chk_fail and > # either __stack_chk_guard, or TLS access to stack guard canary. > if test -f $target_header_dir/features.h \ > @@ -4566,6 +4566,11 @@ AC_CACHE_CHECK(__stack_chk_fail in target C library, > $target_header_dir/bits/uClibc_config.h > /dev/null; then > gcc_cv_libc_provides_ssp=yes > fi > + # all versions of Bionic support stack protector > + elif test -f $target_header_dir/sys/cdefs.h \ > + && $EGREP '^[ ]*#[ ]*define[ ]+__BIONIC__[ ]+1' \ > + $target_header_dir/sys/cdefs.h > /dev/null; then > + gcc_cv_libc_provides_ssp=yes > fi] > ;; > *-*-gnu*) > > The patch is OK provided successful regtest and either dropping the first > hunk or explaining why it is necessary. > > Thanks! > > -- > Maxim Kuvyrkov > CodeSourcery / Mentor Graphics > -- Pavel Chupin Software Engineer Intel Corporation