Discussion:
Link tests when cross compiling
NightStrike
2013-04-12 20:20:30 UTC
Permalink
Why are link tests not allowed when cross compiling? You don't have
to run the exe to verify that linking worked.
Eric Blake
2013-04-12 20:26:49 UTC
Permalink
Post by NightStrike
Why are link tests not allowed when cross compiling? You don't have
to run the exe to verify that linking worked.
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.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
NightStrike
2013-04-12 20:38:29 UTC
Permalink
Post by Eric Blake
Post by NightStrike
Why are link tests not allowed when cross compiling? You don't have
to run the exe to verify that linking worked.
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.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
checking for main in -lpthread... configure: error: link tests are not
allowed after AC_NO_EXECUTABLES

That's me trying to use AC_CHECK_LIB when cross compiling.
Mike Frysinger
2013-04-12 20:44:48 UTC
Permalink
Post by NightStrike
Post by Eric Blake
Post by NightStrike
Why are link tests not allowed when cross compiling? You don't have
to run the exe to verify that linking worked.
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
That's me trying to use AC_CHECK_LIB when cross compiling.
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
NightStrike
2013-04-12 20:47:11 UTC
Permalink
Post by Mike Frysinger
Post by NightStrike
Post by Eric Blake
Post by NightStrike
Why are link tests not allowed when cross compiling? You don't have
to run the exe to verify that linking worked.
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
That's me trying to use AC_CHECK_LIB when cross compiling.
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.
Eric Blake
2013-04-12 21:15:07 UTC
Permalink
Post by NightStrike
Post by Mike Frysinger
Post by NightStrike
Post by Eric Blake
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.
Post by NightStrike
Post by Mike Frysinger
Post by NightStrike
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.
Post by NightStrike
Post by Mike Frysinger
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
NightStrike
2013-04-12 22:02:36 UTC
Permalink
Post by Eric Blake
Post by NightStrike
Post by Mike Frysinger
Post by NightStrike
Post by Eric Blake
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
# 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.
Post by NightStrike
Post by Mike Frysinger
Post by NightStrike
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.
I swear I grepped for that and didn't see it before I ever emailed the
list..... *sigh*...

This is for a pthread replacement library that should be compilable
before we have a working compiler. I did not make the initial build
system for this, so I have to see what problem this macro is trying to
solve.

Conceivably, though, we should be able to turn it on conditionally in
the worst case instead of all the time. IOW, only use it if we are
bootstrapping.

What I want to ultimately do is actually test to see if we are in said
bootstrap environment. In that case, we need to build a fake libgcc
to link in. Any idea how to do that?
Post by Eric Blake
Post by NightStrike
Post by Mike Frysinger
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
Mike Frysinger
2013-04-12 22:45:33 UTC
Permalink
Post by NightStrike
This is for a pthread replacement library that should be compilable
before we have a working compiler. I did not make the initial build
system for this, so I have to see what problem this macro is trying to
solve.
Conceivably, though, we should be able to turn it on conditionally in
the worst case instead of all the time. IOW, only use it if we are
bootstrapping.
What I want to ultimately do is actually test to see if we are in said
bootstrap environment. In that case, we need to build a fake libgcc
to link in. Any idea how to do that?
glibc already does this for its initial bootstrap. but this line of
questioning doesn't make much sense on the autoconf list. this should be gcc
and/or glibc's libc-help.
-mike

Loading...