OCaml Install Error

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

OCaml Install Error

Bill Wendling
Hi,

I get this error duing a "make install":

llvm[3]: Installing Debug /usr/local/lib/ocaml/libllvm.a
install: /usr/local/lib/ocaml/libllvm.a: Permission denied
make[3]: *** [install-a] Error 71
make[2]: *** [install] Error 1
make[1]: *** [ocaml/.makeinstall] Error 2
make: *** [install] Error 1

-bw
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: OCaml Install Error

Gordon Henriksen-3
On Oct 2, 2007, at 00:17, Bill Wendling wrote:

> I get this error duing a "make install":
>
> llvm[3]: Installing Debug /usr/local/lib/ocaml/libllvm.a
> install: /usr/local/lib/ocaml/libllvm.a: Permission denied
> make[3]: *** [install-a] Error 71
> make[2]: *** [install] Error 1
> make[1]: *** [ocaml/.makeinstall] Error 2
> make: *** [install] Error 1

Fair enough. The problem is that the bindings are installed in the  
ocaml stdlib, regardless of --prefix. At the very least, there should  
be a configure switch for this. Perhaps better, the default should go  
into the stdlib only if the stdlib is under --prefix; otherwise using  
$libdir/ocaml. Alternatively, perhaps they should be installed only  
with a special make target (Subversion does this).

I'll muck around with the configurey goop to see what I can come up  
with. In the meantime, please use a workaround:

sudo make install
-or-
blank out the OCAMLC := line in Makefile.config.in

— Gordon


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: OCaml Install Error

Gordon Henriksen-3
On 2007-10-02, at 03:19, Gordon Henriksen wrote:

On Oct 2, 2007, at 00:17, Bill Wendling wrote:

I get this error duing a "make install":

llvm[3]: Installing Debug /usr/local/lib/ocaml/libllvm.a
install: /usr/local/lib/ocaml/libllvm.a: Permission denied
make[3]: *** [install-a] Error 71
make[2]: *** [install] Error 1
make[1]: *** [ocaml/.makeinstall] Error 2
make: *** [install] Error 1

Fair enough. The problem is that the bindings are installed in the  
ocaml stdlib, regardless of --prefix. At the very least, there should  
be a configure switch for this. Perhaps better, the default should go  
into the stdlib only if the stdlib is under --prefix; otherwise using  
$libdir/ocaml. Alternatively, perhaps they should be installed only  
with a special make target (Subversion does this).

I'll muck around with the configurey goop to see what I can come up  
with. In the meantime, please use a workaround:

sudo make install
-or-
blank out the OCAMLC := line in Makefile.config.in

You can now configure with --disable-bindings rather than editing out OCAMLC. I'll fix the directory logic soon.

— Gordon


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: OCaml Install Error

shjk
Hi,

where can I read more about this? I assume (hope) the lib provides some kind of OCaml bindings? I could not find any trace of it in the 2.1 release source so I guess it's currently SVN only?

greetings,
Jan

On 2. Okt 2007, at 12:22, Gordon Henriksen wrote:

On 2007-10-02, at 03:19, Gordon Henriksen wrote:

On Oct 2, 2007, at 00:17, Bill Wendling wrote:

I get this error duing a "make install":

llvm[3]: Installing Debug /usr/local/lib/ocaml/libllvm.a
install: /usr/local/lib/ocaml/libllvm.a: Permission denied
make[3]: *** [install-a] Error 71
make[2]: *** [install] Error 1
make[1]: *** [ocaml/.makeinstall] Error 2
make: *** [install] Error 1

Fair enough. The problem is that the bindings are installed in the  
ocaml stdlib, regardless of --prefix. At the very least, there should  
be a configure switch for this. Perhaps better, the default should go  
into the stdlib only if the stdlib is under --prefix; otherwise using  
$libdir/ocaml. Alternatively, perhaps they should be installed only  
with a special make target (Subversion does this).

I'll muck around with the configurey goop to see what I can come up  
with. In the meantime, please use a workaround:

sudo make install
-or-
blank out the OCAMLC := line in Makefile.config.in

You can now configure with --disable-bindings rather than editing out OCAMLC. I'll fix the directory logic soon.

— Gordon

_______________________________________________
LLVM Developers mailing list


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: OCaml Install Error

Gordon Henriksen-3
On 2007-10-02, at 10:46, Jan Rehders wrote:

> where can I read more about this?

There's not much in the way of documentation aside from the interface  
and the test. Only the vmcore and bitwriter libraries are bound. The  
bindings are not quite sufficient to write a serious front-end, but  
they're close enough to get started.

http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/ 
llvm.mli?view=markup
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/Ocaml/ 
vmcore.ml?view=markup

http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/ 
bitwriter/llvm_bitwriter.mli?view=markup
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/Ocaml/ 
bitwriter.ml?view=markup

> I assume (hope) the lib provides some kind of OCaml bindings?

Yes.

> I could not find any trace of it in the 2.1 release source so I  
> guess it's currently SVN only?

That's correct.

— Gordon


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: OCaml Install Error

Gordon Henriksen-3
In reply to this post by Bill Wendling
On 2007-10-02, at 00:17, Bill Wendling wrote:

I get this error duing a "make install":

llvm[3]: Installing Debug /usr/local/lib/ocaml/libllvm.a
install: /usr/local/lib/ocaml/libllvm.a: Permission denied
make[3]: *** [install-a] Error 71
make[2]: *** [install] Error 1
make[1]: *** [ocaml/.makeinstall] Error 2
make: *** [install] Error 1

Bill,

All done. configure will now install the ocaml bindings under your prefix. (The ocaml stdlib is only used if it is underneath the prefix.) --with-ocaml-libdir can be used to override configure.

As previously mentioned, you can also --disable-bindings to turn them off entirely.

— Gordon


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: OCaml Install Error

Gordon Henriksen-3
In reply to this post by shjk
On 2007-10-02, at 10:46, Jan Rehders wrote:

where can I read more about this? I assume (hope) the lib provides some kind of OCaml bindings? I could not find any trace of it in the 2.1 release source so I guess it's currently SVN only?

Jan,

Here's a trivial example.

$ cat metahelloworld.ml
(* metahelloworld.ml *)

open Llvm
open Llvm_bitwriter

