[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Link tests when cross compiling
From: |
Eric Blake |
Subject: |
Re: Link tests when cross compiling |
Date: |
Fri, 12 Apr 2013 15:15:07 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130402 Thunderbird/17.0.5 |
On 04/12/2013 02:47 PM, NightStrike wrote:
>>>> What gave you the impression that link tests are not allowed when cross
>>>> compiling? We use link tests all the time. It is run tests that
>>>> require a fallback when cross-compiling, not link tests.
>>>
>>> checking for main in -lpthread... configure: error: link tests are not
>>> allowed after AC_NO_EXECUTABLES
AC_NO_EXECUTABLES is intentionally not documented in the autoconf
manual; here are the comments at its m4 definition:
# AC_NO_EXECUTABLES
# -----------------
# FIXME: The GCC team has specific needs which the current Autoconf
# framework cannot solve elegantly. This macro implements a dirty
# hack until Autoconf is able to provide the services its users
# need.
#
# Several of the support libraries that are often built with GCC can't
# assume the tool-chain is already capable of linking a program: the
# compiler often expects to be able to link with some of such
# libraries.
#
# In several of these libraries, workarounds have been introduced to
# avoid the AC_PROG_CC_WORKS test, that would just abort their
# configuration. The introduction of AC_EXEEXT, enabled either by
# libtool or by CVS autoconf, have just made matters worse.
#
# Unlike an earlier version of this macro, using AC_NO_EXECUTABLES does
# not disable link tests at autoconf time, but at configure time.
# This allows AC_NO_EXECUTABLES to be invoked conditionally.
>>>
>>> That's me trying to use AC_CHECK_LIB when cross compiling.
Why are you using AC_NO_EXECUTABLES? Are you working on gcc? If so,
this question is better asked on the gcc list. If not, then don't use it.
>>
>> please post full config.logs. what you've shown is that your compiler has
>> been
>> flagged as not being able to produce executables which is very different from
>> "is it a cross-compiler".
>> -mike
>
> Attached. Interesting, though, when I don't cross compile, the check
> executes. And, I've always seen this when I try to cross compile.
>
> I must have something fundamentally wrong in my understanding.
> Hopefully, the attached log helps you to enlighten me.
The reason that gcc rejects link tests is because of historical baggage
of how the uber-tree is used to build an entire cross environment
(libraries, gcc, gdb, and more, all in one go) - in THAT environment,
configure can't perform link tests, because the tests would have to link
against the cross-built libraries, but this is the configure script
trying to set up those cross-built libraries (they don't exist yet, so
the link test will do the wrong thing).
Outside of gcc's special needs, you should generally have no problem
pre-installing cross-built libraries, at which point, you should have no
need for AC_NO_EXECUTABLES in your configure.ac.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature