caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: [Caml-list] ocamlc compiles hello world, ocamlopt not
       [not found]   ` <fa.vGYTX053VB/7kO+WVlnBXs6LyWM@ifi.uio.no>
@ 2013-01-16  9:36     ` r0ller
  2013-01-16  9:53       ` AW: " Gerd Stolpmann
       [not found]     ` <fa.3ZA77VqUCTh0CDJf/dKc9fxM234@ifi.uio.no>
       [not found]     ` <fa.AgEvtE0xHcqZGBKj0Yv0NqpqfDI@ifi.uio.no>
  2 siblings, 1 reply; 7+ messages in thread
From: r0ller @ 2013-01-16  9:36 UTC (permalink / raw)
  To: fa.caml; +Cc: Francois Berenger, caml-list

Hi Gerd,

If that's really the case (still I'm trying to find the post mentioned by Francois), then my question is if there's any doc about how to do it? I'm asking because I'm more a guy with C/C++ knowledge. Actually, the library I'd like to link my C/C++ project with originally has a C lib on platforms that have ocamlopt but I don't mind if I'm interfacing with a byte code lib if it's also possible.

Thanks&regards,
r0ller

On Wednesday, January 16, 2013 10:01:20 AM UTC+1, Gerd Stolpmann wrote:
> Am 16.01.2013 09:56:55 schrieb(en) Francois Berenger:
> 
> > On 01/16/2013 05:02 PM, r0ller@.hu wrote:
> 
> >> Hi All,
> 
> >> 
> 
> >> By the way, is there any doc available about porting ocaml (google  
> 
> >> didn't find any) or any hint on how to move forward? I'd really like  
> 
> >> to have the native compiler on minix too.
> 
> > 
> 
> > I think in the past it was possible to generate C code from OCaml  
> 
> > code.
> 
> 
> 
> There is no real C backend (and has never been). The only thing you can  
> 
> do is to embed bytecode in a C-friendly way (what -output-obj does).  
> 
> But it is still bytecode.
> 
> 
> 
> Gerd
> 
> 
> 
> > As I guess Minix have a C compiler, that would be a way out for you.
> 
> > 
> 
> > I can't find back, but I remember Richard W.M. Jones from Red Hat  
> 
> > posted about it on caml-list and keeps it somewhere.
> 
> > 
> 
> >> Thanks&regards,
> 
> >> r0ller


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

* AW: [Caml-list] ocamlc compiles hello world, ocamlopt not
  2013-01-16  9:36     ` [Caml-list] ocamlc compiles hello world, ocamlopt not r0ller
@ 2013-01-16  9:53       ` Gerd Stolpmann
  0 siblings, 0 replies; 7+ messages in thread
From: Gerd Stolpmann @ 2013-01-16  9:53 UTC (permalink / raw)
  To: r0ller; +Cc: Francois Berenger, caml-list

Am 16.01.2013 10:36:41 schrieb(en) r0ller@freemail.hu:
> Hi Gerd,
> 
> If that's really the case (still I'm trying to find the post  
> mentioned by Francois), then my question is if there's any doc about  
> how to do it? I'm asking because I'm more a guy with C/C++ knowledge.  
> Actually, the library I'd like to link my C/C++ project with  
> originally has a C lib on platforms that have ocamlopt but I don't  
> mind if I'm interfacing with a byte code lib if it's also possible.

It's described in the manual, section 19.7.5:

http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual033.html

You may also look at my text

http://www.camlcity.org/knowledge/kb_002_shared_library.html

which is written for ocamlopt, but the same should also apply to ocamlc  
provided you use -lcamlrun instead of -lasmrun.

Gerd

> 
> Thanks&regards,
> r0ller
> 
> On Wednesday, January 16, 2013 10:01:20 AM UTC+1, Gerd Stolpmann  
> wrote:
> > Am 16.01.2013 09:56:55 schrieb(en) Francois Berenger:
> >
> > > On 01/16/2013 05:02 PM, r0ller@.hu wrote:
> >
> > >> Hi All,
> >
> > >>
> >
> > >> By the way, is there any doc available about porting ocaml  
> (google
> >
> > >> didn't find any) or any hint on how to move forward? I'd really  
> like
> >
> > >> to have the native compiler on minix too.
> >
> > >
> >
> > > I think in the past it was possible to generate C code from OCaml
> >
> > > code.
> >
> >
> >
> > There is no real C backend (and has never been). The only thing you  
> can
> >
> > do is to embed bytecode in a C-friendly way (what -output-obj does).
> >
> > But it is still bytecode.
> >
> >
> >
> > Gerd
> >
> >
> >
> > > As I guess Minix have a C compiler, that would be a way out for  
> you.
> >
> > >
> >
> > > I can't find back, but I remember Richard W.M. Jones from Red Hat
> >
> > > posted about it on caml-list and keeps it somewhere.
> >
> > >
> >
> > >> Thanks&regards,
> >
> > >> r0ller
> 
> 
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
> 



-- 
------------------------------------------------------------
Gerd Stolpmann, Darmstadt, Germany    gerd@gerd-stolpmann.de
Creator of GODI and camlcity.org.
Contact details:        http://www.camlcity.org/contact.html
Company homepage:       http://www.gerd-stolpmann.de
------------------------------------------------------------

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

* Re: [Caml-list] ocamlc compiles hello world, ocamlopt not
       [not found]     ` <fa.3ZA77VqUCTh0CDJf/dKc9fxM234@ifi.uio.no>