let _ =
  let filename = Sys.argv.(1) in
  let m = create_module filename in
  
  (* @greeting = global [14 x i8] c"Hello, world!\00" *)
  let greeting = define_global "greeting" (make_string_constant
                                             "Hello, world!" true) m in
  
  (* declare i32 @puts(i8*) *)
  let puts = declare_function "puts" (make_function_type i32_type [|
                                        make_pointer_type i8_type |] false) m in
  
  (* define i32 @main() {
     entry:               *)
  let main = define_function "main" (make_function_type
                                       i32_type [| |] false) m in
  let at_entry = builder_at_end (entry_block main) in
  
  (* %tmp = getelementptr [14 x i8]* @greeting, i32 0, i32 0 *)
  let zero = make_int_constant i32_type 0 false in
  let str = build_gep greeting [| zero; zero |] "tmp" at_entry in

  (* call i32 @puts( i8* %tmp ) *)
  ignore (build_call puts [| str |] "" at_entry);
  
  (* ret void *)
  ignore (build_ret (make_null i32_type) at_entry);
  
  (* write the module to a file *)
  if not (write_bitcode_file m filename) then exit 1;
  dispose_module m

$ ocamlopt -cc g++ llvm.cmxa llvm_bitwriter.cmxa -o metahelloworld metahelloworld.ml
$ ./metahelloworld helloworld.bc
$ llvm-dis < helloworld.bc
; ModuleID = '<stdin>'
@greeting = global [14 x i8] c"Hello, world!\00"                ; <[14 x i8]*> [#uses=1]

declare i32 @puts(i8*)

define i32 @main() {
entry:
        %tmp = getelementptr [14 x i8]* @greeting, i32 0, i32 0    ; <i8*> [#uses=1]
        call i32 @puts( i8* %tmp )              ; <i32>:0 [#uses=0]
        ret i32 0
}
$ llc -o helloworld.s helloworld.bc
$ gcc -o helloworld helloworld.s
$ ./helloworld 
Hello, world!

— Gordon


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: OCaml Install Error

Bill Wendling
In reply to this post by Gordon Henriksen-3
On 10/2/07, Gordon Henriksen <[hidden email]> wrote:

>
>
> Bill,
>
> All done. configure will now install the ocaml bindings under your prefix.
> (The ocaml stdlib is only used if it is underneath the prefix.)
> --with-ocaml-libdir can be used to override configure.
>
> As previously mentioned, you can also --disable-bindings to turn them off
> entirely.
>
Sounds good. I'll test it tonight.

Thanks!
-bw
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: OCaml Install Error

Bill Wendling
In reply to this post by Gordon Henriksen-3
On Oct 2, 2007, at 3:22 AM, Gordon Henriksen wrote:

On 2007-10-02, at 03:19, Gordon Henriksen wrote:

On Oct 2, 2007, at 00:17, Bill Wendling wrote:

Fair enough. The problem is that the bindings are installed in the  
ocaml stdlib, regardless of --prefix. At the very least, there should  
be a configure switch for this. Perhaps better, the default should go  
into the stdlib only if the stdlib is under --prefix; otherwise using  
$libdir/ocaml. Alternatively, perhaps they should be installed only  
with a special make target (Subversion does this).

I'll muck around with the configurey goop to see what I can come up  
with. In the meantime, please use a workaround:

sudo make install
-or-
blank out the OCAMLC := line in Makefile.config.in

You can now configure with --disable-bindings rather than editing out OCAMLC. I'll fix the directory logic soon.

Is --disable-bindings the default or are they on? I would think that turning them off by default is the way to go, but I'm not 100% committed to that opinion. :)

-bw


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: OCaml Install Error

shjk
In reply to this post by Gordon Henriksen-3
Hi,

this looks very promising. Do you have any plans to add bindings for the use of an ExecutionEngine, especially recompileAndRelinkFunction? I've build an interactive toplevel implemented in OCaml and I have to pull of some stunts to be able to change the definition of a function. (emit a .ll file containing the code, looking up the function and calling removeBody, then reading the .ll file back in using ParseAssemblyString). I noticed that functions are represented as an llvalue which makes turning it into a Function* unsafe if I'm correct?

greetings, Jan

On 2. Okt 2007, at 19:51, Gordon Henriksen wrote:

On 2007-10-02, at 10:46, Jan Rehders wrote:

where can I read more about this? I assume (hope) the lib provides some kind of OCaml bindings? I could not find any trace of it in the 2.1 release source so I guess it's currently SVN only?

Jan,

Here's a trivial example.

$ cat metahelloworld.ml
(* metahelloworld.ml *)

open Llvm
open Llvm_bitwriter

let _ =
  let filename = Sys.argv.(1) in
  let m = create_module filename in
  
  (* @greeting = global [14 x i8] c"Hello, world!\00" *)
  let greeting = define_global "greeting" (make_string_constant
                                             "Hello, world!" true) m in
  
  (* declare i32 @puts(i8*) *)
  let puts = declare_function "puts" (make_function_type i32_type [|
                                        make_pointer_type i8_type |] false) m in
  
  (* define i32 @main() {
     entry:               *)
  let main = define_function "main" (make_function_type
                                       i32_type [| |] false) m in
  let at_entry = builder_at_end (entry_block main) in
  
  (* %tmp = getelementptr [14 x i8]* @greeting, i32 0, i32 0 *)
  let zero = make_int_constant i32_type 0 false in
  let str = build_gep greeting [| zero; zero |] "tmp" at_entry in

  (* call i32 @puts( i8* %tmp ) *)
  ignore (build_call puts [| str |] "" at_entry);
  
  (* ret void *)
  ignore (build_ret (make_null i32_type) at_entry);
  
  (* write the module to a file *)
  if not (write_bitcode_file m filename) then exit 1;
  dispose_module m

$ ocamlopt -cc g++ llvm.cmxa llvm_bitwriter.cmxa -o metahelloworld metahelloworld.ml
$ ./metahelloworld helloworld.bc
$ llvm-dis < helloworld.bc
; ModuleID = '<stdin>'
@greeting = global [14 x i8] c"Hello, world!\00"                ; <[14 x i8]*> [#uses=1]

declare i32 @puts(i8*)

define i32 @main() {
entry:
        %tmp = getelementptr [14 x i8]* @greeting, i32 0, i32 0    ; <i8*> [#uses=1]
        call i32 @puts( i8* %tmp )              ; <i32>:0 [#uses=0]
        ret i32 0
}
$ llc -o helloworld.s helloworld.bc
$ gcc -o helloworld helloworld.s
$ ./helloworld 
Hello, world!

— Gordon


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Ocaml bindings (and ExecutionEngine)

Gordon Henriksen-3
On Oct 19, 2007, at 11:51, Jan Rehders wrote:

this looks very promising. Do you have any plans to add bindings for the use of an ExecutionEngine, especially recompileAndRelinkFunction?

I'd considered it on the basis that others may find it useful, but I have no immediate need for it.

Patches are welcome. Binding a method is trivial:

And even binding a new library is straightforward:

1. Add C bindings for the desired functionality. (Strictly speaking, this is optional.)

2. Copy up a bindings project.
3. And add tests for it.

I've build an interactive toplevel implemented in OCaml and I have to pull of some stunts to be able to change the definition of a function. (emit a .ll file containing the code, looking up the function and calling removeBody, then reading the .ll file back in using ParseAssemblyString). I noticed that functions are represented as an llvalue which makes turning it into a Function* unsafe if I'm correct?

Yes, llvalues are very weakly typed. If assertions are enabled in the LLVM build, then any misuses will be caught by the 'wrap' and 'unwrap' helpers in the C bindings.

— Gordon


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev