9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] Silly porting fun
@ 2000-07-13  0:31 Russ Cox
  2000-07-13  5:21 ` Randolph Fritz
  0 siblings, 1 reply; 26+ messages in thread
From: Russ Cox @ 2000-07-13  0:31 UTC (permalink / raw)
  To: 9fans

	The compiler, reasonably enough, decides that this routine never does
	anything and is never called, and optimizes it out of existence!  The
	linker then cannot find main(), and fails.  Is there an option switch

That's not what's happening.
The linker cannot find _main, which
calls main, because there have been
no #pragma lines that tell it where
to find libc.a.

In Plan 9, the name you type is the
name that gets used.  No underscores
are added or removed.

I find that the only thing configure 
doesn't do right for APE is try to
compile empty files.

If you really want configure to run,
find the line that says ``AIX loses...''
and change the next line, which is
	echo > foo.c
to
	echo '#include <stdio.h>' > foo.c
Then things usually ``work''.

A well written build process is usually
easy to convert to mk, often by guessing.
I ported cvs yesterday, creating mkfiles
by processing the output of ls *.c, and
it worked the first time.

Russ



^ permalink raw reply	[flat|nested] 26+ messages in thread
* Re: [9fans] Silly porting fun
@ 2000-07-14 18:42 dhog
  0 siblings, 0 replies; 26+ messages in thread
From: dhog @ 2000-07-14 18:42 UTC (permalink / raw)
  To: 9fans

Oh no, the echo is back.



^ permalink raw reply	[flat|nested] 26+ messages in thread
* Re: [9fans] Silly porting fun
@ 2000-07-14 14:53 Russ Cox
  0 siblings, 0 replies; 26+ messages in thread
From: Russ Cox @ 2000-07-14 14:53 UTC (permalink / raw)
  To: 9fans

	to Plan9 without much trouble - and not using configure) on Solaris 7.  At
	least on all Solaris 7 machines I tried it detects that GSSAPI is available,
	and then during the compilation it complains because the libraries are not
	there.  I believe it must be a case of Sun shipping the C include files but
	not the library or something.

Actually I think that part of the script is just broken.
It detected GSSAPI on Plan 9 too.  That was when
I gave up and edited config.h.in into config.h by
hand.  I have a couple scripts called def and undef,
and I just sit in acme piping lines through one or
the other.  It doesn't take very long at all.

Russ



^ permalink raw reply	[flat|nested] 26+ messages in thread
* Re: [9fans] Silly porting fun
@ 2000-07-14 14:04 bobf
  0 siblings, 0 replies; 26+ messages in thread
From: bobf @ 2000-07-14 14:04 UTC (permalink / raw)
  To: 9fans

> >>What I'd like to see...  mk for Unix :)  Anyone here who has attempted to port
> >>it over (along with rc of course)?
>
> i should be making a portable version of mk available shortly from a Vita Nuova site.
> it's the version used to build Inferno on Unix and Windows.

i should point out that the version of mk released with inferno
accepts recipes in either rc or sh syntax, so it is not necessary
to port rc.

on windows, we use a stripped-down version of rc that sean quinlan
hacked.  it's not fully functional, but communicates with mk well
enough to do builds.



^ permalink raw reply	[flat|nested] 26+ messages in thread
* Re: [9fans] Silly porting fun
@ 2000-07-14  9:58 forsyth
  2000-07-16 16:04 ` Lucio De Re
  0 siblings, 1 reply; 26+ messages in thread
From: forsyth @ 2000-07-14  9:58 UTC (permalink / raw)
  To: 9fans

>>What I'd like to see...  mk for Unix :)  Anyone here who has attempted to port
>>it over (along with rc of course)?

i should be making a portable version of mk available shortly from a Vita Nuova site.
it's the version used to build Inferno on Unix and Windows.



^ permalink raw reply	[flat|nested] 26+ messages in thread
* Re: [9fans] Silly porting fun
@ 2000-07-14  4:18 pip
  0 siblings, 0 replies; 26+ messages in thread
From: pip @ 2000-07-14  4:18 UTC (permalink / raw)
  To: rob, 9fans

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

> Why should I type 
>	./configure
>	make
> ?
> Surely make can run configure for me.

