9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] pcc question -- main() in .a libs
@ 2003-05-14 17:27 andrey mirtchovski
  2003-05-14 17:57 ` boyd, rounin
  2003-05-15  9:21 ` Douglas A. Gwyn
  0 siblings, 2 replies; 3+ messages in thread
From: andrey mirtchovski @ 2003-05-14 17:27 UTC (permalink / raw)
  To: 9fans

Hi,


I'm having the following problem while porting ocaml using ape/psh:

at one point of the build process (rather early, in fact) it builds a
library called "libcamlrun.a" which contains, among other things, the
definition of main(). this library is then compiled together with a list of
primitives to create the first binary in the bootstrap process -- ocamlrun.

the problem that I'm having is that main() appears to be stripped from the
library (it's contained in main.o), resulting in unsuccessfull compilation:

$ ar vu libcamlrun.a interp.o misc.o stacks.o fix_code.o startup.o main.o  freelist.o major_gc.o minor_gc.o memory.o alloc.o roots.o globroots.o  fail.o signals.o printexc.o backtrace.o  compare.o ints.o floats.o str.o array.o io.o extern.o intern.o  hash.o sys.o meta.o parsing.o gc_ctrl.o terminfo.o md5.o obj.o  lexing.o callback.o debugger.o weak.o compact.o finalise.o custom.o  dynlink.o unix.o
$ make
cc   -o ocamlrun  prims.o libcamlrun.a
_main: undefined: main in _main
cc: 8l: 8l 20157: error
*** Error code 1

Stop.
$

on the other hand including main.o works just fine:

$ make
cc   -o ocamlrun  prims.o libcamlrun.a main.o
$

ar p libcamlrun.a main.o shows 'main' there, fyi..


andrey




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

* Re: [9fans] pcc question -- main() in .a libs
  2003-05-14 17:27 [9fans] pcc question -- main() in .a libs andrey mirtchovski
@ 2003-05-14 17:57 ` boyd, rounin
  2003-05-15  9:21 ` Douglas A. Gwyn
  1 sibling, 0 replies; 3+ messages in thread
From: boyd, rounin @ 2003-05-14 17:57 UTC (permalink / raw)
  To: 9fans

library symbol reference loop.  go native, it's worth the investment.



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

* Re: [9fans] pcc question -- main() in .a libs
  2003-05-14 17:27 [9fans] pcc question -- main() in .a libs andrey mirtchovski
  2003-05-14 17:57 ` boyd, rounin
@ 2003-05-15  9:21 ` Douglas A. Gwyn
  1 sibling, 0 replies; 3+ messages in thread
From: Douglas A. Gwyn @ 2003-05-15  9:21 UTC (permalink / raw)
  To: 9fans

andrey mirtchovski wrote:
> cc   -o ocamlrun  prims.o libcamlrun.a
> _main: undefined: main in _main

I think the problem is that there is no reference to main
to pull the module from the library; probably the APE C
library (searched *after* libcamrun.a) contains the piece
of run-time startup code (_main) that calls main.


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

end of thread, other threads:[~2003-05-15  9:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-14 17:27 [9fans] pcc question -- main() in .a libs andrey mirtchovski
2003-05-14 17:57 ` boyd, rounin
2003-05-15  9:21 ` Douglas A. Gwyn

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).