Skip to contentSkip to conversation

OCaml tools: ask compiler for correct library path

PATCH In review Mike McClurg 4 participants 8 messages Jun 7, 2011 – Jun 21, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 OCaml tools: ask compiler for correct library path

From: Mike McClurg <[email protected]>

OCaml libraries will live in /usr/local/ if the user compiles OCaml from source. This patch asks the OCaml compiler where we should look for libraries.

NB: it may be that we should do the same thing for the NetBSD case, but I don't have a BSD box to test this out.

tools/ocaml/common.make Tue Jun 07 18:01:10 2011 +0100 renamed from tools/ocaml/common.make Mon May 23 17:38:28 2011 +0100 +1 -1
diff -r 37c77bacb52a -r ebc32e1f7f6f tools/ocaml/common.make
@@ -9,7 +9,7 @@
 OCAMLYACC ?= ocamlyacc
 
 CFLAGS += -fPIC -Werror
-CFLAGS-$(CONFIG_Linux) += -I/usr/lib64/ocaml -I/usr/lib/ocaml
+CFLAGS-$(CONFIG_Linux) += -I$(shell ocamlc -where)
 CFLAGS-$(CONFIG_NetBSD) += -I/usr/pkg/lib/ocaml -fPIC
 
 OCAMLOPTFLAG_G := $(shell $(OCAMLOPT) -h 2>&1 | sed -n 's/^  *\(-g\) .*/\1/p')
#1 lore raw

Hi,

Quoted 5 lines · Mike McClurg

From: Mike McClurg <[email protected]>

OCaml libraries will live in /usr/local/ if the user compiles OCaml from source. This patch asks the OCaml compiler where we should look for libraries.

This patch edits the #include path, not the library path. Are there any ocaml support libraries that would require -L options to $(CC)?

Tim.

Quoted 22 lines

NB: it may be that we should do the same thing for the NetBSD case, but I don't have a BSD box to test this out.

diff -r 37c77bacb52a -r ebc32e1f7f6f tools/ocaml/common.make

tools/ocaml/common.make Tue Jun 07 18:01:10 2011 +0100 renamed from tools/ocaml/common.make Mon May 23 17:38:28 2011 +0100 +1 -1
@@ -9,7 +9,7 @@
 OCAMLYACC ?= ocamlyacc
 CFLAGS += -fPIC -Werror
-CFLAGS-$(CONFIG_Linux) += -I/usr/lib64/ocaml -I/usr/lib/ocaml
+CFLAGS-$(CONFIG_Linux) += -I$(shell ocamlc -where)
 CFLAGS-$(CONFIG_NetBSD) += -I/usr/pkg/lib/ocaml -fPIC
 OCAMLOPTFLAG_G := $(shell $(OCAMLOPT) -h 2>&1 | sed -n 's/^  *\(-g\) .*/\1/p')
 
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Signature · 3 lines
Tim Deegan <[email protected]>
Principal Software Engineer, Xen Platform Team
Citrix Systems UK Ltd.  (Company #02937203, SL9 0BG)
#2 lore raw
Quoted 5 lines · Tim Deegan

Hi,

Quoted 2 lines · Mike McClurg

From: Mike McClurg<[email protected]>

Quoted 7 lines
Quoted 3 lines

OCaml libraries will live in /usr/local/ if the user compiles OCaml from source. This patch asks the OCaml compiler where we should look for libraries.

This patch edits the #include path, not the library path. Are there any ocaml support libraries that would require -L options to $(CC)?

Tim.

Thank you for correcting me, I misspoke about the include path. No, there is no requirement to pass -L options on to $(CC). The -I option will be sufficient, and this patch removes hard coded file paths from the makefile.

Mike

Quoted 22 lines
Quoted 22 lines

NB: it may be that we should do the same thing for the NetBSD case, but I don't have a BSD box to test this out.

diff -r 37c77bacb52a -r ebc32e1f7f6f tools/ocaml/common.make

tools/ocaml/common.make Tue Jun 07 18:01:10 2011 +0100 renamed from tools/ocaml/common.make Mon May 23 17:38:28 2011 +0100 +1 -1
@@ -9,7 +9,7 @@
  OCAMLYACC ?= ocamlyacc
  CFLAGS += -fPIC -Werror
-CFLAGS-$(CONFIG_Linux) += -I/usr/lib64/ocaml -I/usr/lib/ocaml
+CFLAGS-$(CONFIG_Linux) += -I$(shell ocamlc -where)
  CFLAGS-$(CONFIG_NetBSD) += -I/usr/pkg/lib/ocaml -fPIC
  OCAMLOPTFLAG_G := $(shell $(OCAMLOPT) -h 2>&1 | sed -n 's/^  *\(-g\) .*/\1/p')
 
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#4 lore raw
In reply to Tim Deegan
Quoted 10 lines · Tim Deegan

Hi,

Quoted 5 lines · Mike McClurg

From: Mike McClurg<[email protected]>

OCaml libraries will live in /usr/local/ if the user compiles OCaml from source. This patch asks the OCaml compiler where we should look for libraries.

This patch edits the #include path, not the library path. Are there any ocaml support libraries that would require -L options to $(CC)?

OCaml doesn't make the same distinction that C does. as such -I is the search path for OCaml libraries.

Signature · 1 line
Vincent
#3 lore raw
In reply to Mike McClurg
Quoted 9 lines · Mike McClurg
Quoted 8 lines · Tim Deegan

Hi,

Quoted 5 lines · Mike McClurg

From: Mike McClurg<[email protected]>

OCaml libraries will live in /usr/local/ if the user compiles OCaml from source. This patch asks the OCaml compiler where we should look for libraries.

Quoted 8 lines
Quoted 4 lines

This patch edits the #include path, not the library path. Are there any ocaml support libraries that would require -L options to $(CC)?

Tim.

Thank you for correcting me, I misspoke about the include path. No, there is no requirement to pass -L options on to $(CC). The -I option will be sufficient, and this patch removes hard coded file paths from the makefile.

Righto. Yes, the patch looks good to me.

Tim.

Signature · 3 lines
Tim Deegan <[email protected]>
Principal Software Engineer, Xen Platform Team
Citrix Systems UK Ltd.  (Company #02937203, SL9 0BG)
#5 lore raw
In reply to Vincent Hanquez
Quoted 6 lines · Vincent Hanquez
Quoted 5 lines · Tim Deegan

Hi,

Quoted 2 lines · Mike McClurg

From: Mike McClurg<[email protected]>

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

OCaml libraries will live in /usr/local/ if the user compiles OCaml from source. This patch asks the OCaml compiler where we should look for libraries.

This patch edits the #include path, not the library path. Are there any ocaml support libraries that would require -L options to $(CC)?

OCaml doesn't make the same distinction that C does.

The change is to C compiler flags.

Tim.

Signature · 3 lines
Tim Deegan <[email protected]>
Principal Software Engineer, Xen Platform Team
Citrix Systems UK Ltd.  (Company #02937203, SL9 0BG)
#6 lore raw
Quoted 5 lines
Quoted 1 line · Vincent Hanquez

OCaml doesn't make the same distinction that C does.

The change is to C compiler flags.

Ah yes, that'll show me to read the patch too quickly.

Signature · 1 line
Vincent
#7 lore raw
In reply to Mike McClurg

Mike McClurg writes ("[Xen-devel] [PATCH] OCaml tools: ask compiler for correct library path"):

Quoted 3 lines

OCaml libraries will live in /usr/local/ if the user compiles OCaml from source. This patch asks the OCaml compiler where we should look for libraries.

Applied, thanks. Something weird had happened to your email:
additional spaces had been inserted at the LHS of some of the patch lines. Perhaps you could look into this and make it not do it again :-). This time I've fixed it up.

Quoted 2 lines

NB: it may be that we should do the same thing for the NetBSD case, but I don't have a BSD box to test this out.

CCing Christoph Egger, who will hopefully have an opinion about this.

Thanks,
Ian.