I'm not arguing in defense of, or against any particular kindergarten
of thought, but:

Quite obviously at that point you do not even have a Makefile,
so that would require a bootstrapping Makefile that gets replaced
by the real Makefile that configure generates. In general you might
want to call configure with certain parameters. 

I generally never do a ./configure right away, but do a './configure --help'  
or peruse some config* files to see what options I can pass to configure,
 'cos I generally end up needing an option to install into a non-standard
bin directory, for various reasons like I'm not doing the install as
root or I need to override the default parameters 'cos I'm compiling
a package for a different arch with a cross-compiler.

but that's just me and I'm a weirdo.
-
pip


[-- Attachment #2: Type: message/rfc822, Size: 1395 bytes --]

From: "rob pike" <rob@plan9.bell-labs.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] Silly porting fun
Date: Thu, 13 Jul 2000 19:58:38 -0400
Message-ID: <200007132358.TAA15417@cse.psu.edu>

Why should I type
	./configure
	make
?
Surely make can run configure for me.

-rob


^ permalink raw reply	[flat|nested] 26+ messages in thread
* Re: [9fans] Silly porting fun
@ 2000-07-13 23:58 rob pike
  2000-07-14  9:18 ` Douglas A. Gwyn
  0 siblings, 1 reply; 26+ messages in thread
From: rob pike @ 2000-07-13 23:58 UTC (permalink / raw)
  To: 9fans

Why should I type
	./configure
	make
?
Surely make can run configure for me.

-rob



^ permalink raw reply	[flat|nested] 26+ messages in thread
* Re: [9fans] Silly porting fun
@ 2000-07-13 20:32 Russ Cox
  0 siblings, 0 replies; 26+ messages in thread
From: Russ Cox @ 2000-07-13 20:32 UTC (permalink / raw)
  To: 9fans

If you want auto-configuration, autoconf is
indeed the cream of that particular crop,
especially compared to some other
systems I've seen.  You're correct that rolling
your own auto-configuration program is not
a good idea.

As long as package authors stick to even
more basic principles about writing portable
_code_, auto-configuration is not necessary.
Then there are no build parameters to tweak.
I cite as examples drawterm, newsqueak,
and sam.  I'm sure there are less parochial ones.

(In drawterm, it does not cease to amaze me
that the only difference between the code used
under FreeBSD and the code used under Irix
is five lines of assembly for test-and-set.  And
there are no #ifdefs.)

Russ



^ permalink raw reply	[flat|nested] 26+ messages in thread
* Re: [9fans] Silly porting fun
@ 2000-07-13  8:36 forsyth
  2000-07-13 16:01 ` Greg Hudson
  2000-07-14  9:19 ` Kris Van Hees
  0 siblings, 2 replies; 26+ messages in thread
From: forsyth @ 2000-07-13  8:36 UTC (permalink / raw)
  To: 9fans

>>I sometimes think so too and yet...it works so very very well and
>>there is just so much software that uses it.  I don't think I've ever
>>seen a configure script fail in a released program. 

i have, frequently, on Unix systems, not Plan 9.
it just has to be one version on (and not differing in essentials)
that they haven't seen before.  the manufacturer tweaks an
include file or moves a library and they fall apart.  makes you wonder why they
bother to probe.  (made me wonder, anyway.)
when that happens, and this is the reason the scheme doesn't
work `very well' (except when it has essentially nothing to do),
you will have the penguin's own time working out what those scripts
are doing, and untangling some bizarrely structured makefiles.