@ 2013-01-16 10:16       ` r0ller
  0 siblings, 0 replies; 7+ messages in thread
From: r0ller @ 2013-01-16 10:16 UTC (permalink / raw)
  To: fa.caml; +Cc: Gerd Stolpmann, Francois Berenger, caml-list

Hi Basile,

Thanks! I'll definitely have a look at it even though compiling a whole ocaml project will be challenging:) Yet another really bold question: I do not know, how the original ocamlopt is built but if it's also built from bytecode, can ocamlcc be used to build ocamlopt?

Thanks&regards,
r0ller

On Wednesday, January 16, 2013 10:48:36 AM UTC+1, Basile Starynkevitch wrote:
> On Wed, Jan 16, 2013 at 10:01:06AM +0100, Gerd Stolpmann wrote:
> 
> > Am 16.01.2013 09:56:55 schrieb(en) Francois Berenger:
> 
> > >On 01/16/2013 05:02 PM, r0ller@.hu wrote:
> 
> > >>Hi All,
> 
> > >>
> 
> > >>By the way, is there any doc available about porting ocaml
> 
> > >>(google didn't find any) or any hint on how to move forward? I'd
> 
> > >>really like to have the native compiler on minix too.
> 
> > >
> 
> > >I think in the past it was possible to generate C code from OCaml
> 
> > >code.
> 
> > 
> 
> > There is no real C backend (and has never been). The only thing you
> 
> > can do is to embed bytecode in a C-friendly way (what -output-obj
> 
> > does). But it is still bytecode.
> 
> 
> 
> 
> 
> Benoit Vaugon & Michel Mauny worked recently on OcamlCC
> 
> (a translator from Ocaml bytecode to C)
> 
> http://oud.ocaml.org/2012/abstracts/oud2012-final10.pdf
> 
> https://github.com/ocaml-bytes/ocamlcc
> 
> 
> 
> Cheers.
> 
> -- 
> 
> Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
> 
> email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
> 
> 8, rue de la Faiencerie, 92340 Bourg La Reine, France
> 
> *** opinions {are only mines, sont seulement les miennes} ***
> 
> 
> 
> -- 
> 
> Caml-list mailing list.  Subscription management and archives:
> 
> https://sympa.inria.fr/sympa/arc/caml-list
> 
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> 
> Bug reports: http://caml.inria.fr/bin/caml-bugs


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

* Re: AW: [Caml-list] ocamlc compiles hello world, ocamlopt not
       [not found]       ` <fa.U9QIrhkTeSswG97/yP/PR0sEGRA@ifi.uio.no>
@ 2013-01-17 13:06         ` r0ller
  0 siblings, 0 replies; 7+ messages in thread
From: r0ller @ 2013-01-17 13:06 UTC (permalink / raw)
  To: fa.caml; +Cc: Francois Berenger, caml-list

Hi All,

Well, to get back to the original track, my goal is not to replace ocamlopt at all. It just came as a possible workaround for me as ocamlopt though compiles on minix3 but you can't use it for anything. (Which was anyway strange for me as I thought ocamlopt itself was compiled from bytecode to C but it may not be the case.) So the suggestions I got finally went into a direction from porting ocaml correctly on minix3 to finding another possibility instead of ocamlopt. I'm still in the process of giving a try to those suggestions.

Thanks&regards,
r0ller

On Thursday, January 17, 2013 8:53:37 AM UTC+1, Alain Frisch wrote:
> On 1/17/2013 2:10 AM, Francois Berenger wrote:
> 
> > Was this C code generation not possible even with Caml code
> 
> > back in the era of Caml?
> 
> 
> 
> There has been work on compiling Caml to C back in the early 90s.  Look 
> 
> for Camlot (by Régis Cridlig) and CeML (by Emmanuel Chailloux).
> 
> 
> 
> Alain
> 
> 
> 
> -- 
> 
> Caml-list mailing list.  Subscription management and archives:
> 
> https://sympa.inria.fr/sympa/arc/caml-list
> 
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> 
> Bug reports: http://caml.inria.fr/bin/caml-bugs


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

* Re: AW: [Caml-list] ocamlc compiles hello world, ocamlopt not
  2013-01-17  1:10     ` Francois Berenger
