This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libstdc++ gets configure error in cross builds


On Dec 2, 2010, at 3:05 PM, Ian Lance Taylor wrote:

> Paul Koning <paul_koning@Dell.com> writes:
> 
>> On Dec 2, 2010, at 2:55 PM, Ian Lance Taylor wrote:
>> 
>>> Paul Koning <paul_koning@dell.com> writes:
>>> 
>>>> I'm trying to do a cross-build of gcc 4.5.1.  It works fine until I
>>>> get to libstdc++v3, where configure blows up with a message saying
>>>> "Link tests are not allowed after GCC_NO_EXECUTABLES".  This happens
>>>> on the "checking for shl_load" step (line 11221 in configure).
>>>> 
>>>> I looked at configure.ac to see if there were any clues.  I can't tell
>>>> which line in configure.ac produces the offending line in configure
>>>> (not enough autoconf skills).  In an earlier gcc (3.3.3) there was a
>>>> similar issue, and in that case I worked around it by removing
>>>> "GLIBCPP_CHECK_COMPILER_VERSION" from the configure.in file.  But that
>>>> line doesn't exist in configure.ac and attempts to find something
>>>> analogous didn't get me anywhere.
>>> 
>>> GCC_NO_EXECUTABLES, in config/no-executables.m4, redefines
>>> AC_LINK_IFELSE to produce that error message.
>> 
>> Thanks.  But why does the released configure fail like this?  Any idea how to fix this bug?
> 
> You need to tell us precisely what you tried to do and precisely what
> happened.
> 
> The TARGET/libstdc++-v3/config.log file may contain a clue.

It's configured --target=mips64el-netbsdelf --enable-languages=c,c++, on an i686-pc-linux-gnu host.

After some searching I concocted this patch:

Index: libtool.m4
===================================================================
--- libtool.m4	(revision 147400)
+++ libtool.m4	(working copy)
@@ -1715,6 +1715,11 @@
     lt_cv_dlopen_self=yes
     ;;
 
+  netbsd*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+    ;;
+
   mingw* | pw32* | cegcc*)
     lt_cv_dlopen="LoadLibrary"
     lt_cv_dlopen_libs=

and now I get a lot further in the libstdc++ configure, but it still doesn't get past that.  The last two steps in config.log are:

configure:56645: checking for ld version
configure:56656: result: 22001
configure:56683: checking for ld that supports -Wl,--gc-sections
configure:56686: error: Link tests are not allowed after GCC_NO_EXECUTABLES.

That's code in libstdc++-v4/acinclude.m4 .  I'm not sure why it uses the ld version number to decide that --gc-sections is supported, and then once it finds out that it it supported, it runs another test to check if it's supported.  Can I get rid of that test link?  Apparently yes:

Index: libstdc++-v3/acinclude.m4
===================================================================
--- libstdc++-v3/acinclude.m4	(revision 147400)
+++ libstdc++-v3/acinclude.m4	(working copy)
@@ -230,7 +230,8 @@
       glibcxx_have_gc_sections=yes
     fi
   fi
-  if test "$glibcxx_have_gc_sections" = "yes"; then
+  if test "$glibcxx_have_gc_sections" = "yes" &&
+	test x$gcc_no_link != xyes; then
     # Sufficiently young GNU ld it is!  Joy and bunny rabbits!
     # NB: This flag only works reliably after 2.16.1. Configure tests
     # for this are difficult, so hard wire a value that should work.


...and now the configure works, and libstdc++ is building happily.

	paul



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]