>>(Just don't ask me to write the !@#% things! :)

they use a program to generate them based on some sort of description.
it's a similar idea to all those compilers years ago for the sendmail rewrite language:
don't fix the problem, just bulk it up.  i take comfort from the thought that
whoever writes these things might have decided to become surgeons instead of
programmers.



^ permalink raw reply	[flat|nested] 26+ messages in thread
* Re: [9fans] Silly porting fun
@ 2000-07-13  0:23 Russ Cox
  2000-07-13  0:33 ` Christopher Nielsen
  0 siblings, 1 reply; 26+ messages in thread
From: Russ Cox @ 2000-07-13  0:23 UTC (permalink / raw)
  To: 9fans

	The whole GNU configure script idea always seemed like a giant kluge to
	me; an artifact of having to live in a world of various flavours of UNIX.

You make it sound as though it's the only
thing to do when living in such a world.
There are ways to get portable code without
configure.

Russ



^ permalink raw reply	[flat|nested] 26+ messages in thread
* Re: [9fans] Silly porting fun
@ 2000-07-12 23:30 forsyth
  2000-07-12 23:46 ` Christopher Nielsen
  0 siblings, 1 reply; 26+ messages in thread
From: forsyth @ 2000-07-12 23:30 UTC (permalink / raw)
  To: 9fans

>>interested in a solution for it, since many widely-available programs
>>depend on such scripts.  A GNU "configure" script is a shell script

there is a more serious problem to many of the configure scripts
(in my experience).

having done all that probing, quite a few of them announce that
they think they know where things are but don't recognise your system anyhow.
it hasn't been named in a huge case statement.
they seemed really to be enumerating all the things they'd come across so far.
that's portability.

now i just edit the config.h to form config.h.plan9, do ape/make -n,
build a corresponding mkfile, and am done with it.
the configure doesn't usually configure properly for building several architectures
(big AND little endian) simultaneously in one directory.



^ permalink raw reply	[flat|nested] 26+ messages in thread
* [9fans] Silly porting fun
@ 2000-07-12 21:16 Randolph Fritz
  2000-07-12 21:44 ` Latchesar Ionkov
  2000-07-13  0:38 ` arisawa
  0 siblings, 2 replies; 26+ messages in thread
From: Randolph Fritz @ 2000-07-12 21:16 UTC (permalink / raw)
  To: 9fans

So...having cut and ground my teeth on some basics of Plan 9, and
being temporarily unable to download Kenji Arisawa's port of Python, I
decided to try building Python in the APE.  The GNU configure script
provided with Python wouldn't work.  (I am now downloading Arisawa's
port.)

Upon study, I found the source of the difficulty, and I would be
interested in a solution for it, since many widely-available programs
depend on such scripts.  A GNU "configure" script is a shell script
which tests the local system for various features.  It does this, in
part, by compiling many small test programs.  Often the point of the
test programs is a check for the presence of an include file or
symbol, and the main program is trivial.  And therein lies the
problem.

The typical minimal main program from a GNU configure script is:

  main() { return(0); }

The compiler, reasonably enough, decides that this routine never does
anything and is never called, and optimizes it out of existence!  The
linker then cannot find main(), and fails.  Is there an option switch
(preferably) or #pragma I can give to alter this behavior?  Failing
that, would adding "USED(main);" to the program do the trick?

-- 
Randolph Fritz
Eugene, Oregon, USA


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

end of thread, other threads:[~2000-07-17  9:11 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-13  0:31 [9fans] Silly porting fun Russ Cox
2000-07-13  5:21 ` Randolph Fritz
  -- strict thread matches above, loose matches on Subject: below --
2000-07-14 18:42 dhog
2000-07-14 14:53 Russ Cox
2000-07-14 14:04 bobf
2000-07-14  9:58 forsyth
2000-07-16 16:04 ` Lucio De Re
2000-07-14  4:18 pip
2000-07-13 23:58 rob pike
2000-07-14  9:18 ` Douglas A. Gwyn
2000-07-13 20:32 Russ Cox
2000-07-13  8:36 forsyth
2000-07-13 16:01 ` Greg Hudson
2000-07-14  9:15   ` peter huang
2000-07-14  9:19 ` Kris Van Hees
2000-07-14 14:56   ` Douglas A. Gwyn
2000-07-17  9:11   ` Christopher Browne
2000-07-13  0:23 Russ Cox
2000-07-13  0:33 ` Christopher Nielsen
2000-07-12 23:30 forsyth
2000-07-12 23:46 ` Christopher Nielsen
2000-07-13  5:19   ` Randolph Fritz
2000-07-12 21:16 Randolph Fritz
2000-07-12 21:44 ` Latchesar Ionkov
2000-07-13  9:59   ` Douglas A. Gwyn
2000-07-13  0:38 ` arisawa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).