caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* I'm having trouble compiling independent executables
@ 2004-12-29  1:50 Jeff Shaw
  2004-12-29 13:11 ` [Caml-list] " Peter Jolly
  2004-12-29 16:47 ` Igor Pechtchanski
  0 siblings, 2 replies; 3+ messages in thread
From: Jeff Shaw @ 2004-12-29  1:50 UTC (permalink / raw)
  To: caml-list

Hi there, this is my first post. I'm a college student who learned OCaml 
last semester and likes it a lot. I'm a lingusitics student, so my 
programming knowledge is limited, but I enjoyed learning OCaml a LOT more 
than C++. For fun this winter break I wrote an RPN calculator, and I would 
like to compile it to run independently of any OCaml installation. I have 
both Visual Studio .NET 2003 and cygwin installed. I've googled for the 
errors I'm getting and I can't seem to find anything helpful.

First of all, "ocamlc rpn.ml" always works. But it won't run on a machine 
that doesn't have ocaml installed. The two ways I've read of to make 
stand-alone executables are "ocamlc -custom" and "ocamlopt." I have gotten 
neither to work in all three ways of using OCaml in windows: MSVC, MinGW, 
and cygwin.

With the MSVC compiled version of OCaml:

ocamlc rpn.ml works
ocamlc -custom rpn.ml gives
'cl' is not recognized as an internal or external command,
operable program or batch file.
Error while building custom runtime system

This is partially rectified by putting cl.exe on my PATH, but then I get the 
following dialog box:
"cl.exe - Unable to locate component
This application has failed to start because mspdb71.dll was not found. 
Re-installing the application may fix this problem."

So then I put this DLL's directory on my PATH. Then I get:
"camlprima15001.c
LINK : fatal error LNK1181: cannot open input file 'advapi32.lib'
Error while building custom runtime system"

Searching for this file fails, and googling for it fails, so I don't know 
what to think. I even have the ocaml source code on my hard drive, so I know 
it's not in there.

ocamlopt rpn.ml gives
LINK : fatal error LNK1181: cannot open input file 'advapi32.lib'
Error during linking

I put this file on my PATH, but then I get the same error. I don't know how 
to fix it.

On to cygwin... I've tried recompiling and installing ocaml from source, but 
that doesn't fix the problems.

ocamlc -custom rpn.ml
"/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../i686-pc-cygwin/bin/ld 
cannot find -lcamlrun
collect2: ld returned 1 exit status
Error while building custom runtime system"

ocamlopt rpn.ml
"cannot find file libasmrun.a"

I put the file on my PATH ( PATH=";/usr/local/lib/ocaml ) but that doesn't 
fix it. I add the file to the command line, but that doesn't fix it either.

MinGW version of ocaml...

ocamlc -custom rpn.ml does not have access to gcc, which is in cygwin only, 
so it doesn't work.

ocamlopt rpn.ml
"'as' is not recognized as an internal or external command,
operable program or batch file.
Assembler error, input left in file 
C:\DOCUME~1\jeff\LOCALS~1\Temp\camlasm4af23d
.s"

BTW my source does not need any special modules; the program runs using only 
what's available in Pervasives.

Any help would be appreciated!
Jeff 


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

* Re: [Caml-list] I'm having trouble compiling independent executables
  2004-12-29  1:50 I'm having trouble compiling independent executables Jeff Shaw
@ 2004-12-29 13:11 ` Peter Jolly
  2004-12-29 16:47 ` Igor Pechtchanski
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Jolly @ 2004-12-29 13:11 UTC (permalink / raw)
  To: caml-list; +Cc: shawjef3

> LINK : fatal error LNK1181: cannot open input file 'advapi32.lib' 
> Error during linking
> 
> I put this file on my PATH, but then I get the same error. I don't 
> know how to fix it.

IIRC it needs to be in %LIB%, not %PATH%.

> On to cygwin... I've tried recompiling and installing ocaml from
> source, but that doesn't fix the problems.

Which problems?

And did you try simply installing the binary package available through
Cygwin's setup.exe, before you moved on to attempting a manual build? It
worked out of the box last time I tried it.

> MinGW version of ocaml...
> 
> ocamlc -custom rpn.ml does not have access to gcc, which is in cygwin
> only, so it doesn't work.

I've never used the MinGW version of OCaml, but at a guess, it might
possibly be expecting to find the MinGW version of gcc rather than the
Cygwin version.


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

* Re: [Caml-list] I'm having trouble compiling independent executables
  2004-12-29  1:50 I'm having trouble compiling independent executables Jeff Shaw
  2004-12-29 13:11 ` [Caml-list] " Peter Jolly
@ 2004-12-29 16:47 ` Igor Pechtchanski
  1 sibling, 0 replies; 3+ messages in thread
From: Igor Pechtchanski @ 2004-12-29 16:47 UTC (permalink / raw)
  To: Jeff Shaw; +Cc: caml-list

On Tue, 28 Dec 2004, Jeff Shaw wrote:

> Hi there, this is my first post. I'm a college student who learned OCaml last
> semester and likes it a lot. I'm a lingusitics student, so my programming
> knowledge is limited, but I enjoyed learning OCaml a LOT more than C++. For
> fun this winter break I wrote an RPN calculator, and I would like to compile
> it to run independently of any OCaml installation. I have both Visual Studio
> .NET 2003 and cygwin installed. I've googled for the errors I'm getting and I
> can't seem to find anything helpful.
>
> First of all, "ocamlc rpn.ml" always works. But it won't run on a machine that
> doesn't have ocaml installed. The two ways I've read of to make stand-alone
> executables are "ocamlc -custom" and "ocamlopt." I have gotten neither to work
> in all three ways of using OCaml in windows: MSVC, MinGW, and cygwin.
>
> [snip MSVC compile]
>
> On to cygwin... I've tried recompiling and installing ocaml from source, but
> that doesn't fix the problems.

Is there a reason why you don't use the official Cygwin "ocaml" package?
I had no problem running ocamlopt on Cygwin (in fact, the whole package
was built using ocamlopt).  FWIW, the Cygwin packages sources contain some
modifications to the build scripts that let them use Cygwin's binutils,
etc.  (BTW, which sources *did* you use?)

> ocamlc -custom rpn.ml
> "/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../i686-pc-cygwin/bin/ld
> cannot find -lcamlrun
> collect2: ld returned 1 exit status
> Error while building custom runtime system"
>
> ocamlopt rpn.ml
> "cannot find file libasmrun.a"

Looks like a library path problem.  Try adding appropriate -L flags...

> I put the file on my PATH ( PATH=";/usr/local/lib/ocaml ) but that
> doesn't fix it. I add the file to the command line, but that doesn't fix
> it either.

> MinGW version of ocaml...
>
> ocamlc -custom rpn.ml does not have access to gcc, which is in cygwin
> only, so it doesn't work.

You need to modify it to use "gcc -mno-cygwin", which build MinGW
executables (yes, even under Cygwin -- install the gcc-mingw package).
There's also a MinGW-only version of gcc/binutils -- see
<http://mingw.org/>.

> ocamlopt rpn.ml
> "'as' is not recognized as an internal or external command, operable program or batch file.
> Assembler error, input left in file C:\DOCUME~1\jeff\LOCALS~1\Temp\camlasm4af23d.s"

Same as above -- you need MinGW binutils.

> BTW my source does not need any special modules; the program runs using
> only what's available in Pervasives.

I'd first try removing your self-built OCaml and installing the Cygwin
"ocaml" package.  It should also pull in all the necessary Cygwin packages
(e.g., gcc, binutils).  If there are still problems with your build after
that, please report it as a bug to the main Cygwin list (<cygwin at cygwin
dot com>).

> Any help would be appreciated!
> Jeff

HTH,
Igor Pechtchanski, the Cygwin OCaml maintainer
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"The Sun will pass between the Earth and the Moon tonight for a total
Lunar eclipse..." -- WCBS Radio Newsbrief, Oct 27 2004, 12:01 pm EDT


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

end of thread, other threads:[~2004-12-29 16:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-29  1:50 I'm having trouble compiling independent executables Jeff Shaw
2004-12-29 13:11 ` [Caml-list] " Peter Jolly
2004-12-29 16:47 ` Igor Pechtchanski

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