All of lore.kernel.org
 help / color / mirror / Atom feed
* autofs won't cross-compile
@ 2006-11-07 19:36 Paul Smith
  2006-11-08 16:39 ` Jeff Moyer
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Smith @ 2006-11-07 19:36 UTC (permalink / raw)
  To: autofs

[-- Attachment #1: Type: text/plain, Size: 1212 bytes --]

Hi all; autofs's configure.in is not properly set up to allow for
cross-compiling.  It fails trying to detect -fPIE, because configure.in
runs AC_RUN_IFELSE to run a program (which of course can't work during
cross-compilation) and does not provide a cross-compilation result.

I'm not sure why this test for PIE exists or if it's really needed, but
if you want to keep it please add an argument for cross-compilation.
Patch is attached, against 4.1.4 (but I checked 5.00beta1 and it had the
same issue).  As recommended by the autoconf manual, this patch is
pessimistic and assumes no PIE support for all cross-compilation
environments.

I've split the patch into two: one for configure.in and one for
configure itself (I'm not sure if you source code control the configure
script: some projects do and some don't).

Cheers!

-- 
-----------------------------------------------------------------------------
 Paul D. Smith <psmith@netezza.com>                       http://netezza.com
 "Please remain calm--I may be mad, but I am a professional."--Mad Scientist
-----------------------------------------------------------------------------
      These are my opinions--Netezza takes no responsibility for them.

[-- Attachment #2: autofs-1.patch --]
[-- Type: text/x-patch, Size: 549 bytes --]

--- autofs-4.1.4-old/configure.in	2005-04-06 11:24:37.000000000 -0400
+++ autofs-4.1.4/configure.in	2006-11-07 13:59:42.895680583 -0500
@@ -140,7 +140,8 @@
 DAEMON_LDFLAGS=
 AC_MSG_CHECKING([whether gcc -fPIE works])
 AC_RUN_IFELSE([AC_LANG_PROGRAM([[]], [[int main(void) {return 0;}]])],
-	      [gcc_supports_pie=yes], [gcc_supports_pie=no])
+	      [gcc_supports_pie=yes], [gcc_supports_pie=no],
+              [gcc_supports_pie=no])
 AC_MSG_RESULT([$gcc_supports_pie])
 if test $gcc_supports_pie = yes ; then
 	DAEMON_CFLAGS="-fPIE"

[-- Attachment #3: autofs-2.patch --]
[-- Type: text/x-patch, Size: 681 bytes --]

--- autofs-4.1.4-old/configure	2005-04-06 11:24:37.000000000 -0400
+++ autofs-4.1.4/configure	2006-11-07 14:07:37.896113601 -0500
@@ -4219,11 +4219,7 @@
 echo "$as_me:$LINENO: checking whether gcc -fPIE works" >&5
 echo $ECHO_N "checking whether gcc -fPIE works... $ECHO_C" >&6
 if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+  gcc_supports_pie=no
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */

[-- Attachment #4: Type: text/plain, Size: 140 bytes --]

_______________________________________________
autofs mailing list
autofs@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/autofs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: autofs won't cross-compile
  2006-11-07 19:36 autofs won't cross-compile Paul Smith
@ 2006-11-08 16:39 ` Jeff Moyer
  2006-11-14 22:46   ` Paul Smith
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Moyer @ 2006-11-08 16:39 UTC (permalink / raw)
  To: psmith; +Cc: autofs

Paul Smith <psmith@netezza.com> writes:

> Hi all; autofs's configure.in is not properly set up to allow for
> cross-compiling.  It fails trying to detect -fPIE, because configure.in
> runs AC_RUN_IFELSE to run a program (which of course can't work during
> cross-compilation) and does not provide a cross-compilation result.
>
> I'm not sure why this test for PIE exists or if it's really needed, but
> if you want to keep it please add an argument for cross-compilation.
> Patch is attached, against 4.1.4 (but I checked 5.00beta1 and it had the
> same issue).  As recommended by the autoconf manual, this patch is
> pessimistic and assumes no PIE support for all cross-compilation
> environments.
>
> I've split the patch into two: one for configure.in and one for
> configure itself (I'm not sure if you source code control the configure
> script: some projects do and some don't).

This is the wrong way to go about it.  We should probably provide a
--enable-PIE or some such option.  That way, anyone who cross-compiles
has the option of enabling it.

-Jeff

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: autofs won't cross-compile
  2006-11-08 16:39 ` Jeff Moyer
@ 2006-11-14 22:46   ` Paul Smith
  2006-12-11  5:43     ` Ian Kent
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Smith @ 2006-11-14 22:46 UTC (permalink / raw)
  To: Jeff Moyer; +Cc: autofs

On Wed, 2006-11-08 at 11:39 -0500, Jeff Moyer wrote:
> Paul Smith <psmith@netezza.com> writes:
> 
> > Hi all; autofs's configure.in is not properly set up to allow for
> > cross-compiling.  It fails trying to detect -fPIE, because configure.in
> > runs AC_RUN_IFELSE to run a program (which of course can't work during
> > cross-compilation) and does not provide a cross-compilation result.
> >
> > I'm not sure why this test for PIE exists or if it's really needed, but
> > if you want to keep it please add an argument for cross-compilation.
> > Patch is attached, against 4.1.4 (but I checked 5.00beta1 and it had the
> > same issue).  As recommended by the autoconf manual, this patch is
> > pessimistic and assumes no PIE support for all cross-compilation
> > environments.
> >
> > I've split the patch into two: one for configure.in and one for
> > configure itself (I'm not sure if you source code control the configure
> > script: some projects do and some don't).
> 
> This is the wrong way to go about it.  We should probably provide a
> --enable-PIE or some such option.  That way, anyone who cross-compiles
> has the option of enabling it.

That's fine, but why not leave the default as "off", as in my patch?  If
you don't want to do that then please at least add a 5th argument to
AC_RUN_IFELSE to print some kind of message telling the user what to do
(use --enable-pie or --disable-pie).  If you leave it as-is, then
configure just bombs out with a scary error message when it hits that
AC_RUN_IFELSE.

I did find a few other items which broke during cross-compilation; there
are a number of checks in configure looking for programs that live on
the disk, like mount etc.  It's a bit unpleasant since these could
potentially live somewhere different on the target system than they do
on the build system.  One idea would be to have configure options for
these as well.

However, with FHS etc. it's probably not TOO much of a stretch to
imagine these locations are fairly standard.  There is one item, though,
which did bite me: the test for the -s option to mount.  My build system
has it, but my target system uses BusyBox mount which doesn't support
-s.  There is no easy way to turn this off: I had to go in and patch
things to disable it.  It would be nice to have this as a configure
option, or something.

After these changes it does work... yay!

Cheers!

-- 
-----------------------------------------------------------------------------
 Paul D. Smith <psmith@netezza.com>                       http://netezza.com
 "Please remain calm--I may be mad, but I am a professional."--Mad Scientist
-----------------------------------------------------------------------------
      These are my opinions--Netezza takes no responsibility for them.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: autofs won't cross-compile
  2006-11-14 22:46   ` Paul Smith
@ 2006-12-11  5:43     ` Ian Kent
  0 siblings, 0 replies; 4+ messages in thread
From: Ian Kent @ 2006-12-11  5:43 UTC (permalink / raw)
  To: psmith; +Cc: autofs

On Tue, 2006-11-14 at 17:46 -0500, Paul Smith wrote:

Hi Paul,

> On Wed, 2006-11-08 at 11:39 -0500, Jeff Moyer wrote:
> > Paul Smith <psmith@netezza.com> writes:
> > 
> > > Hi all; autofs's configure.in is not properly set up to allow for
> > > cross-compiling.  It fails trying to detect -fPIE, because configure.in
> > > runs AC_RUN_IFELSE to run a program (which of course can't work during
> > > cross-compilation) and does not provide a cross-compilation result.
> > >
> > > I'm not sure why this test for PIE exists or if it's really needed, but
> > > if you want to keep it please add an argument for cross-compilation.
> > > Patch is attached, against 4.1.4 (but I checked 5.00beta1 and it had the
> > > same issue).  As recommended by the autoconf manual, this patch is
> > > pessimistic and assumes no PIE support for all cross-compilation
> > > environments.
> > >
> > > I've split the patch into two: one for configure.in and one for
> > > configure itself (I'm not sure if you source code control the configure
> > > script: some projects do and some don't).
> > 
> > This is the wrong way to go about it.  We should probably provide a
> > --enable-PIE or some such option.  That way, anyone who cross-compiles
> > has the option of enabling it.

There are several cross-compile issues not all straight forward as you
point out. So I'm going to have to leave this out for a little while,
sorry.

> 
> That's fine, but why not leave the default as "off", as in my patch?  If
> you don't want to do that then please at least add a 5th argument to
> AC_RUN_IFELSE to print some kind of message telling the user what to do
> (use --enable-pie or --disable-pie).  If you leave it as-is, then
> configure just bombs out with a scary error message when it hits that
> AC_RUN_IFELSE.

Leaving the default as off could cause problems for archs like sparc64
where the build might end up as a 64-bit binary instead of the required
32-bit one. Additional problems could be hiding because of a structure
size alignment bug in the kernel module communications packet. My
mistake, I know, but it's difficult to change once it's in the kernel
and in use and I haven't worked out how to fix it without possibly
causing pain.

So this would need a fair amount of effort to determine the changes
needed and a similar amount of testing.

> 
> I did find a few other items which broke during cross-compilation; there
> are a number of checks in configure looking for programs that live on
> the disk, like mount etc.  It's a bit unpleasant since these could
> potentially live somewhere different on the target system than they do
> on the build system.  One idea would be to have configure options for
> these as well.
> 
> However, with FHS etc. it's probably not TOO much of a stretch to
> imagine these locations are fairly standard.  There is one item, though,
> which did bite me: the test for the -s option to mount.  My build system
> has it, but my target system uses BusyBox mount which doesn't support
> -s.  There is no easy way to turn this off: I had to go in and patch
> things to disable it.  It would be nice to have this as a configure
> option, or something.

Think this would fall into the same basket as the cross-compile work.

Ian

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-12-11  5:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-07 19:36 autofs won't cross-compile Paul Smith
2006-11-08 16:39 ` Jeff Moyer
2006-11-14 22:46   ` Paul Smith
2006-12-11  5:43     ` Ian Kent

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.