@ 2013-01-17  7:53       ` Alain Frisch
  0 siblings, 0 replies; 7+ messages in thread
From: Alain Frisch @ 2013-01-17  7:53 UTC (permalink / raw)
  To: Francois Berenger; +Cc: caml-list

On 1/17/2013 2:10 AM, Francois Berenger wrote:
> Was this C code generation not possible even with Caml code
> back in the era of Caml?

There has been work on compiling Caml to C back in the early 90s.  Look 
for Camlot (by Régis Cridlig) and CeML (by Emmanuel Chailloux).

Alain

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

* Re: AW: [Caml-list] ocamlc compiles hello world, ocamlopt not
  2013-01-16  9:01   ` AW: " Gerd Stolpmann
@ 2013-01-17  1:10     ` Francois Berenger
  2013-01-17  7:53       ` Alain Frisch
  0 siblings, 1 reply; 7+ messages in thread
From: Francois Berenger @ 2013-01-17  1:10 UTC (permalink / raw)
  To: caml-list

On 01/16/2013 06:01 PM, Gerd Stolpmann wrote:
> Am 16.01.2013 09:56:55 schrieb(en) Francois Berenger:
>> On 01/16/2013 05:02 PM, r0ller@freemail.hu wrote:
>>> Hi All,
>>>
>>> By the way, is there any doc available about porting ocaml (google
>>> didn't find any) or any hint on how to move forward? I'd really like
>>> to have the native compiler on minix too.
>>
>> I think in the past it was possible to generate C code from OCaml code.
>
> There is no real C backend (and has never been). The only thing you can
> do is to embed bytecode in a C-friendly way (what -output-obj does). But
> it is still bytecode.

Sorry for the mistake.

I see in the rest of this thread that some current work on bytecode
to C generation is mentioned.
I may have mixed several things together.

Was this C code generation not possible even with Caml code
back in the era of Caml?

Regards,
F.

> Gerd
>
>> As I guess Minix have a C compiler, that would be a way out for you.
>>
>> I can't find back, but I remember Richard W.M. Jones from Red Hat
>> posted about it on caml-list and keeps it somewhere.
>>
>>> Thanks&regards,
>>> r0ller
>>>
>>> On Friday, January 11, 2013 5:23:54 PM UTC+1, r0l...@freemail.hu wrote:
>>>> Hi again,
>>>>
>>>>
>>>>
>>>> I forgot to mention that this result I got after gmake opt.
>>>>
>>>>
>>>>
>>>> Regards,
>>>>
>>>> r0ller
>>>>
>>>>
>>>>
>>>> On Friday, January 11, 2013 5:13:56 PM UTC+1, r0l...@freemail.hu wrote:
>>>>
>>>>> Hi Xavier,
>>>>
>>>>>
>>>>
>>>>>
>>>>
>>>>>
>>>>
>>>>> Thanks for the hint! I gave it a try and also with SYSTEM=bsd_elf.
>>>>> Please, find below the result of the latter (it's the same for
>>>>> linux_elf anyway). I also tried another suggestion from Olivier
>>>>> Andrieu by introducing SYS_minix in asmrun/i386.S but ended up in
>>>>> the same result:( Do you happen to know how to proceed now?
>>>>
>>>>>
>>>>
>>>>>
>>>>
>>>>>
>>>>
>>>>> gmake runtimeopt
>>>>
>>>>>
>>>>
>>>>> gmake[1]: Entering directory `/home/r0ller/ocaml-4.00.1'
>>>>
>>>>>
>>>>
>>>>> cd asmrun; gmake all
>>>>
>>>>>
>>>>
>>>>> gmake[2]: Entering directory `/home/r0ller/ocaml-4.00.1/asmrun'
>>>>
>>>>>
>>>>
>>>>> DSYS_bsd_elf -o i386.o i386.S || \
>>>>
>>>>>
>>>>
>>>>> { echo "If your assembler produced syntax errors, it is probably
>>>>> unhappy with the"; echo "preprocessor. Check your assembler, or try
>>>>> producing i386.o by hand."; exit 2; }
>>>>
>>>>>
>>>>
>>>>> DSYS_bsd_elf: not found
>>>>
>>>>>
>>>>
>>>>> If your assembler produced syntax errors, it is probably unhappy
>>>>> with the
>>>>
>>>>>
>>>>
>>>>> preprocessor. Check your assembler, or try producing i386.o by hand.
>>>>
>>>>>
>>>>
>>>>> gmake[2]: [i386.o] Error 2 (ignored)
>>>>
>>>>>
>>>>
>>>>> rm -f libasmrun.a
>>>>
>>>>>
>>>>
>>>>> ar rc libasmrun.a startup.o main.o fail.o roots.o globroots.o
>>>>> signals.o signals_asm.o misc.o freelist.o major_gc.o minor_gc.o
>>>>> memory.o alloc.o compare.o ints.o floats.o str.o array.o io.o
>>>>> extern.o intern.o hash.o sys.o parsing.o gc_ctrl.o terminfo.o md5.o
>>>>> obj.o lexing.o printexc.o callback.o weak.o compact.o finalise.o
>>>>> custom.o unix.o backtrace.o natdynlink.o debugger.o meta.o
>>>>> dynlink.o i386.o
>>>>
>>>>>
>>>>
>>>>> ar: i386.o: no such file or directory
>>>>
>>>>>
>>>>
>>>>> gmake[2]: *** [libasmrun.a] Error 1
>>>>
>>>>>
>>>>
>>>>> gmake[2]: Leaving directory `/home/r0ller/ocaml-4.00.1/asmrun'
>>>>
>>>>>
>>>>
>>>>> gmake[1]: *** [makeruntimeopt] Error 2
>>>>
>>>>>
>>>>
>>>>> gmake[1]: Leaving directory `/home/r0ller/ocaml-4.00.1'
>>>>
>>>>>
>>>>
>>>>> gmake: *** [opt] Error 2
>>>>
>>>>>
>>>>
>>>>>
>>>>
>>>>>
>>>>
>>>>> Thanks & regards,
>>>>
>>>>>
>>>>
>>>>> r0ller
>>>
>>>
>>
>>
>> --
>> Caml-list mailing list.  Subscription management and archives:
>> https://sympa.inria.fr/sympa/arc/caml-list
>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>> Bug reports: http://caml.inria.fr/bin/caml-bugs
>>
>
>


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

* AW: [Caml-list] ocamlc compiles hello world, ocamlopt not
  2013-01-16  8:56 ` Francois Berenger
@ 2013-01-16  9:01   ` Gerd Stolpmann
  2013-01-17  1:10     ` Francois Berenger
  0 siblings, 1 reply; 7+ messages in thread
From: Gerd Stolpmann @ 2013-01-16  9:01 UTC (permalink / raw)
  To: Francois Berenger; +Cc: caml-list

Am 16.01.2013 09:56:55 schrieb(en) Francois Berenger:
> On 01/16/2013 05:02 PM, r0ller@freemail.hu wrote:
>> Hi All,
>> 
>> By the way, is there any doc available about porting ocaml (google  
>> didn't find any) or any hint on how to move forward? I'd really like  
>> to have the native compiler on minix too.
> 
> I think in the past it was possible to generate C code from OCaml  
> code.

There is no real C backend (and has never been). The only thing you can  
do is to embed bytecode in a C-friendly way (what -output-obj does).  
But it is still bytecode.

Gerd

> As I guess Minix have a C compiler, that would be a way out for you.
> 
> I can't find back, but I remember Richard W.M. Jones from Red Hat  
> posted about it on caml-list and keeps it somewhere.
> 
>> Thanks&regards,
>> r0ller
>> 
>> On Friday, January 11, 2013 5:23:54 PM UTC+1, r0l...@freemail.hu  
>> wrote:
>>> Hi again,
>>> 
>>> 
>>> 
>>> I forgot to mention that this result I got after gmake opt.
>>> 
>>> 
>>> 
>>> Regards,
>>> 
>>> r0ller
>>> 
>>> 
>>> 
>>> On Friday, January 11, 2013 5:13:56 PM UTC+1, r0l...@freemail.hu  
>>> wrote:
>>> 
>>>> Hi Xavier,
>>> 
>>>> 
>>> 
>>>> 
>>> 
>>>> 
>>> 
>>>> Thanks for the hint! I gave it a try and also with SYSTEM=bsd_elf.  
>>>> Please, find below the result of the latter (it's the same for  
>>>> linux_elf anyway). I also tried another suggestion from Olivier  
>>>> Andrieu by introducing SYS_minix in asmrun/i386.S but ended up in  
>>>> the same result:( Do you happen to know how to proceed now?
>>> 
>>>> 
>>> 
>>>> 
>>> 
>>>> 
>>> 
>>>> gmake runtimeopt
>>> 
>>>> 
>>> 
>>>> gmake[1]: Entering directory `/home/r0ller/ocaml-4.00.1'
>>> 
>>>> 
>>> 
>>>> cd asmrun; gmake all
>>> 
>>>> 
>>> 
>>>> gmake[2]: Entering directory `/home/r0ller/ocaml-4.00.1/asmrun'
>>> 
>>>> 
>>> 
>>>> DSYS_bsd_elf -o i386.o i386.S || \
>>> 
>>>> 
>>> 
>>>> { echo "If your assembler produced syntax errors, it is probably  
>>>> unhappy with the"; echo "preprocessor. Check your assembler, or  
>>>> try producing i386.o by hand."; exit 2; }
>>> 
>>>> 
>>> 
>>>> DSYS_bsd_elf: not found
>>> 
>>>> 
>>> 
>>>> If your assembler produced syntax errors, it is probably unhappy  
>>>> with the
>>> 
>>>> 
>>> 
>>>> preprocessor. Check your assembler, or try producing i386.o by  
>>>> hand.
>>> 
>>>> 
>>> 
>>>> gmake[2]: [i386.o] Error 2 (ignored)
>>> 
>>>> 
>>> 
>>>> rm -f libasmrun.a
>>> 
>>>> 
>>> 
>>>> ar rc libasmrun.a startup.o main.o fail.o roots.o globroots.o  
>>>> signals.o signals_asm.o misc.o freelist.o major_gc.o minor_gc.o  
>>>> memory.o alloc.o compare.o ints.o floats.o str.o array.o io.o  
>>>> extern.o intern.o hash.o sys.o parsing.o gc_ctrl.o terminfo.o  
>>>> md5.o obj.o lexing.o printexc.o callback.o weak.o compact.o  
>>>> finalise.o custom.o unix.o backtrace.o natdynlink.o debugger.o  
>>>> meta.o dynlink.o i386.o
>>> 
>>>> 
>>> 
>>>> ar: i386.o: no such file or directory
>>> 
>>>> 
>>> 
>>>> gmake[2]: *** [libasmrun.a] Error 1
>>> 
>>>> 
>>> 
>>>> gmake[2]: Leaving directory `/home/r0ller/ocaml-4.00.1/asmrun'
>>> 
>>>> 
>>> 
>>>> gmake[1]: *** [makeruntimeopt] Error 2
>>> 
>>>> 
>>> 
>>>> gmake[1]: Leaving directory `/home/r0ller/ocaml-4.00.1'
>>> 
>>>> 
>>> 
>>>> gmake: *** [opt] Error 2
>>> 
>>>> 
>>> 
>>>> 
>>> 
>>>> 
>>> 
>>>> Thanks & regards,
>>> 
>>>> 
>>> 
>>>> r0ller
>> 
>> 
> 
> 
>-- 
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
> 


-- 
------------------------------------------------------------
Gerd Stolpmann, Darmstadt, Germany    gerd@gerd-stolpmann.de
Creator of GODI and camlcity.org.
Contact details:        http://www.camlcity.org/contact.html
Company homepage:       http://www.gerd-stolpmann.de
------------------------------------------------------------

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

end of thread, other threads:[~2013-01-17 13:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <fa.yuD604fWUWzMhQKQ2PVUY9+PSRs@ifi.uio.no>
     [not found] ` <fa.SiWjqBgSRaJHHtRDr1LQlRGec/I@ifi.uio.no>
     [not found]   ` <fa.vGYTX053VB/7kO+WVlnBXs6LyWM@ifi.uio.no>
2013-01-16  9:36     ` [Caml-list] ocamlc compiles hello world, ocamlopt not r0ller
2013-01-16  9:53       ` AW: " Gerd Stolpmann
     [not found]     ` <fa.3ZA77VqUCTh0CDJf/dKc9fxM234@ifi.uio.no>
2013-01-16 10:16       ` r0ller
     [not found]     ` <fa.AgEvtE0xHcqZGBKj0Yv0NqpqfDI@ifi.uio.no>
     [not found]       ` <fa.U9QIrhkTeSswG97/yP/PR0sEGRA@ifi.uio.no>
2013-01-17 13:06         ` AW: " r0ller
2013-01-16  8:02 r0ller
2013-01-16  8:56 ` Francois Berenger
2013-01-16  9:01   ` AW: " Gerd Stolpmann
2013-01-17  1:10     ` Francois Berenger
2013-01-17  7:53       ` Alain Frisch

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